diff --git a/apps/console/src/__generated__/core/ProcessingActivityGraphListQuery.graphql.ts b/apps/console/src/__generated__/core/ProcessingActivityGraphListQuery.graphql.ts index 42ea61885..8f5a6c32d 100644 --- a/apps/console/src/__generated__/core/ProcessingActivityGraphListQuery.graphql.ts +++ b/apps/console/src/__generated__/core/ProcessingActivityGraphListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<14e03b23c216da916e36cecb49aefa6d>> + * @generated SignedSource<<5c57612f8793f7b056bf0046febe42ca>> * @lightSyntaxTransform * @nogrep */ @@ -17,6 +17,9 @@ export type ProcessingActivityGraphListQuery$variables = { export type ProcessingActivityGraphListQuery$data = { readonly node: { readonly canCreateProcessingActivity?: boolean; + readonly canExportDataProtectionImpactAssessments?: boolean; + readonly canExportProcessingActivities?: boolean; + readonly canExportTransferImpactAssessments?: boolean; readonly " $fragmentSpreads": FragmentRefs<"ProcessingActivitiesPageDPIAFragment" | "ProcessingActivitiesPageFragment" | "ProcessingActivitiesPageTIAFragment">; }; }; @@ -58,30 +61,69 @@ v2 = { "name": "permission", "storageKey": "permission(action:\"core:processing-activity:create\")" }, -v3 = [ +v3 = { + "alias": "canExportProcessingActivities", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:processing-activity:export" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:processing-activity:export\")" +}, +v4 = { + "alias": "canExportDataProtectionImpactAssessments", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:data-protection-impact-assessment:export" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:data-protection-impact-assessment:export\")" +}, +v5 = { + "alias": "canExportTransferImpactAssessments", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:transfer-impact-assessment:export" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:transfer-impact-assessment:export\")" +}, +v6 = [ { "kind": "Variable", "name": "snapshotId", "variableName": "snapshotId" } ], -v4 = { +v7 = { "alias": null, "args": null, "kind": "ScalarField", "name": "__typename", "storageKey": null }, -v5 = { +v8 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v6 = [ +v9 = [ { - "fields": (v3/*: any*/), + "fields": (v6/*: any*/), "kind": "ObjectValue", "name": "filter" }, @@ -91,42 +133,42 @@ v6 = [ "value": 10 } ], -v7 = { +v10 = { "alias": null, "args": null, "kind": "ScalarField", "name": "totalCount", "storageKey": null }, -v8 = { +v11 = { "alias": null, "args": null, "kind": "ScalarField", "name": "name", "storageKey": null }, -v9 = { +v12 = { "alias": null, "args": null, "kind": "ScalarField", "name": "createdAt", "storageKey": null }, -v10 = { +v13 = { "alias": null, "args": null, "kind": "ScalarField", "name": "updatedAt", "storageKey": null }, -v11 = { +v14 = { "alias": null, "args": null, "kind": "ScalarField", "name": "cursor", "storageKey": null }, -v12 = { +v15 = { "alias": null, "args": null, "concreteType": "PageInfo", @@ -151,7 +193,7 @@ v12 = { ], "storageKey": null }, -v13 = { +v16 = { "kind": "ClientExtension", "selections": [ { @@ -163,10 +205,10 @@ v13 = { } ] }, -v14 = [ +v17 = [ "filter" ], -v15 = { +v18 = { "alias": null, "args": null, "concreteType": "ProcessingActivity", @@ -174,8 +216,8 @@ v15 = { "name": "processingActivity", "plural": false, "selections": [ - (v5/*: any*/), - (v8/*: any*/) + (v8/*: any*/), + (v11/*: any*/) ], "storageKey": null }; @@ -198,18 +240,21 @@ return { "kind": "InlineFragment", "selections": [ (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), { - "args": (v3/*: any*/), + "args": (v6/*: any*/), "kind": "FragmentSpread", "name": "ProcessingActivitiesPageFragment" }, { - "args": (v3/*: any*/), + "args": (v6/*: any*/), "kind": "FragmentSpread", "name": "ProcessingActivitiesPageDPIAFragment" }, { - "args": (v3/*: any*/), + "args": (v6/*: any*/), "kind": "FragmentSpread", "name": "ProcessingActivitiesPageTIAFragment" } @@ -238,21 +283,24 @@ return { "name": "node", "plural": false, "selections": [ - (v4/*: any*/), - (v5/*: any*/), + (v7/*: any*/), + (v8/*: any*/), { "kind": "InlineFragment", "selections": [ (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), { "alias": null, - "args": (v6/*: any*/), + "args": (v9/*: any*/), "concreteType": "ProcessingActivityConnection", "kind": "LinkedField", "name": "processingActivities", "plural": false, "selections": [ - (v7/*: any*/), + (v10/*: any*/), { "alias": null, "args": null, @@ -269,7 +317,7 @@ return { "name": "node", "plural": false, "selections": [ - (v5/*: any*/), + (v8/*: any*/), { "alias": null, "args": null, @@ -284,7 +332,7 @@ return { "name": "sourceId", "storageKey": null }, - (v8/*: any*/), + (v11/*: any*/), { "alias": null, "args": null, @@ -327,8 +375,8 @@ return { "name": "internationalTransfers", "storageKey": null }, - (v9/*: any*/), - (v10/*: any*/), + (v12/*: any*/), + (v13/*: any*/), { "alias": "canUpdate", "args": [ @@ -355,23 +403,23 @@ return { "name": "permission", "storageKey": "permission(action:\"core:processing-activity:delete\")" }, - (v4/*: any*/) + (v7/*: any*/) ], "storageKey": null }, - (v11/*: any*/) + (v14/*: any*/) ], "storageKey": null }, - (v12/*: any*/), - (v13/*: any*/) + (v15/*: any*/), + (v16/*: any*/) ], "storageKey": null }, { "alias": null, - "args": (v6/*: any*/), - "filters": (v14/*: any*/), + "args": (v9/*: any*/), + "filters": (v17/*: any*/), "handle": "connection", "key": "ProcessingActivitiesPage_processingActivities", "kind": "LinkedHandle", @@ -379,13 +427,13 @@ return { }, { "alias": null, - "args": (v6/*: any*/), + "args": (v9/*: any*/), "concreteType": "DataProtectionImpactAssessmentConnection", "kind": "LinkedField", "name": "dataProtectionImpactAssessments", "plural": false, "selections": [ - (v7/*: any*/), + (v10/*: any*/), { "alias": null, "args": null, @@ -402,7 +450,7 @@ return { "name": "node", "plural": false, "selections": [ - (v5/*: any*/), + (v8/*: any*/), { "alias": null, "args": null, @@ -424,26 +472,26 @@ return { "name": "residualRisk", "storageKey": null }, - (v15/*: any*/), - (v9/*: any*/), - (v10/*: any*/), - (v4/*: any*/) + (v18/*: any*/), + (v12/*: any*/), + (v13/*: any*/), + (v7/*: any*/) ], "storageKey": null }, - (v11/*: any*/) + (v14/*: any*/) ], "storageKey": null }, - (v12/*: any*/), - (v13/*: any*/) + (v15/*: any*/), + (v16/*: any*/) ], "storageKey": null }, { "alias": null, - "args": (v6/*: any*/), - "filters": (v14/*: any*/), + "args": (v9/*: any*/), + "filters": (v17/*: any*/), "handle": "connection", "key": "ProcessingActivitiesPage_dataProtectionImpactAssessments", "kind": "LinkedHandle", @@ -451,13 +499,13 @@ return { }, { "alias": null, - "args": (v6/*: any*/), + "args": (v9/*: any*/), "concreteType": "TransferImpactAssessmentConnection", "kind": "LinkedField", "name": "transferImpactAssessments", "plural": false, "selections": [ - (v7/*: any*/), + (v10/*: any*/), { "alias": null, "args": null, @@ -474,7 +522,7 @@ return { "name": "node", "plural": false, "selections": [ - (v5/*: any*/), + (v8/*: any*/), { "alias": null, "args": null, @@ -496,26 +544,26 @@ return { "name": "localLawRisk", "storageKey": null }, - (v15/*: any*/), - (v9/*: any*/), - (v10/*: any*/), - (v4/*: any*/) + (v18/*: any*/), + (v12/*: any*/), + (v13/*: any*/), + (v7/*: any*/) ], "storageKey": null }, - (v11/*: any*/) + (v14/*: any*/) ], "storageKey": null }, - (v12/*: any*/), - (v13/*: any*/) + (v15/*: any*/), + (v16/*: any*/) ], "storageKey": null }, { "alias": null, - "args": (v6/*: any*/), - "filters": (v14/*: any*/), + "args": (v9/*: any*/), + "filters": (v17/*: any*/), "handle": "connection", "key": "ProcessingActivitiesPage_transferImpactAssessments", "kind": "LinkedHandle", @@ -531,16 +579,16 @@ return { ] }, "params": { - "cacheID": "1d48f2badad2cfdbc1d36a06756a9ec7", + "cacheID": "84a26e65e3de62f76f034786cf174f80", "id": null, "metadata": {}, "name": "ProcessingActivityGraphListQuery", "operationKind": "query", - "text": "query ProcessingActivityGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateProcessingActivity: permission(action: \"core:processing-activity:create\")\n ...ProcessingActivitiesPageFragment_3iomuz\n ...ProcessingActivitiesPageDPIAFragment_3iomuz\n ...ProcessingActivitiesPageTIAFragment_3iomuz\n }\n id\n }\n}\n\nfragment ProcessingActivitiesPageDPIAFragment_3iomuz on Organization {\n id\n dataProtectionImpactAssessments(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n description\n potentialRisk\n residualRisk\n processingActivity {\n id\n name\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProcessingActivitiesPageFragment_3iomuz on Organization {\n id\n processingActivities(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n snapshotId\n sourceId\n name\n purpose\n dataSubjectCategory\n personalDataCategory\n lawfulBasis\n location\n internationalTransfers\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:processing-activity:update\")\n canDelete: permission(action: \"core:processing-activity:delete\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProcessingActivitiesPageTIAFragment_3iomuz on Organization {\n id\n transferImpactAssessments(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n dataSubjects\n transfer\n localLawRisk\n processingActivity {\n id\n name\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" + "text": "query ProcessingActivityGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateProcessingActivity: permission(action: \"core:processing-activity:create\")\n canExportProcessingActivities: permission(action: \"core:processing-activity:export\")\n canExportDataProtectionImpactAssessments: permission(action: \"core:data-protection-impact-assessment:export\")\n canExportTransferImpactAssessments: permission(action: \"core:transfer-impact-assessment:export\")\n ...ProcessingActivitiesPageFragment_3iomuz\n ...ProcessingActivitiesPageDPIAFragment_3iomuz\n ...ProcessingActivitiesPageTIAFragment_3iomuz\n }\n id\n }\n}\n\nfragment ProcessingActivitiesPageDPIAFragment_3iomuz on Organization {\n id\n dataProtectionImpactAssessments(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n description\n potentialRisk\n residualRisk\n processingActivity {\n id\n name\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProcessingActivitiesPageFragment_3iomuz on Organization {\n id\n processingActivities(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n snapshotId\n sourceId\n name\n purpose\n dataSubjectCategory\n personalDataCategory\n lawfulBasis\n location\n internationalTransfers\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:processing-activity:update\")\n canDelete: permission(action: \"core:processing-activity:delete\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n\nfragment ProcessingActivitiesPageTIAFragment_3iomuz on Organization {\n id\n transferImpactAssessments(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n dataSubjects\n transfer\n localLawRisk\n processingActivity {\n id\n name\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n" } }; })(); -(node as any).hash = "7a0d589abac7bbd3710a0caad37d6273"; +(node as any).hash = "6efb688e3142c0eceb054ded9df044de"; export default node; diff --git a/apps/console/src/__generated__/core/SnapshotFormDialogCreateMutation.graphql.ts b/apps/console/src/__generated__/core/SnapshotFormDialogCreateMutation.graphql.ts index c8f80a8eb..a0653b247 100644 --- a/apps/console/src/__generated__/core/SnapshotFormDialogCreateMutation.graphql.ts +++ b/apps/console/src/__generated__/core/SnapshotFormDialogCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<7d676ad166c7c858dc8dbc909ed500ea>> + * @generated SignedSource<<8fe6c01dea59b2ae2d04050e3cb959d1>> * @lightSyntaxTransform * @nogrep */ @@ -24,6 +24,7 @@ export type SnapshotFormDialogCreateMutation$data = { readonly createSnapshot: { readonly snapshotEdge: { readonly node: { + readonly canDelete: boolean; readonly createdAt: string; readonly description: string | null | undefined; readonly id: string; @@ -106,6 +107,19 @@ v3 = { "kind": "ScalarField", "name": "createdAt", "storageKey": null + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:snapshot:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:snapshot:delete\")" } ], "storageKey": null @@ -179,16 +193,16 @@ return { ] }, "params": { - "cacheID": "e60d598bc7f5c4958168405725664334", + "cacheID": "5165891e3f49f2b9e3d1a0b29a0f8bf6", "id": null, "metadata": {}, "name": "SnapshotFormDialogCreateMutation", "operationKind": "mutation", - "text": "mutation SnapshotFormDialogCreateMutation(\n $input: CreateSnapshotInput!\n) {\n createSnapshot(input: $input) {\n snapshotEdge {\n node {\n id\n name\n description\n type\n createdAt\n }\n }\n }\n}\n" + "text": "mutation SnapshotFormDialogCreateMutation(\n $input: CreateSnapshotInput!\n) {\n createSnapshot(input: $input) {\n snapshotEdge {\n node {\n id\n name\n description\n type\n createdAt\n canDelete: permission(action: \"core:snapshot:delete\")\n }\n }\n }\n}\n" } }; })(); -(node as any).hash = "b03087e1699a90953aad7cdedaeee1a4"; +(node as any).hash = "1a844eb9af4ea94b194deaf65ba068a0"; export default node; diff --git a/apps/console/src/__generated__/core/SnapshotGraphListQuery.graphql.ts b/apps/console/src/__generated__/core/SnapshotGraphListQuery.graphql.ts index c8cb115bd..4d1f35478 100644 --- a/apps/console/src/__generated__/core/SnapshotGraphListQuery.graphql.ts +++ b/apps/console/src/__generated__/core/SnapshotGraphListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<55bde95f500bc2496ce224e275e49984>> * @lightSyntaxTransform * @nogrep */ @@ -15,6 +15,7 @@ export type SnapshotGraphListQuery$variables = { }; export type SnapshotGraphListQuery$data = { readonly organization: { + readonly canCreateSnapshot?: boolean; readonly " $fragmentSpreads": FragmentRefs<"SnapshotsPageFragment">; }; }; @@ -39,20 +40,33 @@ v1 = [ } ], v2 = { + "alias": "canCreateSnapshot", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:snapshot:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:snapshot:create\")" +}, +v3 = { "alias": null, "args": null, "kind": "ScalarField", "name": "__typename", "storageKey": null }, -v3 = [ +v4 = [ { "kind": "Literal", "name": "first", "value": 100 } ], -v4 = { +v5 = { "alias": null, "args": null, "kind": "ScalarField", @@ -77,6 +91,7 @@ return { { "kind": "InlineFragment", "selections": [ + (v2/*: any*/), { "args": null, "kind": "FragmentSpread", @@ -107,13 +122,14 @@ return { "name": "node", "plural": false, "selections": [ - (v2/*: any*/), + (v3/*: any*/), { "kind": "InlineFragment", "selections": [ + (v2/*: any*/), { "alias": null, - "args": (v3/*: any*/), + "args": (v4/*: any*/), "concreteType": "SnapshotConnection", "kind": "LinkedField", "name": "snapshots", @@ -135,7 +151,7 @@ return { "name": "node", "plural": false, "selections": [ - (v4/*: any*/), + (v5/*: any*/), { "alias": null, "args": null, @@ -164,7 +180,20 @@ return { "name": "createdAt", "storageKey": null }, - (v2/*: any*/) + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:snapshot:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:snapshot:delete\")" + }, + (v3/*: any*/) ], "storageKey": null }, @@ -220,7 +249,7 @@ return { }, { "alias": null, - "args": (v3/*: any*/), + "args": (v4/*: any*/), "filters": null, "handle": "connection", "key": "SnapshotsGraphListQuery__snapshots", @@ -231,23 +260,23 @@ return { "type": "Organization", "abstractKey": null }, - (v4/*: any*/) + (v5/*: any*/) ], "storageKey": null } ] }, "params": { - "cacheID": "eda538d8a5e4e94551012bbb6b8da92f", + "cacheID": "5925e1c6f87d598008baeef50bf620c7", "id": null, "metadata": {}, "name": "SnapshotGraphListQuery", "operationKind": "query", - "text": "query SnapshotGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...SnapshotsPageFragment\n }\n id\n }\n}\n\nfragment SnapshotsPageFragment on Organization {\n snapshots(first: 100) {\n edges {\n node {\n id\n name\n description\n type\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + "text": "query SnapshotGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateSnapshot: permission(action: \"core:snapshot:create\")\n ...SnapshotsPageFragment\n }\n id\n }\n}\n\nfragment SnapshotsPageFragment on Organization {\n snapshots(first: 100) {\n edges {\n node {\n id\n name\n description\n type\n createdAt\n canDelete: permission(action: \"core:snapshot:delete\")\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" } }; })(); -(node as any).hash = "0f264bca502a59b7f8b8ec729d0ce1ff"; +(node as any).hash = "18d12720fafef47af62376e8461fd19f"; export default node; diff --git a/apps/console/src/__generated__/core/SnapshotsPageFragment.graphql.ts b/apps/console/src/__generated__/core/SnapshotsPageFragment.graphql.ts index d82bf89dd..d5b24f1f7 100644 --- a/apps/console/src/__generated__/core/SnapshotsPageFragment.graphql.ts +++ b/apps/console/src/__generated__/core/SnapshotsPageFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<8aa2e602e0b579ac6a320207afa7c558>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -16,6 +16,7 @@ export type SnapshotsPageFragment$data = { readonly __id: string; readonly edges: ReadonlyArray<{ readonly node: { + readonly canDelete: boolean; readonly createdAt: string; readonly description: string | null | undefined; readonly id: string; @@ -107,6 +108,19 @@ const node: ReaderFragment = { "name": "createdAt", "storageKey": null }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:snapshot:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:snapshot:delete\")" + }, { "alias": null, "args": null, @@ -172,6 +186,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "700dede55fd00f2b57dbbb6ed2e2613d"; +(node as any).hash = "d924051b479e33aa7fb627e7ad8ad664"; export default node; diff --git a/apps/console/src/hooks/graph/ProcessingActivityGraph.ts b/apps/console/src/hooks/graph/ProcessingActivityGraph.ts index 1fadbe7c6..8978864fd 100644 --- a/apps/console/src/hooks/graph/ProcessingActivityGraph.ts +++ b/apps/console/src/hooks/graph/ProcessingActivityGraph.ts @@ -19,6 +19,15 @@ export const processingActivitiesQuery = graphql` canCreateProcessingActivity: permission( action: "core:processing-activity:create" ) + canExportProcessingActivities: permission( + action: "core:processing-activity:export" + ) + canExportDataProtectionImpactAssessments: permission( + action: "core:data-protection-impact-assessment:export" + ) + canExportTransferImpactAssessments: permission( + action: "core:transfer-impact-assessment:export" + ) ...ProcessingActivitiesPageFragment @arguments(snapshotId: $snapshotId) ...ProcessingActivitiesPageDPIAFragment @arguments(snapshotId: $snapshotId) diff --git a/apps/console/src/hooks/graph/SnapshotGraph.ts b/apps/console/src/hooks/graph/SnapshotGraph.ts index 38f9ca38c..48f93d08c 100644 --- a/apps/console/src/hooks/graph/SnapshotGraph.ts +++ b/apps/console/src/hooks/graph/SnapshotGraph.ts @@ -11,6 +11,7 @@ export const snapshotsQuery = graphql` query SnapshotGraphListQuery($organizationId: ID!) { organization: node(id: $organizationId) { ... on Organization { + canCreateSnapshot: permission(action: "core:snapshot:create") ...SnapshotsPageFragment } } @@ -67,7 +68,7 @@ export const deleteSnapshotMutation = graphql` export const useDeleteSnapshot = ( snapshot: { id: string; name: string }, - connectionId: string + connectionId: string, ) => { const { __ } = useTranslate(); const [mutate] = useMutationWithToasts(deleteSnapshotMutation, { @@ -90,11 +91,11 @@ export const useDeleteSnapshot = ( { message: sprintf( __( - "This will permanently delete the snapshot %s. This action cannot be undone." + "This will permanently delete the snapshot %s. This action cannot be undone.", ), - snapshot.name + snapshot.name, ), - } + }, ); }; }; diff --git a/apps/console/src/pages/organizations/processingActivities/ProcessingActivitiesPage.tsx b/apps/console/src/pages/organizations/processingActivities/ProcessingActivitiesPage.tsx index 6f0e4385c..ba109bd1d 100644 --- a/apps/console/src/pages/organizations/processingActivities/ProcessingActivitiesPage.tsx +++ b/apps/console/src/pages/organizations/processingActivities/ProcessingActivitiesPage.tsx @@ -1,841 +1,871 @@ import { - Button, - IconPlusLarge, - PageHeader, - Card, - Thead, - Tbody, - Tr, - Th, - Td, - Badge, - ActionDropdown, - DropdownItem, - IconTrashCan, - Table, - useConfirm, - Tabs, - TabItem, - IconArrowDown, - IconChevronDown, - Spinner, - Dropdown, + Button, + IconPlusLarge, + PageHeader, + Card, + Thead, + Tbody, + Tr, + Th, + Td, + Badge, + ActionDropdown, + DropdownItem, + IconTrashCan, + Table, + useConfirm, + Tabs, + TabItem, + IconArrowDown, + IconChevronDown, + Spinner, + Dropdown, } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; import { usePageTitle } from "@probo/hooks"; import { - getLawfulBasisLabel, - getResidualRiskLabel, + getLawfulBasisLabel, + getResidualRiskLabel, } from "../../../components/form/ProcessingActivityEnumOptions"; import { - ConnectionHandler, - graphql, - usePaginationFragment, - usePreloadedQuery, - useMutation, - type PreloadedQuery, + ConnectionHandler, + graphql, + usePaginationFragment, + usePreloadedQuery, + useMutation, + type PreloadedQuery, } from "react-relay"; import { useOrganizationId } from "/hooks/useOrganizationId"; import { useParams } from "react-router"; import { CreateProcessingActivityDialog } from "./dialogs/CreateProcessingActivityDialog"; import { - deleteProcessingActivityMutation, - ProcessingActivitiesConnectionKey, - processingActivitiesQuery, + deleteProcessingActivityMutation, + ProcessingActivitiesConnectionKey, + processingActivitiesQuery, } from "../../../hooks/graph/ProcessingActivityGraph"; import { - sprintf, - promisifyMutation, - downloadFile, - toDateInput, + sprintf, + promisifyMutation, + downloadFile, + toDateInput, } from "@probo/helpers"; import { useMutationWithToasts } from "/hooks/useMutationWithToasts"; import { SnapshotBanner } from "/components/SnapshotBanner"; import type { NodeOf } from "/types"; import type { - ProcessingActivitiesPageFragment$key, - ProcessingActivitiesPageFragment$data, + ProcessingActivitiesPageFragment$key, + ProcessingActivitiesPageFragment$data, } from "/__generated__/core/ProcessingActivitiesPageFragment.graphql"; import type { - ProcessingActivitiesPageDPIAFragment$key, - ProcessingActivitiesPageDPIAFragment$data, + ProcessingActivitiesPageDPIAFragment$key, + ProcessingActivitiesPageDPIAFragment$data, } from "/__generated__/core/ProcessingActivitiesPageDPIAFragment.graphql"; import type { - ProcessingActivitiesPageTIAFragment$key, - ProcessingActivitiesPageTIAFragment$data, + ProcessingActivitiesPageTIAFragment$key, + ProcessingActivitiesPageTIAFragment$data, } from "/__generated__/core/ProcessingActivitiesPageTIAFragment.graphql"; import { useState } from "react"; import type { ProcessingActivityGraphListQuery } from "/__generated__/core/ProcessingActivityGraphListQuery.graphql"; interface ProcessingActivitiesPageProps { - queryRef: PreloadedQuery; + queryRef: PreloadedQuery; } const processingActivitiesPageFragment = graphql` - fragment ProcessingActivitiesPageFragment on Organization - @refetchable(queryName: "ProcessingActivitiesPageRefetchQuery") - @argumentDefinitions( - first: { type: "Int", defaultValue: 10 } - after: { type: "CursorKey" } - snapshotId: { type: "ID", defaultValue: null } - ) { - id - processingActivities( - first: $first - after: $after - filter: { snapshotId: $snapshotId } - ) - @connection( - key: "ProcessingActivitiesPage_processingActivities" - filters: ["filter"] - ) { - __id - totalCount - edges { - node { - id - snapshotId - sourceId - name - purpose - dataSubjectCategory - personalDataCategory - lawfulBasis - location - internationalTransfers - createdAt - updatedAt - canUpdate: permission(action: "core:processing-activity:update") - canDelete: permission(action: "core:processing-activity:delete") + fragment ProcessingActivitiesPageFragment on Organization + @refetchable(queryName: "ProcessingActivitiesPageRefetchQuery") + @argumentDefinitions( + first: { type: "Int", defaultValue: 10 } + after: { type: "CursorKey" } + snapshotId: { type: "ID", defaultValue: null } + ) { + id + processingActivities( + first: $first + after: $after + filter: { snapshotId: $snapshotId } + ) + @connection( + key: "ProcessingActivitiesPage_processingActivities" + filters: ["filter"] + ) { + __id + totalCount + edges { + node { + id + snapshotId + sourceId + name + purpose + dataSubjectCategory + personalDataCategory + lawfulBasis + location + internationalTransfers + createdAt + updatedAt + canUpdate: permission( + action: "core:processing-activity:update" + ) + canDelete: permission( + action: "core:processing-activity:delete" + ) + } + } + pageInfo { + hasNextPage + endCursor + } } - } - pageInfo { - hasNextPage - endCursor - } } - } `; const dpiaListPageFragment = graphql` - fragment ProcessingActivitiesPageDPIAFragment on Organization - @refetchable(queryName: "ProcessingActivitiesPageDPIARefetchQuery") - @argumentDefinitions( - first: { type: "Int", defaultValue: 10 } - after: { type: "CursorKey" } - snapshotId: { type: "ID", defaultValue: null } - ) { - id - dataProtectionImpactAssessments( - first: $first - after: $after - filter: { snapshotId: $snapshotId } - ) - @connection( - key: "ProcessingActivitiesPage_dataProtectionImpactAssessments" - filters: ["filter"] - ) { - __id - totalCount - edges { - node { - id - description - potentialRisk - residualRisk - processingActivity { - id - name - } - createdAt - updatedAt + fragment ProcessingActivitiesPageDPIAFragment on Organization + @refetchable(queryName: "ProcessingActivitiesPageDPIARefetchQuery") + @argumentDefinitions( + first: { type: "Int", defaultValue: 10 } + after: { type: "CursorKey" } + snapshotId: { type: "ID", defaultValue: null } + ) { + id + dataProtectionImpactAssessments( + first: $first + after: $after + filter: { snapshotId: $snapshotId } + ) + @connection( + key: "ProcessingActivitiesPage_dataProtectionImpactAssessments" + filters: ["filter"] + ) { + __id + totalCount + edges { + node { + id + description + potentialRisk + residualRisk + processingActivity { + id + name + } + createdAt + updatedAt + } + } + pageInfo { + hasNextPage + endCursor + } } - } - pageInfo { - hasNextPage - endCursor - } } - } `; const tiaListPageFragment = graphql` - fragment ProcessingActivitiesPageTIAFragment on Organization - @refetchable(queryName: "ProcessingActivitiesPageTIARefetchQuery") - @argumentDefinitions( - first: { type: "Int", defaultValue: 10 } - after: { type: "CursorKey" } - snapshotId: { type: "ID", defaultValue: null } - ) { - id - transferImpactAssessments( - first: $first - after: $after - filter: { snapshotId: $snapshotId } - ) - @connection( - key: "ProcessingActivitiesPage_transferImpactAssessments" - filters: ["filter"] - ) { - __id - totalCount - edges { - node { - id - dataSubjects - transfer - localLawRisk - processingActivity { - id - name - } - createdAt - updatedAt + fragment ProcessingActivitiesPageTIAFragment on Organization + @refetchable(queryName: "ProcessingActivitiesPageTIARefetchQuery") + @argumentDefinitions( + first: { type: "Int", defaultValue: 10 } + after: { type: "CursorKey" } + snapshotId: { type: "ID", defaultValue: null } + ) { + id + transferImpactAssessments( + first: $first + after: $after + filter: { snapshotId: $snapshotId } + ) + @connection( + key: "ProcessingActivitiesPage_transferImpactAssessments" + filters: ["filter"] + ) { + __id + totalCount + edges { + node { + id + dataSubjects + transfer + localLawRisk + processingActivity { + id + name + } + createdAt + updatedAt + } + } + pageInfo { + hasNextPage + endCursor + } } - } - pageInfo { - hasNextPage - endCursor - } } - } `; const exportProcessingActivitiesPDFMutation = graphql` - mutation ProcessingActivitiesPageExportPDFMutation( - $input: ExportProcessingActivitiesPDFInput! - ) { - exportProcessingActivitiesPDF(input: $input) { - data + mutation ProcessingActivitiesPageExportPDFMutation( + $input: ExportProcessingActivitiesPDFInput! + ) { + exportProcessingActivitiesPDF(input: $input) { + data + } } - } `; const exportDataProtectionImpactAssessmentsPDFMutation = graphql` - mutation ProcessingActivitiesPageExportDPIAPDFMutation( - $input: ExportDataProtectionImpactAssessmentsPDFInput! - ) { - exportDataProtectionImpactAssessmentsPDF(input: $input) { - data + mutation ProcessingActivitiesPageExportDPIAPDFMutation( + $input: ExportDataProtectionImpactAssessmentsPDFInput! + ) { + exportDataProtectionImpactAssessmentsPDF(input: $input) { + data + } } - } `; const exportTransferImpactAssessmentsPDFMutation = graphql` - mutation ProcessingActivitiesPageExportTIAPDFMutation( - $input: ExportTransferImpactAssessmentsPDFInput! - ) { - exportTransferImpactAssessmentsPDF(input: $input) { - data + mutation ProcessingActivitiesPageExportTIAPDFMutation( + $input: ExportTransferImpactAssessmentsPDFInput! + ) { + exportTransferImpactAssessmentsPDF(input: $input) { + data + } } - } `; export default function ProcessingActivitiesPage({ - queryRef, + queryRef, }: ProcessingActivitiesPageProps) { - const { __ } = useTranslate(); - const organizationId = useOrganizationId(); - const { snapshotId } = useParams<{ snapshotId?: string }>(); - const isSnapshotMode = Boolean(snapshotId); - const [activeTab, setActiveTab] = useState<"activities" | "dpia" | "tia">( - "activities", - ); + const { __ } = useTranslate(); + const organizationId = useOrganizationId(); + const { snapshotId } = useParams<{ snapshotId?: string }>(); + const isSnapshotMode = Boolean(snapshotId); + const [activeTab, setActiveTab] = useState<"activities" | "dpia" | "tia">( + "activities", + ); - usePageTitle(__("Processing Activities")); + usePageTitle(__("Processing Activities")); - const organization = usePreloadedQuery(processingActivitiesQuery, queryRef); + const organization = usePreloadedQuery(processingActivitiesQuery, queryRef); - const { - data: activitiesData, - loadNext: loadNextActivities, - hasNext: hasNextActivities, - isLoadingNext: isLoadingNextActivities, - } = usePaginationFragment< - ProcessingActivityGraphListQuery, - ProcessingActivitiesPageFragment$key - >(processingActivitiesPageFragment, organization.node); + const { + data: activitiesData, + loadNext: loadNextActivities, + hasNext: hasNextActivities, + isLoadingNext: isLoadingNextActivities, + } = usePaginationFragment< + ProcessingActivityGraphListQuery, + ProcessingActivitiesPageFragment$key + >(processingActivitiesPageFragment, organization.node); - const { - data: dpiaData, - loadNext: loadNextDPIAs, - hasNext: hasNextDPIAs, - isLoadingNext: isLoadingNextDPIAs, - } = usePaginationFragment< - ProcessingActivityGraphListQuery, - ProcessingActivitiesPageDPIAFragment$key - >(dpiaListPageFragment, organization.node); + const { + data: dpiaData, + loadNext: loadNextDPIAs, + hasNext: hasNextDPIAs, + isLoadingNext: isLoadingNextDPIAs, + } = usePaginationFragment< + ProcessingActivityGraphListQuery, + ProcessingActivitiesPageDPIAFragment$key + >(dpiaListPageFragment, organization.node); - const { - data: tiaData, - loadNext: loadNextTIAs, - hasNext: hasNextTIAs, - isLoadingNext: isLoadingNextTIAs, - } = usePaginationFragment< - ProcessingActivityGraphListQuery, - ProcessingActivitiesPageTIAFragment$key - >(tiaListPageFragment, organization.node); + const { + data: tiaData, + loadNext: loadNextTIAs, + hasNext: hasNextTIAs, + isLoadingNext: isLoadingNextTIAs, + } = usePaginationFragment< + ProcessingActivityGraphListQuery, + ProcessingActivitiesPageTIAFragment$key + >(tiaListPageFragment, organization.node); - const connectionId = ConnectionHandler.getConnectionID( - organizationId, - ProcessingActivitiesConnectionKey, - { filter: { snapshotId: snapshotId || null } }, - ); - const activities = - activitiesData?.processingActivities?.edges?.map((edge) => edge.node) ?? []; - const dpias = - dpiaData?.dataProtectionImpactAssessments?.edges?.map( - (edge) => edge.node, - ) ?? []; - const tias = - tiaData?.transferImpactAssessments?.edges?.map((edge) => edge.node) ?? []; + const connectionId = ConnectionHandler.getConnectionID( + organizationId, + ProcessingActivitiesConnectionKey, + { filter: { snapshotId: snapshotId || null } }, + ); + const activities = + activitiesData?.processingActivities?.edges?.map((edge) => edge.node) ?? + []; + const dpias = + dpiaData?.dataProtectionImpactAssessments?.edges?.map( + (edge) => edge.node, + ) ?? []; + const tias = + tiaData?.transferImpactAssessments?.edges?.map((edge) => edge.node) ?? + []; - const hasAnyAction = - !isSnapshotMode && - activities.some(({ canUpdate, canDelete }) => canUpdate || canDelete); + const hasAnyAction = + !isSnapshotMode && + activities.some(({ canUpdate, canDelete }) => canUpdate || canDelete); - const canExportPDF = isAuthorized( - "ProcessingActivity", - "exportProcessingActivitiesPDF", - ); - const [exportPDF, isExportingPDF] = useMutationWithToasts<{ - response: { - exportProcessingActivitiesPDF?: { - data: string; - }; - }; - variables: { - input: { - organizationId: string; - filter: { snapshotId: string } | null; - }; - }; - }>(exportProcessingActivitiesPDFMutation, { - successMessage: __("PDF download started."), - errorMessage: __("Failed to generate PDF"), - }); + const canExportPDF = organization.node.canExportProcessingActivities; - const handleExportPDF = () => { - exportPDF({ - variables: { - input: { - organizationId: organizationId, - filter: snapshotId ? { snapshotId } : null, - }, - }, - onCompleted: (data) => { - if (data.exportProcessingActivitiesPDF?.data) { - downloadFile( - data.exportProcessingActivitiesPDF.data, - `processing-activities-${toDateInput(new Date().toISOString())}.pdf`, - ); - } - }, + const [exportPDF, isExportingPDF] = useMutationWithToasts<{ + response: { + exportProcessingActivitiesPDF?: { + data: string; + }; + }; + variables: { + input: { + organizationId: string; + filter: { snapshotId: string } | null; + }; + }; + }>(exportProcessingActivitiesPDFMutation, { + successMessage: __("PDF download started."), + errorMessage: __("Failed to generate PDF"), }); - }; - const canExportDPIAPDF = isAuthorized( - "Organization", - "exportDataProtectionImpactAssessmentsPDF", - ); - const [exportDPIAPDF, isExportingDPIAPDF] = useMutationWithToasts<{ - response: { - exportDataProtectionImpactAssessmentsPDF?: { - data: string; - }; + const handleExportPDF = () => { + exportPDF({ + variables: { + input: { + organizationId: organizationId, + filter: snapshotId ? { snapshotId } : null, + }, + }, + onCompleted: (data) => { + if (data.exportProcessingActivitiesPDF?.data) { + downloadFile( + data.exportProcessingActivitiesPDF.data, + `processing-activities-${toDateInput(new Date().toISOString())}.pdf`, + ); + } + }, + }); }; - variables: { - input: { - organizationId: string; - filter: { snapshotId: string } | null; - }; - }; - }>(exportDataProtectionImpactAssessmentsPDFMutation, { - successMessage: __("PDF download started."), - errorMessage: __("Failed to generate PDF"), - }); - const handleExportDPIAPDF = () => { - exportDPIAPDF({ - variables: { - input: { - organizationId: organizationId, - filter: snapshotId ? { snapshotId } : null, - }, - }, - onCompleted: (data) => { - if (data.exportDataProtectionImpactAssessmentsPDF?.data) { - downloadFile( - data.exportDataProtectionImpactAssessmentsPDF.data, - `data-protection-impact-assessments-${toDateInput(new Date().toISOString())}.pdf`, - ); - } - }, + const canExportDPIAPDF = + organization.node.canExportDataProtectionImpactAssessments; + + const [exportDPIAPDF, isExportingDPIAPDF] = useMutationWithToasts<{ + response: { + exportDataProtectionImpactAssessmentsPDF?: { + data: string; + }; + }; + variables: { + input: { + organizationId: string; + filter: { snapshotId: string } | null; + }; + }; + }>(exportDataProtectionImpactAssessmentsPDFMutation, { + successMessage: __("PDF download started."), + errorMessage: __("Failed to generate PDF"), }); - }; - const canExportTIAPDF = isAuthorized( - "Organization", - "exportTransferImpactAssessmentsPDF", - ); - const [exportTIAPDF, isExportingTIAPDF] = useMutationWithToasts<{ - response: { - exportTransferImpactAssessmentsPDF?: { - data: string; - }; + const handleExportDPIAPDF = () => { + exportDPIAPDF({ + variables: { + input: { + organizationId: organizationId, + filter: snapshotId ? { snapshotId } : null, + }, + }, + onCompleted: (data) => { + if (data.exportDataProtectionImpactAssessmentsPDF?.data) { + downloadFile( + data.exportDataProtectionImpactAssessmentsPDF.data, + `data-protection-impact-assessments-${toDateInput(new Date().toISOString())}.pdf`, + ); + } + }, + }); }; - variables: { - input: { - organizationId: string; - filter: { snapshotId: string } | null; - }; - }; - }>(exportTransferImpactAssessmentsPDFMutation, { - successMessage: __("PDF download started."), - errorMessage: __("Failed to generate PDF"), - }); - const handleExportTIAPDF = () => { - exportTIAPDF({ - variables: { - input: { - organizationId: organizationId, - filter: snapshotId ? { snapshotId } : null, - }, - }, - onCompleted: (data) => { - if (data.exportTransferImpactAssessmentsPDF?.data) { - downloadFile( - data.exportTransferImpactAssessmentsPDF.data, - `transfer-impact-assessments-${toDateInput(new Date().toISOString())}.pdf`, - ); - } - }, + const canExportTIAPDF = + organization.node.canExportTransferImpactAssessments; + + const [exportTIAPDF, isExportingTIAPDF] = useMutationWithToasts<{ + response: { + exportTransferImpactAssessmentsPDF?: { + data: string; + }; + }; + variables: { + input: { + organizationId: string; + filter: { snapshotId: string } | null; + }; + }; + }>(exportTransferImpactAssessmentsPDFMutation, { + successMessage: __("PDF download started."), + errorMessage: __("Failed to generate PDF"), }); - }; - return ( -
- {isSnapshotMode && snapshotId && ( - - )} - - {(canExportPDF || canExportDPIAPDF || canExportTIAPDF) && ( - - {__("Export")} - - } - > - {canExportPDF && ( - - {__("Processing Activities")} - + const handleExportTIAPDF = () => { + exportTIAPDF({ + variables: { + input: { + organizationId: organizationId, + filter: snapshotId ? { snapshotId } : null, + }, + }, + onCompleted: (data) => { + if (data.exportTransferImpactAssessmentsPDF?.data) { + downloadFile( + data.exportTransferImpactAssessmentsPDF.data, + `transfer-impact-assessments-${toDateInput(new Date().toISOString())}.pdf`, + ); + } + }, + }); + }; + + return ( +
+ {isSnapshotMode && snapshotId && ( + )} - {canExportDPIAPDF && ( - - {__("Data Protection Impact Assessments")} - - )} - {canExportTIAPDF && ( - - {__("Transfer Impact Assessments")} - - )} - - )} - {!isSnapshotMode && - activeTab === "activities" && - organization.node.canCreateProcessingActivity && ( - - - - )} - + {(canExportPDF || canExportDPIAPDF || canExportTIAPDF) && ( + + {__("Export")} + + } + > + {canExportPDF && ( + + {__("Processing Activities")} + + )} + {canExportDPIAPDF && ( + + {__("Data Protection Impact Assessments")} + + )} + {canExportTIAPDF && ( + + {__("Transfer Impact Assessments")} + + )} + + )} + {!isSnapshotMode && + activeTab === "activities" && + organization.node.canCreateProcessingActivity && ( + + + + )} + - - setActiveTab("activities")} - > - {__("Processing Activities")} - - setActiveTab("dpia")} - > - {__("Data Protection Impact Assessments")} - - setActiveTab("tia")} - > - {__("Transfer Impact Assessments")} - - + + setActiveTab("activities")} + > + {__("Processing Activities")} + + setActiveTab("dpia")} + > + {__("Data Protection Impact Assessments")} + + setActiveTab("tia")} + > + {__("Transfer Impact Assessments")} + + - {activeTab === "activities" && ( - <> - {activities.length > 0 ? ( - - - - - - - - - - - {hasAnyAction && } - - - - {activities.map((activity) => ( - - ))} - -
{__("Name")}{__("Purpose")}{__("Data Subject")}{__("Lawful Basis")}{__("Location")}{__("International Transfers")}{__("Actions")}
+ {activeTab === "activities" && ( + <> + {activities.length > 0 ? ( + + + + + + + + + + + {hasAnyAction && ( + + )} + + + + {activities.map((activity) => ( + + ))} + +
{__("Name")} + {__("Purpose")} + + {__("Data Subject")} + + {__("Lawful Basis")} + + {__("Location")} + + {__("International Transfers")} + + {__("Actions")} +
- {hasNextActivities && ( -
- -
- )} -
- ) : ( - -
-

- {__("No processing activities yet")} -

-

- {__( - "Create your first processing activity to get started with GDPR compliance.", - )} -

-
-
- )} - - )} + {hasNextActivities && ( +
+ +
+ )} +
+ ) : ( + +
+

+ {__("No processing activities yet")} +

+

+ {__( + "Create your first processing activity to get started with GDPR compliance.", + )} +

+
+
+ )} + + )} - {activeTab === "dpia" && ( - <> - {dpias.length > 0 ? ( - - - - - - - - - - - - {dpias.map((dpia) => ( - - ))} - -
{__("Processing Activity")}{__("Description")}{__("Potential Risk")}{__("Residual Risk")}
+ {activeTab === "dpia" && ( + <> + {dpias.length > 0 ? ( + + + + + + + + + + + + {dpias.map((dpia) => ( + + ))} + +
{__("Processing Activity")}{__("Description")}{__("Potential Risk")}{__("Residual Risk")}
- {hasNextDPIAs && ( -
- -
- )} -
- ) : ( - -
-

- {__("No Data Protection Impact Assessments yet")} -

-

- {__( - "DPIAs are created from within individual processing activities.", - )} -

-
-
- )} - - )} + {hasNextDPIAs && ( +
+ +
+ )} +
+ ) : ( + +
+

+ {__( + "No Data Protection Impact Assessments yet", + )} +

+

+ {__( + "DPIAs are created from within individual processing activities.", + )} +

+
+
+ )} + + )} - {activeTab === "tia" && ( - <> - {tias.length > 0 ? ( - - - - - - - - - - - - {tias.map((tia) => ( - - ))} - -
{__("Processing Activity")}{__("Data Subjects")}{__("Transfer")}{__("Local Law Risk")}
+ {activeTab === "tia" && ( + <> + {tias.length > 0 ? ( + + + + + + + + + + + + {tias.map((tia) => ( + + ))} + +
{__("Processing Activity")}{__("Data Subjects")}{__("Transfer")}{__("Local Law Risk")}
- {hasNextTIAs && ( -
- -
- )} -
- ) : ( - -
-

- {__("No Transfer Impact Assessments yet")} -

-

- {__( - "TIAs are created from within individual processing activities.", - )} -

-
-
- )} - - )} -
- ); + {hasNextTIAs && ( +
+ +
+ )} + + ) : ( + +
+

+ {__("No Transfer Impact Assessments yet")} +

+

+ {__( + "TIAs are created from within individual processing activities.", + )} +

+
+
+ )} + + )} +
+ ); } function ActivityRow({ - activity, - connectionId, - hasAnyAction, + activity, + connectionId, + hasAnyAction, }: { - activity: NodeOf< - NonNullable - >; - connectionId: string; - hasAnyAction: boolean; -}) { - const organizationId = useOrganizationId(); - const { __ } = useTranslate(); - const { snapshotId } = useParams<{ snapshotId?: string }>(); - const isSnapshotMode = Boolean(snapshotId); - const [deleteActivity] = useMutation(deleteProcessingActivityMutation); - const confirm = useConfirm(); - - const handleDelete = () => { - confirm( - () => - promisifyMutation(deleteActivity)({ - variables: { - input: { - processingActivityId: activity.id, - }, - connections: [connectionId], - }, - }), - { - message: sprintf( - __( - "This will permanently delete the processing activity %s. This action cannot be undone.", - ), - activity.name, - ), - }, - ); - }; - - const activityUrl = - isSnapshotMode && snapshotId - ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${activity.id}` - : `/organizations/${organizationId}/processing-activities/${activity.id}`; - - return ( - - - {activity.name} - - - - {activity.purpose || "-"} - - - {activity.dataSubjectCategory || "-"} - {getLawfulBasisLabel(activity.lawfulBasis, __)} - {activity.location || "-"} - - - {activity.internationalTransfers ? __("Yes") : __("No")} - - - {hasAnyAction && ( - - - {activity.canDelete && ( - - {__("Delete")} - + >; + connectionId: string; + hasAnyAction: boolean; +}) { + const organizationId = useOrganizationId(); + const { __ } = useTranslate(); + const { snapshotId } = useParams<{ snapshotId?: string }>(); + const isSnapshotMode = Boolean(snapshotId); + const [deleteActivity] = useMutation(deleteProcessingActivityMutation); + const confirm = useConfirm(); + + const handleDelete = () => { + confirm( + () => + promisifyMutation(deleteActivity)({ + variables: { + input: { + processingActivityId: activity.id, + }, + connections: [connectionId], + }, + }), + { + message: sprintf( + __( + "This will permanently delete the processing activity %s. This action cannot be undone.", + ), + activity.name, + ), + }, + ); + }; + + const activityUrl = + isSnapshotMode && snapshotId + ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${activity.id}` + : `/organizations/${organizationId}/processing-activities/${activity.id}`; + + return ( + + + {activity.name} + + + + {activity.purpose || "-"} + + + {activity.dataSubjectCategory || "-"} + {getLawfulBasisLabel(activity.lawfulBasis, __)} + {activity.location || "-"} + + + {activity.internationalTransfers ? __("Yes") : __("No")} + + + {hasAnyAction && ( + + + {activity.canDelete && ( + + {__("Delete")} + + )} + + )} - - - )} - - ); + + ); } function DPIARow({ - dpia, + dpia, }: { - dpia: NodeOf< - NonNullable< - ProcessingActivitiesPageDPIAFragment$data["dataProtectionImpactAssessments"] - > - >; + dpia: NodeOf< + NonNullable< + ProcessingActivitiesPageDPIAFragment$data["dataProtectionImpactAssessments"] + > + >; }) { - const organizationId = useOrganizationId(); - const { __ } = useTranslate(); - const { snapshotId } = useParams<{ snapshotId?: string }>(); - const isSnapshotMode = Boolean(snapshotId); + const organizationId = useOrganizationId(); + const { __ } = useTranslate(); + const { snapshotId } = useParams<{ snapshotId?: string }>(); + const isSnapshotMode = Boolean(snapshotId); - const activityUrl = - isSnapshotMode && snapshotId - ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${dpia.processingActivity.id}#dpia` - : `/organizations/${organizationId}/processing-activities/${dpia.processingActivity.id}#dpia`; + const activityUrl = + isSnapshotMode && snapshotId + ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${dpia.processingActivity.id}#dpia` + : `/organizations/${organizationId}/processing-activities/${dpia.processingActivity.id}#dpia`; - return ( - - - {dpia.processingActivity.name} - - - - {dpia.description || "-"} - - - - - {dpia.potentialRisk || "-"} - - - - {dpia.residualRisk ? ( - - {getResidualRiskLabel(dpia.residualRisk, __)} - - ) : ( - "-" - )} - - - ); + return ( + + + + {dpia.processingActivity.name} + + + + + {dpia.description || "-"} + + + + + {dpia.potentialRisk || "-"} + + + + {dpia.residualRisk ? ( + + {getResidualRiskLabel(dpia.residualRisk, __)} + + ) : ( + "-" + )} + + + ); } function TIARow({ - tia, + tia, }: { - tia: NodeOf< - NonNullable< - ProcessingActivitiesPageTIAFragment$data["transferImpactAssessments"] - > - >; + tia: NodeOf< + NonNullable< + ProcessingActivitiesPageTIAFragment$data["transferImpactAssessments"] + > + >; }) { - const organizationId = useOrganizationId(); - const { snapshotId } = useParams<{ snapshotId?: string }>(); - const isSnapshotMode = Boolean(snapshotId); + const organizationId = useOrganizationId(); + const { snapshotId } = useParams<{ snapshotId?: string }>(); + const isSnapshotMode = Boolean(snapshotId); - const activityUrl = - isSnapshotMode && snapshotId - ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${tia.processingActivity.id}#tia` - : `/organizations/${organizationId}/processing-activities/${tia.processingActivity.id}#tia`; + const activityUrl = + isSnapshotMode && snapshotId + ? `/organizations/${organizationId}/snapshots/${snapshotId}/processing-activities/${tia.processingActivity.id}#tia` + : `/organizations/${organizationId}/processing-activities/${tia.processingActivity.id}#tia`; - return ( - - - {tia.processingActivity.name} - - - - {tia.dataSubjects || "-"} - - - - - {tia.transfer || "-"} - - - - - {tia.localLawRisk || "-"} - - - - ); + return ( + + + + {tia.processingActivity.name} + + + + + {tia.dataSubjects || "-"} + + + + + {tia.transfer || "-"} + + + + + {tia.localLawRisk || "-"} + + + + ); } diff --git a/apps/console/src/pages/organizations/snapshots/SnapshotsPage.tsx b/apps/console/src/pages/organizations/snapshots/SnapshotsPage.tsx index 6e11300e0..9a1a90c54 100644 --- a/apps/console/src/pages/organizations/snapshots/SnapshotsPage.tsx +++ b/apps/console/src/pages/organizations/snapshots/SnapshotsPage.tsx @@ -35,8 +35,6 @@ import type { NodeOf } from "/types"; import SnapshotFormDialog from "./dialog/SnapshotFormDialog"; import { usePageTitle } from "@probo/hooks"; import { useOrganizationId } from "/hooks/useOrganizationId"; -import { PermissionsContext } from "/providers/PermissionsContext"; -import { use } from "react"; type Props = { queryRef: PreloadedQuery; @@ -54,6 +52,7 @@ const snapshotsFragment = graphql` description type createdAt + canDelete: permission(action: "core:snapshot:delete") } } } @@ -73,10 +72,9 @@ export default function SnapshotsPage(props: Props) { ); const connectionId = data.snapshots.__id; const snapshots = data.snapshots.edges.map((edge) => edge.node); - const { isAuthorized } = use(PermissionsContext); usePageTitle(__("Snapshots")); - const hasAnyAction = isAuthorized("Snapshot", "deleteSnapshot"); + const hasAnyAction = snapshots.some(({ canDelete }) => canDelete); return (
@@ -86,7 +84,7 @@ export default function SnapshotsPage(props: Props) { "Snapshots capture point-in-time views of your organization's compliance state. Create snapshots to track progress over time.", )} > - {isAuthorized("Organization", "createSnapshot") && ( + {organization.canCreateSnapshot && (
- +