Skip to content

Commit

Permalink
fix(rbac): show 0 if no members in a group (janus-idp#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
divyanshiGupta authored Feb 8, 2024
1 parent ef673aa commit 0410800
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
45 changes: 27 additions & 18 deletions plugins/rbac/src/components/CreateRole/AddedMembersTableColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,27 @@ import { FormikErrors } from 'formik';
import { getKindNamespaceName } from '../../utils/rbac-utils';
import { RoleFormValues, SelectedMember } from './types';

export const basicSelectedMembersColumns =
(): TableColumn<SelectedMember>[] => [
{
title: 'Type',
field: 'type',
type: 'string',
},
{
title: 'Members',
field: 'members',
type: 'numeric',
align: 'left',
emptyValue: '-',
},
];

export const reviewStepMemebersTableColumns = () => [
{
title: 'Name',
field: 'label',
type: 'string',
},
...basicSelectedMembersColumns(),
{
title: 'Type',
field: 'type',
type: 'string',
},
{
title: 'Members',
field: 'members',
type: 'numeric',
align: 'left',
render: (mem: number) => {
if (mem || mem === 0) return mem;
return '-';
},
},
];

export const selectedMembersColumns = (
Expand Down Expand Up @@ -63,7 +61,18 @@ export const selectedMembersColumns = (
);
},
},
...basicSelectedMembersColumns(),
{
title: 'Type',
field: 'type',
type: 'string',
},
{
title: 'Members',
field: 'members',
type: 'numeric',
align: 'left',
emptyValue: '-',
},
{
title: 'Actions',
sorting: false,
Expand Down
2 changes: 1 addition & 1 deletion plugins/rbac/src/utils/create-role-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const getMembersCount = (member: MemberEntity) => {
temp++;
}
return temp;
}, 0) || 1
}, 0)
: undefined;
};

Expand Down

0 comments on commit 0410800

Please sign in to comment.