Skip to content

Commit d52db84

Browse files
committed
Update frontend code to not use identifier anymore
1 parent 5003664 commit d52db84

File tree

7 files changed

+18
-31
lines changed

7 files changed

+18
-31
lines changed

frontend/app/src/entities/role-manager/api/getGlobalPermissions.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ export const GET_ROLE_MANAGEMENT_GLOBAL_PERMISSIONS = graphql(`
2424
}
2525
}
2626
}
27-
identifier {
28-
value
29-
}
3027
__typename
3128
}
3229
}

frontend/app/src/entities/role-manager/api/getObjectPermissions.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ export const GET_ROLE_MANAGEMENT_OBJECT_PERMISSIONS = graphql(`
3030
}
3131
}
3232
}
33-
identifier {
34-
value
35-
}
3633
}
3734
}
3835
permissions {

frontend/app/src/entities/role-manager/api/getRoles.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ export const GET_ROLE_MANAGEMENT_ROLES = graphql(`
2727
node {
2828
id
2929
display_label
30-
identifier {
31-
value
32-
}
3330
}
3431
}
3532
}

frontend/app/src/entities/role-manager/ui/global-permissions.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ function GlobalPermissions() {
6262

6363
const columns = [
6464
{
65-
name: "identifier",
66-
label: "Identifier",
65+
name: "display_label",
66+
label: "Label",
6767
},
6868
{
6969
name: "action",
@@ -85,7 +85,6 @@ function GlobalPermissions() {
8585
return {
8686
values: {
8787
id: edge?.node?.id,
88-
display_label: edge?.node?.display_label,
8988
hfid: edge?.node?.hfid,
9089
action: { value: edge?.node?.action?.value },
9190
decision: {
@@ -105,9 +104,9 @@ function GlobalPermissions() {
105104
),
106105
value: { edges: edge?.node?.roles?.edges },
107106
},
108-
identifier: {
109-
value: edge?.node?.identifier?.value,
110-
display: <BadgeCopy value={edge?.node?.identifier?.value} />,
107+
display_label: {
108+
value: edge?.node?.display_label,
109+
display: <BadgeCopy value={edge?.node?.display_label} />,
111110
},
112111
__typename: edge.node.__typename,
113112
},
@@ -192,7 +191,7 @@ function GlobalPermissions() {
192191
title={
193192
<SlideOverTitle
194193
schema={schema}
195-
currentObjectLabel={rowToUpdate?.identifier?.value ?? "New"}
194+
currentObjectLabel={rowToUpdate?.display_label?.value ?? "New"}
196195
title={`${rowToUpdate ? "Update" : "Create"} ${schema.label}`}
197196
subtitle={schema.description}
198197
/>

frontend/app/src/entities/role-manager/ui/object-permissions.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ function Permissions() {
7777

7878
const columns = [
7979
{
80-
name: "identifier",
81-
label: "Identifier",
80+
name: "display_label",
81+
label: "Label",
8282
},
8383
{
8484
name: "namespace",
@@ -111,7 +111,6 @@ function Permissions() {
111111
return {
112112
values: {
113113
id: edge?.node?.id,
114-
display_label: edge?.node?.display_label,
115114
hfid: edge?.node?.hfid,
116115
display: {
117116
value: edge?.node ? getNodeLabel(edge.node) : undefined,
@@ -147,9 +146,9 @@ function Permissions() {
147146
/>
148147
),
149148
},
150-
identifier: {
151-
value: edge?.node?.identifier?.value,
152-
display: <BadgeCopy value={edge?.node?.identifier?.value} />,
149+
display_label: {
150+
value: edge?.node?.display_label,
151+
display: <BadgeCopy value={edge?.node?.display_label} />,
153152
},
154153
__typename: edge?.node?.__typename,
155154
},

frontend/app/src/entities/role-manager/ui/permission-combobox.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ import { AddRelationshipAction } from "@/entities/nodes/relationships/ui/add-rel
2323
import type { NodeCore } from "@/entities/nodes/types";
2424
import { useSchema } from "@/entities/schema/ui/hooks/useSchema";
2525

26-
type PermissionNode = NodeCore & { identifier: { value: string } };
26+
type PermissionNode = NodeCore;
2727

2828
export interface PermissionComboboxProps extends Omit<PopoverTriggerProps, "value" | "onChange"> {
2929
value: PermissionNode[] | null;
3030
onChange: (value: PermissionNode[]) => void;
3131
}
3232

33-
// This component is a temporary solution to display the permissions in a combobox
34-
// We cannot use relationship many because the general beheviour is to use hfid/display_label
35-
// On permission, label is it an attribute called identifier
33+
// This component is used to display the permissions in a combobox
34+
// It uses display_label like other relationship pickers
3635
export function PermissionCombobox({
3736
value,
3837
onChange,
@@ -59,7 +58,7 @@ export function PermissionCombobox({
5958
<div className="flex grow flex-wrap gap-2">
6059
{value?.map((node) => (
6160
<Badge key={node.id} className="flex items-center gap-1 pr-0.5">
62-
{node.identifier?.value}
61+
{node.display_label}
6362

6463
<Button
6564
size="icon"
@@ -140,13 +139,12 @@ export const PermissionComboboxList = forwardRef<HTMLDivElement, RelationshipCom
140139
onSelect={() =>
141140
onSelect({
142141
id: node.id,
143-
display_label: node.identifier.value,
144-
identifier: { value: node.identifier.value },
142+
display_label: node.display_label,
145143
__typename: node.__typename,
146144
})
147145
}
148146
>
149-
<span className="truncate">{node.identifier.value}</span>
147+
<span className="truncate">{node.display_label}</span>
150148
</ComboboxItem>
151149
);
152150
});

frontend/app/src/entities/role-manager/ui/roles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function Roles() {
9797
value: { edges: edge?.node?.permissions?.edges },
9898
display: (
9999
<InlineDisplay
100-
items={edge?.node?.permissions?.edges?.map((edge) => edge?.node?.identifier?.value)}
100+
items={edge?.node?.permissions?.edges?.map((edge) => edge?.node?.display_label)}
101101
render={(item) => <Badge>{item}</Badge>}
102102
/>
103103
),

0 commit comments

Comments
 (0)