Skip to content

Commit

Permalink
fix(user-management): update role to displayName
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtcoder19 committed Mar 13, 2024
1 parent 65d99a5 commit 3e87aaa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ interface IResource {
onDelete: (item: BaseType) => void;
}

const mapRoleToDisplayName = (role: string): string => {
switch (role) {
case 'account_owner':
return 'owner';
case 'account_member':
return 'member';
case 'account_admin':
return 'admin';
default:
return role;
}
};

const ExtraButton = ({ onDelete }: { onDelete: () => void }) => {
return (
<ResourceExtraAction
Expand Down Expand Up @@ -70,7 +83,7 @@ const ListView = ({ items = [], onDelete }: IResource) => {
},
{
key: 2,
render: () => <ListBody data={item.role} />,
render: () => <ListBody data={mapRoleToDisplayName(item.role)} />,
},
{
key: 3,
Expand Down
10 changes: 5 additions & 5 deletions src/apps/console/server/gql/queries/router-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const routerQueries = (executor: IExecutor) => ({
{
transformer: (data: ConsoleCreateRouterMutation) =>
data.core_createRouter,
vars(_: ConsoleCreateRouterMutationVariables) { },
vars(_: ConsoleCreateRouterMutationVariables) {},
}
),
updateRouter: executor(
Expand All @@ -59,7 +59,7 @@ export const routerQueries = (executor: IExecutor) => ({
{
transformer: (data: ConsoleUpdateRouterMutation) =>
data.core_updateRouter,
vars(_: ConsoleUpdateRouterMutationVariables) { },
vars(_: ConsoleUpdateRouterMutationVariables) {},
}
),
deleteRouter: executor(
Expand All @@ -79,7 +79,7 @@ export const routerQueries = (executor: IExecutor) => ({
{
transformer: (data: ConsoleDeleteRouterMutation) =>
data.core_deleteRouter,
vars(_: ConsoleDeleteRouterMutationVariables) { },
vars(_: ConsoleDeleteRouterMutationVariables) {},
}
),
listRouters: executor(
Expand Down Expand Up @@ -193,7 +193,7 @@ export const routerQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleListRoutersQuery) => data.core_listRouters,
vars(_: ConsoleListRoutersQueryVariables) { },
vars(_: ConsoleListRoutersQueryVariables) {},
}
),
getRouter: executor(
Expand Down Expand Up @@ -283,7 +283,7 @@ export const routerQueries = (executor: IExecutor) => ({
`,
{
transformer: (data: ConsoleGetRouterQuery) => data.core_getRouter,
vars(_: ConsoleGetRouterQueryVariables) { },
vars(_: ConsoleGetRouterQueryVariables) {},
}
),
});

0 comments on commit 3e87aaa

Please sign in to comment.