From 6fda84e5c7f8f153760047a3f189c75cbe2b2dc0 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Fri, 11 Jul 2025 09:05:00 +0200 Subject: [PATCH] Add people position Signed-off-by: Bryan Frimin --- apps/console/src/hooks/graph/PeopleGraph.ts | 3 +++ .../PeopleGraphNodeQuery.graphql.ts | 24 +++++++++++++------ .../PeopleGraphPaginatedFragment.graphql.ts | 12 ++++++++-- .../PeopleGraphPaginatedQuery.graphql.ts | 13 +++++++--- .../PeopleGraphUpdateMutation.graphql.ts | 16 +++++++++---- .../__generated__/PeopleListQuery.graphql.ts | 15 ++++++++---- .../organizations/people/PeopleListPage.tsx | 2 ++ .../people/dialogs/CreatePeopleDialog.tsx | 10 +++++++- .../CreatePeopleDialogMutation.graphql.ts | 16 +++++++++---- .../people/tabs/PeopleProfileTab.tsx | 9 +++++++ 10 files changed, 95 insertions(+), 25 deletions(-) diff --git a/apps/console/src/hooks/graph/PeopleGraph.ts b/apps/console/src/hooks/graph/PeopleGraph.ts index dc2642aec..aa18016b8 100644 --- a/apps/console/src/hooks/graph/PeopleGraph.ts +++ b/apps/console/src/hooks/graph/PeopleGraph.ts @@ -80,6 +80,7 @@ const paginatedPeopleFragment = graphql` fullName primaryEmailAddress kind + position additionalEmailAddresses } } @@ -157,6 +158,7 @@ export const peopleNodeQuery = graphql` id fullName primaryEmailAddress + position kind additionalEmailAddresses } @@ -171,6 +173,7 @@ export const updatePeopleMutation = graphql` id fullName primaryEmailAddress + position kind additionalEmailAddresses } diff --git a/apps/console/src/hooks/graph/__generated__/PeopleGraphNodeQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/PeopleGraphNodeQuery.graphql.ts index 242700454..e7a967322 100644 --- a/apps/console/src/hooks/graph/__generated__/PeopleGraphNodeQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/PeopleGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<006f8f3dc3c4d41a23cc71a870aa571c>> + * @generated SignedSource<<71df408810680ded020fb0e1cc93ff79>> * @lightSyntaxTransform * @nogrep */ @@ -19,6 +19,7 @@ export type PeopleGraphNodeQuery$data = { readonly fullName?: string; readonly id?: string; readonly kind?: PeopleKind; + readonly position?: string | null | undefined; readonly primaryEmailAddress?: string; }; }; @@ -67,10 +68,17 @@ v5 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "kind", + "name": "position", "storageKey": null }, v6 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "kind", + "storageKey": null +}, +v7 = { "alias": null, "args": null, "kind": "ScalarField", @@ -99,7 +107,8 @@ return { (v3/*: any*/), (v4/*: any*/), (v5/*: any*/), - (v6/*: any*/) + (v6/*: any*/), + (v7/*: any*/) ], "type": "People", "abstractKey": null @@ -139,7 +148,8 @@ return { (v3/*: any*/), (v4/*: any*/), (v5/*: any*/), - (v6/*: any*/) + (v6/*: any*/), + (v7/*: any*/) ], "type": "People", "abstractKey": null @@ -150,16 +160,16 @@ return { ] }, "params": { - "cacheID": "319f5f4ff11db061920a25bbfda43244", + "cacheID": "850de97d42fdda9d2335c0e5219fd067", "id": null, "metadata": {}, "name": "PeopleGraphNodeQuery", "operationKind": "query", - "text": "query PeopleGraphNodeQuery(\n $peopleId: ID!\n) {\n node(id: $peopleId) {\n __typename\n ... on People {\n id\n fullName\n primaryEmailAddress\n kind\n additionalEmailAddresses\n }\n id\n }\n}\n" + "text": "query PeopleGraphNodeQuery(\n $peopleId: ID!\n) {\n node(id: $peopleId) {\n __typename\n ... on People {\n id\n fullName\n primaryEmailAddress\n position\n kind\n additionalEmailAddresses\n }\n id\n }\n}\n" } }; })(); -(node as any).hash = "b4e6fe403e30fbc27ae638d464ad7543"; +(node as any).hash = "f39d45664dba2b3bcdad07ef8baebfe9"; export default node; diff --git a/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedFragment.graphql.ts b/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedFragment.graphql.ts index ddc45ef56..804e60eaa 100644 --- a/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedFragment.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<5eba326084bfab4966727af60e2aa85c>> * @lightSyntaxTransform * @nogrep */ @@ -21,6 +21,7 @@ export type PeopleGraphPaginatedFragment$data = { readonly fullName: string; readonly id: string; readonly kind: PeopleKind; + readonly position: string | null | undefined; readonly primaryEmailAddress: string; }; }>; @@ -159,6 +160,13 @@ return { "name": "kind", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "position", + "storageKey": null + }, { "alias": null, "args": null, @@ -247,6 +255,6 @@ return { }; })(); -(node as any).hash = "c163b7909a337efd22088852b9908045"; +(node as any).hash = "5e095baf6a65e7cdbaa804d4658cbb6b"; export default node; diff --git a/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedQuery.graphql.ts index 38fece81c..a90a61e12 100644 --- a/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/PeopleGraphPaginatedQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<43878b22fe8a689f41bcd506711ddb5f>> + * @generated SignedSource<<1ec11120f71d4bc3040bcdd2665904c0>> * @lightSyntaxTransform * @nogrep */ @@ -160,6 +160,13 @@ return { "name": "kind", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "position", + "storageKey": null + }, { "alias": null, "args": null, @@ -256,12 +263,12 @@ return { ] }, "params": { - "cacheID": "b154e94ac7e783a492bc5aed7d44229d", + "cacheID": "1139d090f54b12e62e08f0a1970c9af0", "id": null, "metadata": {}, "name": "PeopleGraphPaginatedQuery", "operationKind": "query", - "text": "query PeopleGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment PeopleGraphPaginatedFragment on Organization {\n peoples(first: 50) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n additionalEmailAddresses\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query PeopleGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment PeopleGraphPaginatedFragment on Organization {\n peoples(first: 50) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n position\n additionalEmailAddresses\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); diff --git a/apps/console/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts index 2f44c8feb..f3646f368 100644 --- a/apps/console/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<18d62863109c347d5fcf7b5701a9c57b>> * @lightSyntaxTransform * @nogrep */ @@ -30,6 +30,7 @@ export type PeopleGraphUpdateMutation$data = { readonly fullName: string; readonly id: string; readonly kind: PeopleKind; + readonly position: string | null | undefined; readonly primaryEmailAddress: string; }; }; @@ -91,6 +92,13 @@ v1 = [ "name": "primaryEmailAddress", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "position", + "storageKey": null + }, { "alias": null, "args": null, @@ -130,16 +138,16 @@ return { "selections": (v1/*: any*/) }, "params": { - "cacheID": "c61ca0a6b20067ce5e0c708fc55509d8", + "cacheID": "814551d1fb24548c41d417342625071f", "id": null, "metadata": {}, "name": "PeopleGraphUpdateMutation", "operationKind": "mutation", - "text": "mutation PeopleGraphUpdateMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n people {\n id\n fullName\n primaryEmailAddress\n kind\n additionalEmailAddresses\n }\n }\n}\n" + "text": "mutation PeopleGraphUpdateMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n people {\n id\n fullName\n primaryEmailAddress\n position\n kind\n additionalEmailAddresses\n }\n }\n}\n" } }; })(); -(node as any).hash = "48c2618963704a8cd3b1f0a68817cdad"; +(node as any).hash = "ecc5666046434d5c8e80eaab0e508c11"; export default node; diff --git a/apps/console/src/hooks/graph/__generated__/PeopleListQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/PeopleListQuery.graphql.ts index 880870f18..73b2df62e 100644 --- a/apps/console/src/hooks/graph/__generated__/PeopleListQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/PeopleListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<4cfc7218bc48a818eedc2ea87ac521e6>> * @lightSyntaxTransform * @nogrep */ @@ -233,6 +233,13 @@ return { "name": "kind", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "position", + "storageKey": null + }, { "alias": null, "args": null, @@ -329,16 +336,16 @@ return { ] }, "params": { - "cacheID": "a17ff68897dbcf3daa33b073bc83f1bb", + "cacheID": "8134caa0eab10c19236a49728f1f77b6", "id": null, "metadata": {}, "name": "PeopleListQuery", "operationKind": "query", - "text": "query PeopleListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: PeopleOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...PeopleGraphPaginatedFragment_16fISc\n id\n }\n}\n\nfragment PeopleGraphPaginatedFragment_16fISc on Organization {\n peoples(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n additionalEmailAddresses\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query PeopleListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: PeopleOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...PeopleGraphPaginatedFragment_16fISc\n id\n }\n}\n\nfragment PeopleGraphPaginatedFragment_16fISc on Organization {\n peoples(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n position\n additionalEmailAddresses\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); -(node as any).hash = "c163b7909a337efd22088852b9908045"; +(node as any).hash = "5e095baf6a65e7cdbaa804d4658cbb6b"; export default node; diff --git a/apps/console/src/pages/organizations/people/PeopleListPage.tsx b/apps/console/src/pages/organizations/people/PeopleListPage.tsx index 1d705e609..8dec52697 100644 --- a/apps/console/src/pages/organizations/people/PeopleListPage.tsx +++ b/apps/console/src/pages/organizations/people/PeopleListPage.tsx @@ -59,6 +59,7 @@ export default function PeopleListPage({ {__("Name")} {__("Role")} + {__("Position")} {__("Actions")} @@ -101,6 +102,7 @@ function PeopleRow({ {getRole(__, people.kind)} + {people.position} (v as string[]).filter((v) => !!v), - z.array(z.string().email()), + z.array(z.string().email()) ), kind: z.enum(peopleRoles), }); @@ -46,6 +47,7 @@ export const createPeopleMutation = graphql` id fullName primaryEmailAddress + position kind additionalEmailAddresses } @@ -103,6 +105,12 @@ export function CreatePeopleDialog({ children, connectionId }: Props) { {...register("primaryEmailAddress")} type="email" /> + > + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -32,6 +32,7 @@ export type CreatePeopleDialogMutation$data = { readonly fullName: string; readonly id: string; readonly kind: PeopleKind; + readonly position: string | null | undefined; readonly primaryEmailAddress: string; }; }; @@ -97,6 +98,13 @@ v3 = { "name": "primaryEmailAddress", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "position", + "storageKey": null + }, { "alias": null, "args": null, @@ -183,16 +191,16 @@ return { ] }, "params": { - "cacheID": "634c2845825a02a0343c3211b41c90a0", + "cacheID": "4065779551f13f5555fa8a0f1b1ae54c", "id": null, "metadata": {}, "name": "CreatePeopleDialogMutation", "operationKind": "mutation", - "text": "mutation CreatePeopleDialogMutation(\n $input: CreatePeopleInput!\n) {\n createPeople(input: $input) {\n peopleEdge {\n node {\n id\n fullName\n primaryEmailAddress\n kind\n additionalEmailAddresses\n }\n }\n }\n}\n" + "text": "mutation CreatePeopleDialogMutation(\n $input: CreatePeopleInput!\n) {\n createPeople(input: $input) {\n peopleEdge {\n node {\n id\n fullName\n primaryEmailAddress\n position\n kind\n additionalEmailAddresses\n }\n }\n }\n}\n" } }; })(); -(node as any).hash = "867aad1276c26bd787ddf80c6f166abe"; +(node as any).hash = "1fbca12cb827104dc700c70a677f92aa"; export default node; diff --git a/apps/console/src/pages/organizations/people/tabs/PeopleProfileTab.tsx b/apps/console/src/pages/organizations/people/tabs/PeopleProfileTab.tsx index 279475441..cacc417b0 100644 --- a/apps/console/src/pages/organizations/people/tabs/PeopleProfileTab.tsx +++ b/apps/console/src/pages/organizations/people/tabs/PeopleProfileTab.tsx @@ -13,6 +13,7 @@ import { EmailsField } from "/components/form/EmailsField"; const schema = z.object({ fullName: z.string().min(1), primaryEmailAddress: z.string().email(), + position: z.string().min(1).nullable(), additionalEmailAddresses: z.preprocess( // Empty additional emails are skipped (v) => (v as string[]).filter((v) => !!v), @@ -32,6 +33,7 @@ export default function PeopleProfileTab() { kind: people.kind, fullName: people.fullName, primaryEmailAddress: people.primaryEmailAddress, + position: people.position, additionalEmailAddresses: [...(people.additionalEmailAddresses ?? [])], }, }); @@ -50,6 +52,7 @@ export default function PeopleProfileTab() { id: people.id!, fullName: data.fullName, primaryEmailAddress: data.primaryEmailAddress, + position: data.position, additionalEmailAddresses: data.additionalEmailAddresses, // TODO : make these field optional in the query (server side) kind: people.kind, @@ -65,6 +68,12 @@ export default function PeopleProfileTab() {
+