debian-mirror-gitlab/app/assets/javascripts/projects/settings/utils.js

18 lines
505 B
JavaScript
Raw Normal View History

2023-03-04 22:38:38 +05:30
export const getAccessLevels = (accessLevels = {}) => {
const total = accessLevels.edges?.length;
const accessLevelTypes = { total, users: [], groups: [], roles: [] };
accessLevels.edges?.forEach(({ node }) => {
if (node.user) {
const src = node.user.avatarUrl;
accessLevelTypes.users.push({ src, ...node.user });
} else if (node.group) {
accessLevelTypes.groups.push(node);
} else {
accessLevelTypes.roles.push(node);
}
});
return accessLevelTypes;
};