Get rid of previous permission providers
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -1,161 +0,0 @@
|
||||
/**
|
||||
* @generated SignedSource<<f441167b6ed9402b92fcdf6dbaa77170>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type MainLayoutQuery$variables = {
|
||||
organizationId: string;
|
||||
};
|
||||
export type MainLayoutQuery$data = {
|
||||
readonly organization: {
|
||||
readonly id?: string;
|
||||
readonly logoUrl?: string | null | undefined;
|
||||
readonly name?: string;
|
||||
};
|
||||
readonly viewer: {
|
||||
readonly id: string;
|
||||
};
|
||||
};
|
||||
export type MainLayoutQuery = {
|
||||
response: MainLayoutQuery$data;
|
||||
variables: MainLayoutQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
}
|
||||
],
|
||||
v1 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Viewer",
|
||||
"kind": "LinkedField",
|
||||
"name": "viewer",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "logoUrl",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "MainLayoutQuery",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v3/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "MainLayoutQuery",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v3/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "2ec49ff40720bacec29e7b6b1bf1408b",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "MainLayoutQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query MainLayoutQuery(\n $organizationId: ID!\n) {\n viewer {\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n logoUrl\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "d958a2acbd9d13698b9c2b350b05d5a0";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<22e08aea59fb3427d7770d89a44d6e9e>>
|
||||
* @generated SignedSource<<5eff506b761b5790caf4b18a51cf2a88>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -15,6 +15,7 @@ export type RightsRequestGraphListQuery$variables = {
|
||||
};
|
||||
export type RightsRequestGraphListQuery$data = {
|
||||
readonly node: {
|
||||
readonly canCreateRightsRequest?: boolean;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"RightsRequestsPageFragment">;
|
||||
};
|
||||
};
|
||||
@@ -39,20 +40,33 @@ v1 = [
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": "canCreateRightsRequest",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:create\")"
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = [
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
@@ -77,6 +91,7 @@ return {
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
@@ -107,14 +122,15 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": "RightsRequestConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "rightsRequests",
|
||||
@@ -143,7 +159,7 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -207,7 +223,33 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/)
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:update\")"
|
||||
},
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
@@ -263,7 +305,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"args": (v5/*: any*/),
|
||||
"filters": null,
|
||||
"handle": "connection",
|
||||
"key": "RightsRequestsPage_rightsRequests",
|
||||
@@ -280,16 +322,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "77f124136a2da2eb84fb134e5d10396b",
|
||||
"cacheID": "6bc485c10a9531beeb67aa6ff28a7ddc",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "RightsRequestGraphListQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query RightsRequestGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...RightsRequestsPageFragment\n }\n id\n }\n}\n\nfragment RightsRequestsPageFragment on Organization {\n id\n rightsRequests(first: 10) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
"text": "query RightsRequestGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateRightsRequest: permission(action: \"core:rights-request:create\")\n ...RightsRequestsPageFragment\n }\n id\n }\n}\n\nfragment RightsRequestsPageFragment on Organization {\n id\n rightsRequests(first: 10) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n canDelete: permission(action: \"core:rights-request:delete\")\n canUpdate: permission(action: \"core:rights-request:update\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "6ff83d9e0017a4fb245ad9f13106a439";
|
||||
(node as any).hash = "0ec5bfd82df0184daee8f615b55f9b5b";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<23949230cfdefa0c2a321d4fa38e3ace>>
|
||||
* @generated SignedSource<<a97e020f188d100e7c82076b6d82f1ec>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -17,6 +17,8 @@ export type RightsRequestGraphNodeQuery$variables = {
|
||||
export type RightsRequestGraphNodeQuery$data = {
|
||||
readonly node: {
|
||||
readonly actionTaken?: string | null | undefined;
|
||||
readonly canDelete?: boolean;
|
||||
readonly canUpdate?: boolean;
|
||||
readonly contact?: string | null | undefined;
|
||||
readonly createdAt?: string;
|
||||
readonly dataSubject?: string | null | undefined;
|
||||
@@ -109,6 +111,32 @@ v9 = {
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:update\")"
|
||||
},
|
||||
v11 = {
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:delete\")"
|
||||
},
|
||||
v12 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Organization",
|
||||
@@ -127,14 +155,14 @@ v10 = {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
v13 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = {
|
||||
v14 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
@@ -169,7 +197,9 @@ return {
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"type": "RightsRequest",
|
||||
"abstractKey": null
|
||||
@@ -215,7 +245,9 @@ return {
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v12/*: any*/)
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"type": "RightsRequest",
|
||||
"abstractKey": null
|
||||
@@ -226,16 +258,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "93aa5fb44159c0ae2709c34f493bc69f",
|
||||
"cacheID": "ee78ca5ffa5a944254f733bfefdfbfab",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "RightsRequestGraphNodeQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query RightsRequestGraphNodeQuery(\n $rightsRequestId: ID!\n) {\n node(id: $rightsRequestId) {\n __typename\n ... on RightsRequest {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
|
||||
"text": "query RightsRequestGraphNodeQuery(\n $rightsRequestId: ID!\n) {\n node(id: $rightsRequestId) {\n __typename\n ... on RightsRequest {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n canUpdate: permission(action: \"core:rights-request:update\")\n canDelete: permission(action: \"core:rights-request:delete\")\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9f7d09c59f937a8de6cfbc0354b42d1b";
|
||||
(node as any).hash = "77cc11eb6270df9b753572cf3a14689d";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<10add82cf941c1776c712d87451b6da1>>
|
||||
* @generated SignedSource<<109da5292cbd22b553279fefd5c41c03>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -19,6 +19,8 @@ export type RightsRequestsPageFragment$data = {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly actionTaken: string | null | undefined;
|
||||
readonly canDelete: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
readonly contact: string | null | undefined;
|
||||
readonly createdAt: string;
|
||||
readonly dataSubject: string | null | undefined;
|
||||
@@ -196,6 +198,32 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:update\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -262,6 +290,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "3476c393dc97ae3d730ed5715922e987";
|
||||
(node as any).hash = "cfb8b464e37afac281c1722b9daf1783";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<47e719a83abc9c6cb5f5e1140f70cf70>>
|
||||
* @generated SignedSource<<e8285c8dc81c3789af43fe68e8ef4c98>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -217,6 +217,32 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:rights-request:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:rights-request:update\")"
|
||||
},
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -290,16 +316,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "10c7e9a6f7813d150e34282befd799ff",
|
||||
"cacheID": "a63c4d960c8f375acceeedd2f1b9a188",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "RightsRequestsPageRefetchQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query RightsRequestsPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RightsRequestsPageFragment_2HEEH6\n id\n }\n}\n\nfragment RightsRequestsPageFragment_2HEEH6 on Organization {\n id\n rightsRequests(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
"text": "query RightsRequestsPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...RightsRequestsPageFragment_2HEEH6\n id\n }\n}\n\nfragment RightsRequestsPageFragment_2HEEH6 on Organization {\n id\n rightsRequests(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n requestType\n requestState\n dataSubject\n contact\n details\n deadline\n actionTaken\n createdAt\n updatedAt\n canDelete: permission(action: \"core:rights-request:delete\")\n canUpdate: permission(action: \"core:rights-request:update\")\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "3476c393dc97ae3d730ed5715922e987";
|
||||
(node as any).hash = "cfb8b464e37afac281c1722b9daf1783";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<306449631752d4277aa96b77601e2d8f>>
|
||||
* @generated SignedSource<<d0252e79888e84b37fc216198d60dd5b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -26,6 +26,8 @@ export type StateOfApplicabilityControlsTabFragment$data = {
|
||||
readonly sectionTitle: string;
|
||||
readonly stateOfApplicabilityId: string | null | undefined;
|
||||
}>;
|
||||
readonly canCreateStateOfApplicabilityControlMapping: boolean;
|
||||
readonly canDeleteStateOfApplicabilityControlMapping: boolean;
|
||||
readonly controlsInfo: {
|
||||
readonly totalCount: number;
|
||||
};
|
||||
@@ -88,6 +90,32 @@ const node: ReaderFragment = {
|
||||
],
|
||||
"storageKey": "controls(first:0)"
|
||||
},
|
||||
{
|
||||
"alias": "canCreateStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDeleteStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -195,6 +223,6 @@ const node: ReaderFragment = {
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "e72695289b29d1a4b60e3f7c18ba1165";
|
||||
(node as any).hash = "70183a65cc3c55a9ffddb4c2824bf5a7";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<06d34888ed5b3e0d66f2159e1a916196>>
|
||||
* @generated SignedSource<<e559b5ed1fa680ba3fa253c258d92315>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -120,6 +120,32 @@ return {
|
||||
],
|
||||
"storageKey": "controls(first:0)"
|
||||
},
|
||||
{
|
||||
"alias": "canCreateStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDeleteStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -232,16 +258,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "50874b763d9f2cfc01d097ec9b68ec82",
|
||||
"cacheID": "7faadf001782b3aae9b9af0ce5ffa7a5",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityControlsTabRefetchQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityControlsTabFragment\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n"
|
||||
"text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityControlsTabFragment\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n canCreateStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:create\")\n canDeleteStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:delete\")\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "e72695289b29d1a4b60e3f7c18ba1165";
|
||||
(node as any).hash = "70183a65cc3c55a9ffddb4c2824bf5a7";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<bf2f70e0ed1c6bd3352d100db4cae660>>
|
||||
* @generated SignedSource<<74ef0d7b05d90eaaac07851cfb57409f>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -15,6 +15,8 @@ export type StateOfApplicabilityGraphNodeQuery$variables = {
|
||||
};
|
||||
export type StateOfApplicabilityGraphNodeQuery$data = {
|
||||
readonly node: {
|
||||
readonly canDelete?: boolean;
|
||||
readonly canUpdate?: boolean;
|
||||
readonly createdAt?: string;
|
||||
readonly id?: string;
|
||||
readonly name?: string;
|
||||
@@ -94,6 +96,32 @@ v7 = {
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:update\")"
|
||||
},
|
||||
v9 = {
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:delete\")"
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Organization",
|
||||
@@ -105,7 +133,7 @@ v8 = {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v9 = {
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
@@ -150,6 +178,8 @@ return {
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
@@ -198,6 +228,8 @@ return {
|
||||
(v7/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v11/*: any*/),
|
||||
{
|
||||
"alias": "controlsInfo",
|
||||
"args": [
|
||||
@@ -222,6 +254,32 @@ return {
|
||||
],
|
||||
"storageKey": "controls(first:0)"
|
||||
},
|
||||
{
|
||||
"alias": "canCreateStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:create\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDeleteStateOfApplicabilityControlMapping",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:control-mapping:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:control-mapping:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -328,16 +386,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "2c2c6535c53d2073bd41b39771d1afd9",
|
||||
"cacheID": "dfdfadde088e82025aaa6c9c290f96b6",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityGraphNodeQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityGraphNodeQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n"
|
||||
"text": "query StateOfApplicabilityGraphNodeQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n controlsInfo: controls(first: 0) {\n totalCount\n }\n canCreateStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:create\")\n canDeleteStateOfApplicabilityControlMapping: permission(action: \"core:state-of-applicability:control-mapping:delete\")\n availableControls {\n controlId\n sectionTitle\n name\n frameworkId\n frameworkName\n organizationId\n stateOfApplicabilityId\n applicability\n justification\n bestPractice\n regulatory\n contractual\n riskAssessment\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "88e882f3c0f529cc7224eb19a91191cf";
|
||||
(node as any).hash = "1a1f3480b9c66597d146c48ed1b00bd1";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<c56844aad03997c31a20815ce775fc24>>
|
||||
* @generated SignedSource<<3472918fdff6205597f39a6310f2ee08>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -16,6 +16,7 @@ export type StateOfApplicabilityGraphPaginatedFragment$data = {
|
||||
readonly __id: string;
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly canDelete: boolean;
|
||||
readonly controlsInfo: {
|
||||
readonly totalCount: number;
|
||||
};
|
||||
@@ -191,6 +192,19 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "controlsInfo",
|
||||
"args": [
|
||||
@@ -296,6 +310,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "895fc79e61b95bf83997e3d5bcc7f367";
|
||||
(node as any).hash = "82cf2a5ce701c34a41f8166371dd75c3";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<1c22107bf5691e7764aa30352d99631e>>
|
||||
* @generated SignedSource<<a1b6d40084a5ddfad764dd1f6fa32607>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -15,8 +15,14 @@ export type StateOfApplicabilityGraphPaginatedQuery$variables = {
|
||||
};
|
||||
export type StateOfApplicabilityGraphPaginatedQuery$data = {
|
||||
readonly organization: {
|
||||
readonly id?: string;
|
||||
readonly __typename: "Organization";
|
||||
readonly canCreateStateOfApplicability: boolean;
|
||||
readonly id: string;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"StateOfApplicabilityGraphPaginatedFragment">;
|
||||
} | {
|
||||
// This will never be '%other', but we need some
|
||||
// value in case none of the concrete values match.
|
||||
readonly __typename: "%other";
|
||||
};
|
||||
};
|
||||
export type StateOfApplicabilityGraphPaginatedQuery = {
|
||||
@@ -43,17 +49,30 @@ v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = [
|
||||
v4 = {
|
||||
"alias": "canCreateStateOfApplicability",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:create\")"
|
||||
},
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "filter",
|
||||
@@ -90,10 +109,12 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
@@ -124,14 +145,15 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": "StateOfApplicabilityConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "statesOfApplicability",
|
||||
@@ -153,7 +175,7 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -189,6 +211,19 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "controlsInfo",
|
||||
"args": [
|
||||
@@ -213,7 +248,7 @@ return {
|
||||
],
|
||||
"storageKey": "controls(first:0)"
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
@@ -283,7 +318,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v4/*: any*/),
|
||||
"args": (v5/*: any*/),
|
||||
"filters": [
|
||||
"orderBy",
|
||||
"filter"
|
||||
@@ -303,16 +338,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "c5f5cb61622ba5e4309521002c23a530",
|
||||
"cacheID": "3d53dfeb5366c889e790a88116dd3a4a",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityGraphPaginatedQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...StateOfApplicabilityGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment on Organization {\n statesOfApplicability(first: 50, orderBy: {direction: DESC, field: CREATED_AT}, filter: {snapshotId: null}) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n"
|
||||
"text": "query StateOfApplicabilityGraphPaginatedQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n canCreateStateOfApplicability: permission(action: \"core:state-of-applicability:create\")\n ...StateOfApplicabilityGraphPaginatedFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment on Organization {\n statesOfApplicability(first: 50, orderBy: {direction: DESC, field: CREATED_AT}, filter: {snapshotId: null}) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n controlsInfo: controls(first: 0) {\n totalCount\n }\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 = "e5eb3f251055f7dd34f7af30251226ca";
|
||||
(node as any).hash = "2182e7aea21c8eba8b2cfda1e614b6e5";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<9026caada1e636b7db342b11e6d324c0>>
|
||||
* @generated SignedSource<<8bdd74dfae1b656006a07b2f89fe525d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -270,6 +270,19 @@ return {
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:state-of-applicability:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:state-of-applicability:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": "controlsInfo",
|
||||
"args": [
|
||||
@@ -384,16 +397,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "d3227559321509a2a525848a0e26e20b",
|
||||
"cacheID": "68d8b8bc491e464ea692b6d37952bcbf",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityListQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $filter: StateOfApplicabilityFilter = {snapshotId: null}\n $first: Int = 50\n $last: Int = null\n $order: StateOfApplicabilityOrder = {direction: DESC, field: CREATED_AT}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityGraphPaginatedFragment_4cFWzS\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment_4cFWzS on Organization {\n statesOfApplicability(first: $first, after: $after, last: $last, before: $before, orderBy: $order, filter: $filter) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n controlsInfo: controls(first: 0) {\n totalCount\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n"
|
||||
"text": "query StateOfApplicabilityListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $filter: StateOfApplicabilityFilter = {snapshotId: null}\n $first: Int = 50\n $last: Int = null\n $order: StateOfApplicabilityOrder = {direction: DESC, field: CREATED_AT}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...StateOfApplicabilityGraphPaginatedFragment_4cFWzS\n id\n }\n}\n\nfragment StateOfApplicabilityGraphPaginatedFragment_4cFWzS on Organization {\n statesOfApplicability(first: $first, after: $after, last: $last, before: $before, orderBy: $order, filter: $filter) {\n edges {\n node {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n controlsInfo: controls(first: 0) {\n totalCount\n }\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 = "895fc79e61b95bf83997e3d5bcc7f367";
|
||||
(node as any).hash = "82cf2a5ce701c34a41f8166371dd75c3";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<57b1d454985b710fd8d5ccecfa90f97d>>
|
||||
* @generated SignedSource<<698ad015edeb94e58ec661b6118dca4b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -10,12 +10,21 @@
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type MembershipRole = "ADMIN" | "AUDITOR" | "EMPLOYEE" | "OWNER" | "VIEWER";
|
||||
export type MembershipLayoutQuery$variables = {
|
||||
organizationId: string;
|
||||
};
|
||||
export type MembershipLayoutQuery$data = {
|
||||
readonly organization: {
|
||||
readonly __typename: "Organization";
|
||||
readonly viewerMembership: {
|
||||
readonly role: MembershipRole;
|
||||
};
|
||||
readonly " $fragmentSpreads": FragmentRefs<"MembershipsDropdown_organizationFragment" | "SessionDropdownFragment" | "SidebarFragment">;
|
||||
} | {
|
||||
// This will never be '%other', but we need some
|
||||
// value in case none of the concrete values match.
|
||||
readonly __typename: "%other";
|
||||
};
|
||||
readonly viewer: {
|
||||
readonly pendingInvitations: {
|
||||
@@ -48,10 +57,24 @@ v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "role",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "totalCount",
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
@@ -75,6 +98,7 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
@@ -92,6 +116,22 @@ return {
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "SidebarFragment"
|
||||
},
|
||||
{
|
||||
"kind": "RequiredField",
|
||||
"field": {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Membership",
|
||||
"kind": "LinkedField",
|
||||
"name": "viewerMembership",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
"action": "THROW"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
@@ -129,7 +169,7 @@ return {
|
||||
"selections": [
|
||||
{
|
||||
"kind": "RequiredField",
|
||||
"field": (v2/*: any*/),
|
||||
"field": (v4/*: any*/),
|
||||
"action": "THROW"
|
||||
}
|
||||
],
|
||||
@@ -160,13 +200,7 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
@@ -213,7 +247,7 @@ return {
|
||||
"name": "email",
|
||||
"storageKey": null
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
@@ -232,10 +266,11 @@ return {
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v5/*: any*/),
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -504,7 +539,7 @@ return {
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
@@ -524,27 +559,27 @@ return {
|
||||
"name": "pendingInvitations",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/)
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v5/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "7a430121b08c549781c5340bacd630c9",
|
||||
"cacheID": "f39bc9faafcfb9d3e6482e088a3cae1e",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "MembershipLayoutQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query MembershipLayoutQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...MembershipsDropdown_organizationFragment\n ...SessionDropdownFragment\n ...SidebarFragment\n }\n id\n }\n viewer {\n ...MembershipsDropdown_viewerFragment\n pendingInvitations {\n totalCount\n }\n id\n }\n}\n\nfragment MembershipsDropdown_organizationFragment on Organization {\n name\n}\n\nfragment MembershipsDropdown_viewerFragment on Identity {\n pendingInvitations {\n totalCount\n }\n}\n\nfragment SessionDropdownFragment on Organization {\n canDelete: permission(action: \"iam:organization:delete\")\n viewerMembership {\n identity {\n email\n id\n }\n profile {\n fullName\n id\n }\n id\n }\n}\n\nfragment SidebarFragment on Organization {\n canListMeetings: permission(action: \"core:meeting:list\")\n canListTasks: permission(action: \"core:task:list\")\n canListMeasures: permission(action: \"core:measures:list\")\n canListRisks: permission(action: \"core:risk:list\")\n canListFrameworks: permission(action: \"core:frameworks:list\")\n canListPeople: permission(action: \"core:people:list\")\n canListVendors: permission(action: \"core:vendor:list\")\n canListDocuments: permission(action: \"core:document:list\")\n canListAssets: permission(action: \"core:asset:list\")\n canListData: permission(action: \"core:datum:list\")\n canListAudits: permission(action: \"core:audit:list\")\n canListNonconformities: permission(action: \"core:nonconformity:list\")\n canListObligations: permission(action: \"core:obligation:list\")\n canListContinualImprovements: permission(action: \"core:continual-improvement:list\")\n canListProcessingActivities: permission(action: \"core:processing-activity:list\")\n canListRightsRequests: permission(action: \"core:rights-request:list\")\n canListSnapshots: permission(action: \"core:snapshot:list\")\n canGetTrustCenter: permission(action: \"core:trust-center:get\")\n canUpdateOrganization: permission(action: \"iam:organization:update\")\n canListStatesOfApplicability: permission(action: \"core:state-of-applicability:list\")\n}\n"
|
||||
"text": "query MembershipLayoutQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...MembershipsDropdown_organizationFragment\n ...SessionDropdownFragment\n ...SidebarFragment\n viewerMembership {\n role\n id\n }\n }\n id\n }\n viewer {\n ...MembershipsDropdown_viewerFragment\n pendingInvitations {\n totalCount\n }\n id\n }\n}\n\nfragment MembershipsDropdown_organizationFragment on Organization {\n name\n}\n\nfragment MembershipsDropdown_viewerFragment on Identity {\n pendingInvitations {\n totalCount\n }\n}\n\nfragment SessionDropdownFragment on Organization {\n canDelete: permission(action: \"iam:organization:delete\")\n viewerMembership {\n identity {\n email\n id\n }\n profile {\n fullName\n id\n }\n id\n }\n}\n\nfragment SidebarFragment on Organization {\n canListMeetings: permission(action: \"core:meeting:list\")\n canListTasks: permission(action: \"core:task:list\")\n canListMeasures: permission(action: \"core:measures:list\")\n canListRisks: permission(action: \"core:risk:list\")\n canListFrameworks: permission(action: \"core:frameworks:list\")\n canListPeople: permission(action: \"core:people:list\")\n canListVendors: permission(action: \"core:vendor:list\")\n canListDocuments: permission(action: \"core:document:list\")\n canListAssets: permission(action: \"core:asset:list\")\n canListData: permission(action: \"core:datum:list\")\n canListAudits: permission(action: \"core:audit:list\")\n canListNonconformities: permission(action: \"core:nonconformity:list\")\n canListObligations: permission(action: \"core:obligation:list\")\n canListContinualImprovements: permission(action: \"core:continual-improvement:list\")\n canListProcessingActivities: permission(action: \"core:processing-activity:list\")\n canListRightsRequests: permission(action: \"core:rights-request:list\")\n canListSnapshots: permission(action: \"core:snapshot:list\")\n canGetTrustCenter: permission(action: \"core:trust-center:get\")\n canUpdateOrganization: permission(action: \"iam:organization:update\")\n canListStatesOfApplicability: permission(action: \"core:state-of-applicability:list\")\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9a87ccbe2aa86cca7845e0145b133921";
|
||||
(node as any).hash = "6e16255ebbb75840ce8ec057a453bbf0";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -11,6 +11,7 @@ export const rightsRequestsQuery = graphql`
|
||||
query RightsRequestGraphListQuery($organizationId: ID!) {
|
||||
node(id: $organizationId) {
|
||||
... on Organization {
|
||||
canCreateRightsRequest: permission(action: "core:rights-request:create")
|
||||
...RightsRequestsPageFragment
|
||||
}
|
||||
}
|
||||
@@ -29,6 +30,8 @@ export const rightsRequestNodeQuery = graphql`
|
||||
details
|
||||
deadline
|
||||
actionTaken
|
||||
canUpdate: permission(action: "core:rights-request:update")
|
||||
canDelete: permission(action: "core:rights-request:delete")
|
||||
organization {
|
||||
id
|
||||
name
|
||||
|
||||
@@ -20,8 +20,10 @@ import { useTranslate } from "@probo/i18n";
|
||||
export const paginatedStateOfApplicabilityQuery = graphql`
|
||||
query StateOfApplicabilityGraphPaginatedQuery($organizationId: ID!) {
|
||||
organization: node(id: $organizationId) {
|
||||
__typename
|
||||
... on Organization {
|
||||
id
|
||||
canCreateStateOfApplicability: permission(action: "core:state-of-applicability:create")
|
||||
...StateOfApplicabilityGraphPaginatedFragment
|
||||
}
|
||||
}
|
||||
@@ -59,6 +61,9 @@ export const paginatedStateOfApplicabilityFragment = graphql`
|
||||
snapshotId
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
canDelete: permission(action: "core:state-of-applicability:delete")
|
||||
|
||||
controlsInfo: controls(first: 0) {
|
||||
totalCount
|
||||
}
|
||||
@@ -197,6 +202,8 @@ export const stateOfApplicabilityNodeQuery = graphql`
|
||||
snapshotId
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "core:state-of-applicability:update")
|
||||
canDelete: permission(action: "core:state-of-applicability:delete")
|
||||
organization {
|
||||
id
|
||||
}
|
||||
|
||||
@@ -1,556 +0,0 @@
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Button,
|
||||
Dropdown,
|
||||
DropdownItem,
|
||||
DropdownSeparator,
|
||||
IconArrowBoxLeft,
|
||||
IconBank,
|
||||
IconBook,
|
||||
IconBox,
|
||||
IconCalendar2,
|
||||
IconCheckmark1,
|
||||
IconChevronGrabberVertical,
|
||||
IconCircleProgress,
|
||||
IconCircleQuestionmark,
|
||||
IconClock,
|
||||
IconCrossLargeX,
|
||||
IconFire3,
|
||||
IconGroup1,
|
||||
IconInboxEmpty,
|
||||
IconKey,
|
||||
IconListStack,
|
||||
IconLock,
|
||||
IconMagnifyingGlass,
|
||||
IconMedal,
|
||||
IconPageTextLine,
|
||||
IconPeopleAdd,
|
||||
IconPlusLarge,
|
||||
IconRotateCw,
|
||||
IconSettingsGear2,
|
||||
IconShield,
|
||||
IconStore,
|
||||
IconTodo,
|
||||
Input,
|
||||
Layout,
|
||||
SidebarItem,
|
||||
Skeleton,
|
||||
UserDropdownItem,
|
||||
UserDropdown as UserDropdownRoot,
|
||||
useToast,
|
||||
} from "@probo/ui";
|
||||
import { Suspense, use, useEffect, useMemo, useState } from "react";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import { useLazyLoadQuery } from "react-relay";
|
||||
import { Link, Navigate, Outlet, useParams } from "react-router";
|
||||
import { graphql } from "relay-runtime";
|
||||
import type { MainLayoutQuery as MainLayoutQueryType } from "/__generated__/core/MainLayoutQuery.graphql";
|
||||
import { PageError } from "/components/PageError";
|
||||
import { PermissionsProvider } from "/providers/PermissionsProvider";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
|
||||
const MainLayoutQuery = graphql`
|
||||
query MainLayoutQuery($organizationId: ID!) {
|
||||
viewer {
|
||||
id
|
||||
}
|
||||
organization: node(id: $organizationId) {
|
||||
... on Organization {
|
||||
id
|
||||
name
|
||||
logoUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* Site layout with a header and a sidebar
|
||||
*/
|
||||
export function MainLayout() {
|
||||
const { organizationId } = useParams();
|
||||
|
||||
const prefix = `/organizations/${organizationId}`;
|
||||
|
||||
if (!organizationId) {
|
||||
return <Navigate to="/" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<Skeleton className="w-full h-screen" />}>
|
||||
<PermissionsProvider>
|
||||
<MainLayoutContent organizationId={organizationId} prefix={prefix} />
|
||||
</PermissionsProvider>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
function MainLayoutContent({
|
||||
organizationId,
|
||||
prefix,
|
||||
}: {
|
||||
organizationId: string;
|
||||
prefix: string;
|
||||
}) {
|
||||
const { __ } = useTranslate();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const data = useLazyLoadQuery<MainLayoutQueryType>(MainLayoutQuery, {
|
||||
organizationId,
|
||||
});
|
||||
|
||||
return (
|
||||
<Layout
|
||||
header={
|
||||
<>
|
||||
<div className="mr-auto">
|
||||
<OrganizationSelector currentOrganization={data.organization} />
|
||||
</div>
|
||||
<Suspense fallback={<Skeleton className="w-32 h-8" />}>
|
||||
<UserDropdown organizationId={organizationId} />
|
||||
</Suspense>
|
||||
</>
|
||||
}
|
||||
sidebar={
|
||||
<ul className="space-y-[2px]">
|
||||
{isAuthorized("Organization", "listMeetings") && (
|
||||
<SidebarItem
|
||||
label={__("Meetings")}
|
||||
icon={IconCalendar2}
|
||||
to={`${prefix}/meetings`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listTasks") && (
|
||||
<SidebarItem
|
||||
label={__("Tasks")}
|
||||
icon={IconInboxEmpty}
|
||||
to={`${prefix}/tasks`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listMeasures") && (
|
||||
<SidebarItem
|
||||
label={__("Measures")}
|
||||
icon={IconTodo}
|
||||
to={`${prefix}/measures`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listRisks") && (
|
||||
<SidebarItem
|
||||
label={__("Risks")}
|
||||
icon={IconFire3}
|
||||
to={`${prefix}/risks`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listFrameworks") && (
|
||||
<SidebarItem
|
||||
label={__("Frameworks")}
|
||||
icon={IconBank}
|
||||
to={`${prefix}/frameworks`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listPeople") && (
|
||||
<SidebarItem
|
||||
label={__("People")}
|
||||
icon={IconGroup1}
|
||||
to={`${prefix}/people`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listVendors") && (
|
||||
<SidebarItem
|
||||
label={__("Vendors")}
|
||||
icon={IconStore}
|
||||
to={`${prefix}/vendors`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listDocuments") && (
|
||||
<SidebarItem
|
||||
label={__("Documents")}
|
||||
icon={IconPageTextLine}
|
||||
to={`${prefix}/documents`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listAssets") && (
|
||||
<SidebarItem
|
||||
label={__("Assets")}
|
||||
icon={IconBox}
|
||||
to={`${prefix}/assets`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listData") && (
|
||||
<SidebarItem
|
||||
label={__("Data")}
|
||||
icon={IconListStack}
|
||||
to={`${prefix}/data`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listAudits") && (
|
||||
<SidebarItem
|
||||
label={__("Audits")}
|
||||
icon={IconMedal}
|
||||
to={`${prefix}/audits`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listNonconformities") && (
|
||||
<SidebarItem
|
||||
label={__("Nonconformities")}
|
||||
icon={IconCrossLargeX}
|
||||
to={`${prefix}/nonconformities`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listObligations") && (
|
||||
<SidebarItem
|
||||
label={__("Obligations")}
|
||||
icon={IconBook}
|
||||
to={`${prefix}/obligations`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listContinualImprovements") && (
|
||||
<SidebarItem
|
||||
label={__("Continual Improvements")}
|
||||
icon={IconRotateCw}
|
||||
to={`${prefix}/continual-improvements`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listProcessingActivities") && (
|
||||
<SidebarItem
|
||||
label={__("Processing Activities")}
|
||||
icon={IconCircleProgress}
|
||||
to={`${prefix}/processing-activities`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listRightsRequests") && (
|
||||
<SidebarItem
|
||||
label={__("Rights Requests")}
|
||||
icon={IconLock}
|
||||
to={`${prefix}/rights-requests`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listSnapshots") && (
|
||||
<SidebarItem
|
||||
label={__("Snapshots")}
|
||||
icon={IconClock}
|
||||
to={`${prefix}/snapshots`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "getTrustCenter") && (
|
||||
<SidebarItem
|
||||
label={__("Trust Center")}
|
||||
icon={IconShield}
|
||||
to={`${prefix}/trust-center`}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listMembers") && (
|
||||
<SidebarItem
|
||||
label={__("Settings")}
|
||||
icon={IconSettingsGear2}
|
||||
to={`${prefix}/settings`}
|
||||
/>
|
||||
)}
|
||||
</ul>
|
||||
}
|
||||
>
|
||||
<ErrorBoundary FallbackComponent={PageError}>
|
||||
<Outlet />
|
||||
</ErrorBoundary>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
function UserDropdown({ organizationId }: { organizationId: string }) {
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
// const user = useLazyLoadQuery<MainLayoutQueryType>(MainLayoutQuery, {
|
||||
// organizationId,
|
||||
// }).viewer.user;
|
||||
const user = {
|
||||
fullName: "",
|
||||
email: "",
|
||||
};
|
||||
|
||||
const handleLogout: React.MouseEventHandler<HTMLAnchorElement> = async (
|
||||
e,
|
||||
) => {
|
||||
e.preventDefault();
|
||||
|
||||
fetch("/connect/logout", {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({}),
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) {
|
||||
const error = await res.json();
|
||||
throw new Error(error.message || __("Failed to login"));
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: e.message as string,
|
||||
variant: "error",
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<UserDropdownRoot fullName={user.fullName} email={user.email}>
|
||||
{isAuthorized("Organization", "deleteOrganization") && (
|
||||
<UserDropdownItem
|
||||
to="/api-keys"
|
||||
icon={IconKey}
|
||||
label={__("API Keys")}
|
||||
/>
|
||||
)}
|
||||
{isAuthorized("Organization", "listSignableDocuments") && (
|
||||
<UserDropdownItem
|
||||
to={`/organizations/${organizationId}/employee`}
|
||||
icon={IconPageTextLine}
|
||||
label={__("My Signatures")}
|
||||
/>
|
||||
)}
|
||||
<UserDropdownItem
|
||||
to="mailto:support@getprobo.com"
|
||||
icon={IconCircleQuestionmark}
|
||||
label={__("Help")}
|
||||
/>
|
||||
<DropdownSeparator />
|
||||
<UserDropdownItem
|
||||
variant="danger"
|
||||
to="/logout"
|
||||
icon={IconArrowBoxLeft}
|
||||
label="Logout"
|
||||
onClick={handleLogout}
|
||||
/>
|
||||
</UserDropdownRoot>
|
||||
);
|
||||
}
|
||||
|
||||
interface Organization {
|
||||
id: string;
|
||||
name: string;
|
||||
logoUrl?: string | null;
|
||||
authenticationMethod: string;
|
||||
authStatus: "authenticated" | "unauthenticated" | "expired";
|
||||
loginUrl: string;
|
||||
}
|
||||
|
||||
interface OrganizationsResponse {
|
||||
organizations: Organization[];
|
||||
}
|
||||
|
||||
interface Invitation {
|
||||
id: string;
|
||||
email: string;
|
||||
fullName: string;
|
||||
role: string;
|
||||
expiresAt: string;
|
||||
acceptedAt?: string | null;
|
||||
createdAt: string;
|
||||
organization: {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface InvitationsResponse {
|
||||
invitations: Invitation[];
|
||||
}
|
||||
|
||||
function OrganizationSelector({
|
||||
currentOrganization,
|
||||
}: {
|
||||
currentOrganization: MainLayoutQueryType["response"]["organization"];
|
||||
}) {
|
||||
const [organizations, setOrganizations] = useState<Organization[]>([]);
|
||||
const [pendingInvitationsCount, setPendingInvitationsCount] = useState(0);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [search, setSearch] = useState("");
|
||||
const { __ } = useTranslate();
|
||||
|
||||
const filteredOrganizations = useMemo(() => {
|
||||
if (!search.trim()) {
|
||||
return organizations;
|
||||
}
|
||||
return organizations.filter((org) =>
|
||||
org.name.toLowerCase().includes(search.toLowerCase()),
|
||||
);
|
||||
}, [organizations, search]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const [orgsResponse, invitationsResponse] = await Promise.all([
|
||||
fetch("/connect/organizations", { credentials: "include" }),
|
||||
fetch("/connect/invitations", { credentials: "include" }),
|
||||
]);
|
||||
|
||||
if (!orgsResponse.ok) {
|
||||
throw new Error("Failed to fetch organizations");
|
||||
}
|
||||
|
||||
if (!invitationsResponse.ok) {
|
||||
throw new Error("Failed to fetch invitations");
|
||||
}
|
||||
|
||||
const orgsData: OrganizationsResponse = await orgsResponse.json();
|
||||
const invitationsData: InvitationsResponse =
|
||||
await invitationsResponse.json();
|
||||
|
||||
const pendingCount = invitationsData.invitations.filter(
|
||||
(inv) => !inv.acceptedAt,
|
||||
).length;
|
||||
|
||||
setOrganizations(orgsData.organizations);
|
||||
setPendingInvitationsCount(pendingCount);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Unknown error");
|
||||
console.error("Failed to fetch data:", err);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, []);
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="flex items-center gap-1">
|
||||
<Button className="-ml-3" variant="tertiary" disabled>
|
||||
{__("Error loading organizations")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-1">
|
||||
<Dropdown
|
||||
toggle={
|
||||
<Button
|
||||
className="-ml-3"
|
||||
variant="tertiary"
|
||||
iconAfter={IconChevronGrabberVertical}
|
||||
disabled={isLoading}
|
||||
>
|
||||
{isLoading ? __("Loading...") : currentOrganization?.name || ""}
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="px-3 py-2">
|
||||
<Input
|
||||
icon={IconMagnifyingGlass}
|
||||
placeholder={__("Search organizations...")}
|
||||
value={search}
|
||||
onValueChange={setSearch}
|
||||
onKeyDown={(e) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<div className="max-h-150 overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-transparent hover:scrollbar-thumb-gray-400">
|
||||
{isLoading ? (
|
||||
<div className="px-3 py-2 text-gray-500">
|
||||
{__("Loading organizations...")}
|
||||
</div>
|
||||
) : filteredOrganizations.length === 0 ? (
|
||||
<div className="px-3 py-2 text-txt-secondary">
|
||||
{__("No organizations found")}
|
||||
</div>
|
||||
) : (
|
||||
filteredOrganizations.map((organization) => {
|
||||
const isAuthenticated =
|
||||
organization.authStatus === "authenticated";
|
||||
const isExpired = organization.authStatus === "expired";
|
||||
const needsAuth = organization.authStatus === "unauthenticated";
|
||||
|
||||
const targetUrl = isAuthenticated
|
||||
? `/organizations/${organization.id}`
|
||||
: organization.loginUrl;
|
||||
|
||||
const isSAMLUrl = targetUrl.includes("/connect/saml/");
|
||||
|
||||
// Use organization endpoint for all logos for consistency
|
||||
const logoUrl = organization.logoUrl;
|
||||
|
||||
return (
|
||||
<DropdownItem asChild key={organization.id}>
|
||||
{isSAMLUrl ? (
|
||||
<a href={targetUrl} className="flex items-center gap-2">
|
||||
<Avatar name={organization.name} src={logoUrl} />
|
||||
<span className="flex-1">{organization.name}</span>
|
||||
{isAuthenticated && (
|
||||
<IconCheckmark1 size={16} className="text-green-600" />
|
||||
)}
|
||||
{isExpired && (
|
||||
<IconClock size={16} className="text-orange-600" />
|
||||
)}
|
||||
{needsAuth && (
|
||||
<IconLock size={16} className="text-gray-400" />
|
||||
)}
|
||||
</a>
|
||||
) : (
|
||||
<Link to={targetUrl} className="flex items-center gap-2">
|
||||
<Avatar name={organization.name} src={logoUrl} />
|
||||
<span className="flex-1">{organization.name}</span>
|
||||
{isAuthenticated && (
|
||||
<IconCheckmark1 size={16} className="text-green-600" />
|
||||
)}
|
||||
{isExpired && (
|
||||
<IconClock size={16} className="text-orange-600" />
|
||||
)}
|
||||
{needsAuth && (
|
||||
<IconLock size={16} className="text-gray-400" />
|
||||
)}
|
||||
</Link>
|
||||
)}
|
||||
</DropdownItem>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
<DropdownSeparator />
|
||||
{pendingInvitationsCount > 0 && (
|
||||
<DropdownItem asChild>
|
||||
<Link to="/">
|
||||
<IconPeopleAdd size={16} />
|
||||
<span className="flex-1">{__("Invitations")}</span>
|
||||
<Badge variant="info" size="sm">
|
||||
{pendingInvitationsCount}
|
||||
</Badge>
|
||||
</Link>
|
||||
</DropdownItem>
|
||||
)}
|
||||
<DropdownItem asChild>
|
||||
<Link to="/organizations/new">
|
||||
<IconPlusLarge size={16} />
|
||||
{__("Add organization")}
|
||||
</Link>
|
||||
</DropdownItem>
|
||||
</Dropdown>
|
||||
{pendingInvitationsCount > 0 && (
|
||||
<Link to="/" className="relative" title={__("Invitations")}>
|
||||
<Button variant="tertiary" icon={IconPeopleAdd} />
|
||||
<Badge
|
||||
variant="info"
|
||||
size="sm"
|
||||
className="absolute -top-1 -right-1 min-w-[20px] h-5 flex items-center justify-center"
|
||||
>
|
||||
{pendingInvitationsCount}
|
||||
</Badge>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -12,10 +12,14 @@ import { CoreRelayProvider } from "/providers/CoreRelayProvider";
|
||||
export const membershipLayoutQuery = graphql`
|
||||
query MembershipLayoutQuery($organizationId: ID!) {
|
||||
organization: node(id: $organizationId) @required(action: THROW) {
|
||||
__typename
|
||||
... on Organization {
|
||||
...MembershipsDropdown_organizationFragment
|
||||
...SessionDropdownFragment
|
||||
...SidebarFragment
|
||||
viewerMembership @required(action: THROW) {
|
||||
role
|
||||
}
|
||||
}
|
||||
}
|
||||
viewer @required(action: THROW) {
|
||||
@@ -38,6 +42,9 @@ export function MembershipLayout(props: {
|
||||
membershipLayoutQuery,
|
||||
queryRef,
|
||||
);
|
||||
if (organization.__typename !== "Organization") {
|
||||
throw new Error("invalid type for organization node");
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout
|
||||
@@ -69,7 +76,7 @@ export function MembershipLayout(props: {
|
||||
sidebar={<Sidebar fKey={organization} />}
|
||||
>
|
||||
<CoreRelayProvider>
|
||||
<Outlet />
|
||||
<Outlet context={organization.viewerMembership.role} />
|
||||
</CoreRelayProvider>
|
||||
</Layout>
|
||||
);
|
||||
|
||||
@@ -1,289 +1,318 @@
|
||||
import {
|
||||
ConnectionHandler,
|
||||
usePreloadedQuery,
|
||||
type PreloadedQuery,
|
||||
ConnectionHandler,
|
||||
usePreloadedQuery,
|
||||
type PreloadedQuery,
|
||||
} from "react-relay";
|
||||
import {
|
||||
rightsRequestNodeQuery,
|
||||
useDeleteRightsRequest,
|
||||
useUpdateRightsRequest,
|
||||
RightsRequestsConnectionKey,
|
||||
rightsRequestNodeQuery,
|
||||
useDeleteRightsRequest,
|
||||
useUpdateRightsRequest,
|
||||
RightsRequestsConnectionKey,
|
||||
} from "../../../hooks/graph/RightsRequestGraph";
|
||||
import {
|
||||
ActionDropdown,
|
||||
Badge,
|
||||
Breadcrumb,
|
||||
Button,
|
||||
DropdownItem,
|
||||
Field,
|
||||
Option,
|
||||
Input,
|
||||
Card,
|
||||
Textarea,
|
||||
useToast,
|
||||
Select,
|
||||
Label,
|
||||
ActionDropdown,
|
||||
Badge,
|
||||
Breadcrumb,
|
||||
Button,
|
||||
DropdownItem,
|
||||
Field,
|
||||
Option,
|
||||
Input,
|
||||
Card,
|
||||
Textarea,
|
||||
useToast,
|
||||
Select,
|
||||
Label,
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||
import { Controller } from "react-hook-form";
|
||||
import {
|
||||
formatError,
|
||||
type GraphQLError,
|
||||
formatDatetime,
|
||||
toDateInput,
|
||||
getRightsRequestTypeLabel,
|
||||
getRightsRequestTypeOptions,
|
||||
getRightsRequestStateVariant,
|
||||
getRightsRequestStateLabel,
|
||||
getRightsRequestStateOptions,
|
||||
formatError,
|
||||
type GraphQLError,
|
||||
formatDatetime,
|
||||
toDateInput,
|
||||
getRightsRequestTypeLabel,
|
||||
getRightsRequestTypeOptions,
|
||||
getRightsRequestStateVariant,
|
||||
getRightsRequestStateLabel,
|
||||
getRightsRequestStateOptions,
|
||||
} from "@probo/helpers";
|
||||
import z from "zod";
|
||||
import type { RightsRequestGraphNodeQuery } from "/__generated__/core/RightsRequestGraphNodeQuery.graphql";
|
||||
import { use } from "react";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
|
||||
const updateRequestSchema = z.object({
|
||||
requestType: z.enum(["ACCESS", "DELETION", "PORTABILITY"]),
|
||||
requestState: z.enum(["TODO", "IN_PROGRESS", "DONE"]),
|
||||
dataSubject: z.string().optional(),
|
||||
contact: z.string().optional(),
|
||||
details: z.string().optional(),
|
||||
deadline: z.string().optional(),
|
||||
actionTaken: z.string().optional(),
|
||||
requestType: z.enum(["ACCESS", "DELETION", "PORTABILITY"]),
|
||||
requestState: z.enum(["TODO", "IN_PROGRESS", "DONE"]),
|
||||
dataSubject: z.string().optional(),
|
||||
contact: z.string().optional(),
|
||||
details: z.string().optional(),
|
||||
deadline: z.string().optional(),
|
||||
actionTaken: z.string().optional(),
|
||||
});
|
||||
|
||||
type Props = {
|
||||
queryRef: PreloadedQuery<RightsRequestGraphNodeQuery>;
|
||||
queryRef: PreloadedQuery<RightsRequestGraphNodeQuery>;
|
||||
};
|
||||
|
||||
export default function RightsRequestDetailsPage(props: Props) {
|
||||
const data = usePreloadedQuery<RightsRequestGraphNodeQuery>(
|
||||
rightsRequestNodeQuery,
|
||||
props.queryRef,
|
||||
);
|
||||
const request = data.node;
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
const organizationId = useOrganizationId();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const data = usePreloadedQuery<RightsRequestGraphNodeQuery>(
|
||||
rightsRequestNodeQuery,
|
||||
props.queryRef,
|
||||
);
|
||||
const request = data.node;
|
||||
const { __ } = useTranslate();
|
||||
const { toast } = useToast();
|
||||
const organizationId = useOrganizationId();
|
||||
|
||||
const updateRequest = useUpdateRightsRequest();
|
||||
const updateRequest = useUpdateRightsRequest();
|
||||
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
RightsRequestsConnectionKey,
|
||||
);
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
RightsRequestsConnectionKey,
|
||||
);
|
||||
|
||||
const deleteRequest = useDeleteRightsRequest(
|
||||
{ id: request.id! },
|
||||
connectionId,
|
||||
);
|
||||
const deleteRequest = useDeleteRightsRequest(
|
||||
{ id: request.id! },
|
||||
connectionId,
|
||||
);
|
||||
|
||||
const { register, handleSubmit, formState, control } = useFormWithSchema(
|
||||
updateRequestSchema,
|
||||
{
|
||||
defaultValues: {
|
||||
requestType: request.requestType || "ACCESS",
|
||||
requestState: request.requestState || "TODO",
|
||||
dataSubject: request.dataSubject || "",
|
||||
contact: request.contact || "",
|
||||
details: request.details || "",
|
||||
deadline: toDateInput(request.deadline),
|
||||
actionTaken: request.actionTaken || "",
|
||||
},
|
||||
},
|
||||
);
|
||||
const { register, handleSubmit, formState, control } = useFormWithSchema(
|
||||
updateRequestSchema,
|
||||
{
|
||||
defaultValues: {
|
||||
requestType: request.requestType || "ACCESS",
|
||||
requestState: request.requestState || "TODO",
|
||||
dataSubject: request.dataSubject || "",
|
||||
contact: request.contact || "",
|
||||
details: request.details || "",
|
||||
deadline: toDateInput(request.deadline),
|
||||
actionTaken: request.actionTaken || "",
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const onSubmit = handleSubmit(async (formData) => {
|
||||
try {
|
||||
await updateRequest({
|
||||
id: request.id!,
|
||||
requestType: formData.requestType,
|
||||
requestState: formData.requestState,
|
||||
dataSubject: formData.dataSubject || undefined,
|
||||
contact: formData.contact || undefined,
|
||||
details: formData.details || undefined,
|
||||
deadline: formatDatetime(formData.deadline) ?? null,
|
||||
actionTaken: formData.actionTaken || undefined,
|
||||
});
|
||||
const onSubmit = handleSubmit(async (formData) => {
|
||||
try {
|
||||
await updateRequest({
|
||||
id: request.id!,
|
||||
requestType: formData.requestType,
|
||||
requestState: formData.requestState,
|
||||
dataSubject: formData.dataSubject || undefined,
|
||||
contact: formData.contact || undefined,
|
||||
details: formData.details || undefined,
|
||||
deadline: formatDatetime(formData.deadline) ?? null,
|
||||
actionTaken: formData.actionTaken || undefined,
|
||||
});
|
||||
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Rights request updated successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: formatError(
|
||||
__("Failed to update rights request"),
|
||||
error as GraphQLError,
|
||||
),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
toast({
|
||||
title: __("Success"),
|
||||
description: __("Rights request updated successfully"),
|
||||
variant: "success",
|
||||
});
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: __("Error"),
|
||||
description: formatError(
|
||||
__("Failed to update rights request"),
|
||||
error as GraphQLError,
|
||||
),
|
||||
variant: "error",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const typeOptions = getRightsRequestTypeOptions(__);
|
||||
const stateOptions = getRightsRequestStateOptions(__);
|
||||
const typeOptions = getRightsRequestTypeOptions(__);
|
||||
const stateOptions = getRightsRequestStateOptions(__);
|
||||
|
||||
const breadcrumbRequestsUrl = `/organizations/${organizationId}/rights-requests`;
|
||||
const breadcrumbRequestsUrl = `/organizations/${organizationId}/rights-requests`;
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{ label: __("Rights Requests"), to: breadcrumbRequestsUrl },
|
||||
{ label: request.dataSubject || request.id! },
|
||||
]}
|
||||
/>
|
||||
{isAuthorized("RightsRequest", "deleteRightsRequest") && (
|
||||
<ActionDropdown>
|
||||
<DropdownItem onClick={deleteRequest} variant="danger">
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
</ActionDropdown>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<div className="p-6">
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<h1 className="text-2xl font-bold">
|
||||
{getRightsRequestTypeLabel(__, request.requestType || "ACCESS")}
|
||||
</h1>
|
||||
<Badge variant="neutral">
|
||||
{getRightsRequestTypeLabel(__, request.requestType || "ACCESS")}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant={getRightsRequestStateVariant(
|
||||
request.requestState || "TODO",
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<Breadcrumb
|
||||
items={[
|
||||
{
|
||||
label: __("Rights Requests"),
|
||||
to: breadcrumbRequestsUrl,
|
||||
},
|
||||
{ label: request.dataSubject || request.id! },
|
||||
]}
|
||||
/>
|
||||
{request.canDelete && (
|
||||
<ActionDropdown>
|
||||
<DropdownItem onClick={deleteRequest} variant="danger">
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
</ActionDropdown>
|
||||
)}
|
||||
>
|
||||
{getRightsRequestStateLabel(__, request.requestState || "TODO")}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form onSubmit={onSubmit} className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Controller
|
||||
control={control}
|
||||
name="requestType"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Request Type")} *</Label>
|
||||
<Select value={field.value} onValueChange={field.onChange}>
|
||||
{typeOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.requestType?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.requestType.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name="requestState"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("State")} *</Label>
|
||||
<Select value={field.value} onValueChange={field.onChange}>
|
||||
{stateOptions.map((option) => (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.requestState?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.requestState.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
label={__("Data Subject")}
|
||||
{...register("dataSubject")}
|
||||
error={formState.errors.dataSubject?.message}
|
||||
/>
|
||||
<Card>
|
||||
<div className="p-6">
|
||||
<div className="mb-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<h1 className="text-2xl font-bold">
|
||||
{getRightsRequestTypeLabel(
|
||||
__,
|
||||
request.requestType || "ACCESS",
|
||||
)}
|
||||
</h1>
|
||||
<Badge variant="neutral">
|
||||
{getRightsRequestTypeLabel(
|
||||
__,
|
||||
request.requestType || "ACCESS",
|
||||
)}
|
||||
</Badge>
|
||||
<Badge
|
||||
variant={getRightsRequestStateVariant(
|
||||
request.requestState || "TODO",
|
||||
)}
|
||||
>
|
||||
{getRightsRequestStateLabel(
|
||||
__,
|
||||
request.requestState || "TODO",
|
||||
)}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
label={__("Contact")}
|
||||
{...register("contact")}
|
||||
error={formState.errors.contact?.message}
|
||||
/>
|
||||
<form onSubmit={onSubmit} className="space-y-4">
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<Controller
|
||||
control={control}
|
||||
name="requestType"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("Request Type")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{typeOptions.map((option) => (
|
||||
<Option
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.requestType
|
||||
?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{
|
||||
formState.errors.requestType
|
||||
.message
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Details")}</Label>
|
||||
<Textarea
|
||||
{...register("details")}
|
||||
placeholder={__("Enter request details")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.details?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.details.message}
|
||||
<Controller
|
||||
control={control}
|
||||
name="requestState"
|
||||
render={({ field }) => (
|
||||
<div>
|
||||
<Label>{__("State")} *</Label>
|
||||
<Select
|
||||
value={field.value}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{stateOptions.map((option) => (
|
||||
<Option
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
>
|
||||
{option.label}
|
||||
</Option>
|
||||
))}
|
||||
</Select>
|
||||
{formState.errors.requestState
|
||||
?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{
|
||||
formState.errors
|
||||
.requestState.message
|
||||
}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
label={__("Data Subject")}
|
||||
{...register("dataSubject")}
|
||||
error={formState.errors.dataSubject?.message}
|
||||
/>
|
||||
|
||||
<Field
|
||||
label={__("Contact")}
|
||||
{...register("contact")}
|
||||
error={formState.errors.contact?.message}
|
||||
/>
|
||||
|
||||
<div>
|
||||
<Label>{__("Details")}</Label>
|
||||
<Textarea
|
||||
{...register("details")}
|
||||
placeholder={__("Enter request details")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.details?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.details.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label>{__("Deadline")}</Label>
|
||||
<Input type="date" {...register("deadline")} />
|
||||
{formState.errors.deadline?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.deadline.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>{__("Action Taken")}</Label>
|
||||
<Textarea
|
||||
{...register("actionTaken")}
|
||||
placeholder={__("Enter action taken")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.actionTaken?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.actionTaken.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end pt-4">
|
||||
{request.canUpdate && (
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting
|
||||
? __("Saving...")
|
||||
: __("Save Changes")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<Label>{__("Deadline")}</Label>
|
||||
<Input type="date" {...register("deadline")} />
|
||||
{formState.errors.deadline?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.deadline.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>{__("Action Taken")}</Label>
|
||||
<Textarea
|
||||
{...register("actionTaken")}
|
||||
placeholder={__("Enter action taken")}
|
||||
rows={3}
|
||||
/>
|
||||
{formState.errors.actionTaken?.message && (
|
||||
<div className="text-red-500 text-sm mt-1">
|
||||
{formState.errors.actionTaken.message}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex justify-end pt-4">
|
||||
{isAuthorized("RightsRequest", "updateRightsRequest") && (
|
||||
<Button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
disabled={formState.isSubmitting}
|
||||
>
|
||||
{formState.isSubmitting
|
||||
? __("Saving...")
|
||||
: __("Save Changes")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
</Card>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,265 +1,278 @@
|
||||
import {
|
||||
Button,
|
||||
IconPlusLarge,
|
||||
PageHeader,
|
||||
Card,
|
||||
Thead,
|
||||
Tbody,
|
||||
Tr,
|
||||
Th,
|
||||
Td,
|
||||
Badge,
|
||||
ActionDropdown,
|
||||
DropdownItem,
|
||||
IconTrashCan,
|
||||
Table,
|
||||
useConfirm,
|
||||
Button,
|
||||
IconPlusLarge,
|
||||
PageHeader,
|
||||
Card,
|
||||
Thead,
|
||||
Tbody,
|
||||
Tr,
|
||||
Th,
|
||||
Td,
|
||||
Badge,
|
||||
ActionDropdown,
|
||||
DropdownItem,
|
||||
IconTrashCan,
|
||||
Table,
|
||||
useConfirm,
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { usePageTitle } from "@probo/hooks";
|
||||
import {
|
||||
ConnectionHandler,
|
||||
graphql,
|
||||
usePaginationFragment,
|
||||
usePreloadedQuery,
|
||||
useMutation,
|
||||
type PreloadedQuery,
|
||||
ConnectionHandler,
|
||||
graphql,
|
||||
usePaginationFragment,
|
||||
usePreloadedQuery,
|
||||
useMutation,
|
||||
type PreloadedQuery,
|
||||
} from "react-relay";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import { CreateRightsRequestDialog } from "./dialogs/CreateRightsRequestDialog";
|
||||
import {
|
||||
deleteRightsRequestMutation,
|
||||
RightsRequestsConnectionKey,
|
||||
rightsRequestsQuery,
|
||||
deleteRightsRequestMutation,
|
||||
RightsRequestsConnectionKey,
|
||||
rightsRequestsQuery,
|
||||
} from "../../../hooks/graph/RightsRequestGraph";
|
||||
import {
|
||||
sprintf,
|
||||
promisifyMutation,
|
||||
formatDate,
|
||||
getRightsRequestTypeLabel,
|
||||
getRightsRequestStateVariant,
|
||||
getRightsRequestStateLabel,
|
||||
sprintf,
|
||||
promisifyMutation,
|
||||
formatDate,
|
||||
getRightsRequestTypeLabel,
|
||||
getRightsRequestStateVariant,
|
||||
getRightsRequestStateLabel,
|
||||
} from "@probo/helpers";
|
||||
import type { NodeOf } from "/types";
|
||||
import type {
|
||||
RightsRequestsPageFragment$key,
|
||||
RightsRequestsPageFragment$data,
|
||||
RightsRequestsPageFragment$key,
|
||||
RightsRequestsPageFragment$data,
|
||||
} from "/__generated__/core/RightsRequestsPageFragment.graphql";
|
||||
import { use } from "react";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
import type { RightsRequestGraphListQuery } from "/__generated__/core/RightsRequestGraphListQuery.graphql";
|
||||
|
||||
interface RightsRequestsPageProps {
|
||||
queryRef: PreloadedQuery<RightsRequestGraphListQuery>;
|
||||
queryRef: PreloadedQuery<RightsRequestGraphListQuery>;
|
||||
}
|
||||
|
||||
const rightsRequestsPageFragment = graphql`
|
||||
fragment RightsRequestsPageFragment on Organization
|
||||
@refetchable(queryName: "RightsRequestsPageRefetchQuery")
|
||||
@argumentDefinitions(
|
||||
first: { type: "Int", defaultValue: 10 }
|
||||
after: { type: "CursorKey" }
|
||||
) {
|
||||
id
|
||||
rightsRequests(first: $first, after: $after)
|
||||
@connection(key: "RightsRequestsPage_rightsRequests") {
|
||||
__id
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
requestType
|
||||
requestState
|
||||
dataSubject
|
||||
contact
|
||||
details
|
||||
deadline
|
||||
actionTaken
|
||||
createdAt
|
||||
updatedAt
|
||||
fragment RightsRequestsPageFragment on Organization
|
||||
@refetchable(queryName: "RightsRequestsPageRefetchQuery")
|
||||
@argumentDefinitions(
|
||||
first: { type: "Int", defaultValue: 10 }
|
||||
after: { type: "CursorKey" }
|
||||
) {
|
||||
id
|
||||
rightsRequests(first: $first, after: $after)
|
||||
@connection(key: "RightsRequestsPage_rightsRequests") {
|
||||
__id
|
||||
totalCount
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
requestType
|
||||
requestState
|
||||
dataSubject
|
||||
contact
|
||||
details
|
||||
deadline
|
||||
actionTaken
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
canDelete: permission(action: "core:rights-request:delete")
|
||||
canUpdate: permission(action: "core:rights-request:update")
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
endCursor
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export default function RightsRequestsPage({
|
||||
queryRef,
|
||||
queryRef,
|
||||
}: RightsRequestsPageProps) {
|
||||
const { __ } = useTranslate();
|
||||
const organizationId = useOrganizationId();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const { __ } = useTranslate();
|
||||
const organizationId = useOrganizationId();
|
||||
|
||||
usePageTitle(__("Rights Requests"));
|
||||
usePageTitle(__("Rights Requests"));
|
||||
|
||||
const organization = usePreloadedQuery(rightsRequestsQuery, queryRef);
|
||||
const organization = usePreloadedQuery<RightsRequestGraphListQuery>(
|
||||
rightsRequestsQuery,
|
||||
queryRef,
|
||||
);
|
||||
|
||||
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment<
|
||||
RightsRequestGraphListQuery,
|
||||
RightsRequestsPageFragment$key
|
||||
>(rightsRequestsPageFragment, organization.node);
|
||||
const { data, loadNext, hasNext, isLoadingNext } = usePaginationFragment<
|
||||
RightsRequestGraphListQuery,
|
||||
RightsRequestsPageFragment$key
|
||||
>(rightsRequestsPageFragment, organization.node);
|
||||
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
RightsRequestsConnectionKey,
|
||||
);
|
||||
const requests = data?.rightsRequests?.edges?.map((edge) => edge.node) ?? [];
|
||||
const connectionId = ConnectionHandler.getConnectionID(
|
||||
organizationId,
|
||||
RightsRequestsConnectionKey,
|
||||
);
|
||||
const requests =
|
||||
data?.rightsRequests?.edges?.map((edge) => edge.node) ?? [];
|
||||
|
||||
const hasAnyAction =
|
||||
isAuthorized("RightsRequest", "updateRightsRequest") ||
|
||||
isAuthorized("RightsRequest", "deleteRightsRequest");
|
||||
const hasAnyAction = requests.some(
|
||||
({ canUpdate, canDelete }) => canUpdate || canDelete,
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<PageHeader
|
||||
title={__("Rights Requests")}
|
||||
description={__("Manage data subject rights requests.")}
|
||||
>
|
||||
{isAuthorized("Organization", "createRightsRequest") && (
|
||||
<CreateRightsRequestDialog
|
||||
organizationId={organizationId}
|
||||
connectionId={connectionId}
|
||||
>
|
||||
<Button icon={IconPlusLarge}>{__("Add rights request")}</Button>
|
||||
</CreateRightsRequestDialog>
|
||||
)}
|
||||
</PageHeader>
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<PageHeader
|
||||
title={__("Rights Requests")}
|
||||
description={__("Manage data subject rights requests.")}
|
||||
>
|
||||
{organization.node.canCreateRightsRequest && (
|
||||
<CreateRightsRequestDialog
|
||||
organizationId={organizationId}
|
||||
connectionId={connectionId}
|
||||
>
|
||||
<Button icon={IconPlusLarge}>
|
||||
{__("Add rights request")}
|
||||
</Button>
|
||||
</CreateRightsRequestDialog>
|
||||
)}
|
||||
</PageHeader>
|
||||
|
||||
{requests.length > 0 ? (
|
||||
<Card>
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{__("Type")}</Th>
|
||||
<Th>{__("State")}</Th>
|
||||
<Th>{__("Data Subject")}</Th>
|
||||
<Th>{__("Contact")}</Th>
|
||||
<Th>{__("Deadline")}</Th>
|
||||
{hasAnyAction && <Th>{__("Actions")}</Th>}
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{requests.map((request) => (
|
||||
<RequestRow
|
||||
key={request.id}
|
||||
request={request}
|
||||
connectionId={connectionId}
|
||||
hasAnyAction={hasAnyAction}
|
||||
/>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
{requests.length > 0 ? (
|
||||
<Card>
|
||||
<Table>
|
||||
<Thead>
|
||||
<Tr>
|
||||
<Th>{__("Type")}</Th>
|
||||
<Th>{__("State")}</Th>
|
||||
<Th>{__("Data Subject")}</Th>
|
||||
<Th>{__("Contact")}</Th>
|
||||
<Th>{__("Deadline")}</Th>
|
||||
{hasAnyAction && <Th>{__("Actions")}</Th>}
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{requests.map((request) => (
|
||||
<RequestRow
|
||||
key={request.id}
|
||||
request={request}
|
||||
connectionId={connectionId}
|
||||
hasAnyAction={hasAnyAction}
|
||||
/>
|
||||
))}
|
||||
</Tbody>
|
||||
</Table>
|
||||
|
||||
{hasNext && (
|
||||
<div className="p-4 border-t">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => loadNext(10)}
|
||||
disabled={isLoadingNext}
|
||||
>
|
||||
{isLoadingNext ? __("Loading...") : __("Load more")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
) : (
|
||||
<Card padded>
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-semibold mb-2">
|
||||
{__("No rights requests yet")}
|
||||
</h3>
|
||||
<p className="text-txt-tertiary mb-4">
|
||||
{__("Create your first rights request to get started.")}
|
||||
</p>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
{hasNext && (
|
||||
<div className="p-4 border-t">
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => loadNext(10)}
|
||||
disabled={isLoadingNext}
|
||||
>
|
||||
{isLoadingNext
|
||||
? __("Loading...")
|
||||
: __("Load more")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</Card>
|
||||
) : (
|
||||
<Card padded>
|
||||
<div className="text-center py-12">
|
||||
<h3 className="text-lg font-semibold mb-2">
|
||||
{__("No rights requests yet")}
|
||||
</h3>
|
||||
<p className="text-txt-tertiary mb-4">
|
||||
{__(
|
||||
"Create your first rights request to get started.",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RequestRow({
|
||||
request,
|
||||
connectionId,
|
||||
hasAnyAction,
|
||||
request,
|
||||
connectionId,
|
||||
hasAnyAction,
|
||||
}: {
|
||||
request: NodeOf<
|
||||
NonNullable<RightsRequestsPageFragment$data["rightsRequests"]>
|
||||
>;
|
||||
connectionId: string;
|
||||
hasAnyAction: boolean;
|
||||
request: NodeOf<
|
||||
NonNullable<RightsRequestsPageFragment$data["rightsRequests"]>
|
||||
>;
|
||||
connectionId: string;
|
||||
hasAnyAction: boolean;
|
||||
}) {
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
const [deleteRequest] = useMutation(deleteRightsRequestMutation);
|
||||
const confirm = useConfirm();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
const [deleteRequest] = useMutation(deleteRightsRequestMutation);
|
||||
const confirm = useConfirm();
|
||||
|
||||
const handleDelete = () => {
|
||||
confirm(
|
||||
() =>
|
||||
promisifyMutation(deleteRequest)({
|
||||
variables: {
|
||||
input: {
|
||||
rightsRequestId: request.id,
|
||||
const handleDelete = () => {
|
||||
confirm(
|
||||
() =>
|
||||
promisifyMutation(deleteRequest)({
|
||||
variables: {
|
||||
input: {
|
||||
rightsRequestId: request.id,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the rights request. This action cannot be undone.",
|
||||
),
|
||||
),
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
}),
|
||||
{
|
||||
message: sprintf(
|
||||
__(
|
||||
"This will permanently delete the rights request. This action cannot be undone.",
|
||||
),
|
||||
),
|
||||
},
|
||||
);
|
||||
};
|
||||
);
|
||||
};
|
||||
|
||||
const detailsUrl = `/organizations/${organizationId}/rights-requests/${request.id}`;
|
||||
const detailsUrl = `/organizations/${organizationId}/rights-requests/${request.id}`;
|
||||
|
||||
return (
|
||||
<Tr to={detailsUrl}>
|
||||
<Td>
|
||||
<Badge variant="neutral">
|
||||
{getRightsRequestTypeLabel(__, request.requestType)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
<Badge variant={getRightsRequestStateVariant(request.requestState)}>
|
||||
{getRightsRequestStateLabel(__, request.requestState)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>{request.dataSubject || "-"}</Td>
|
||||
<Td>{request.contact || "-"}</Td>
|
||||
<Td>
|
||||
{request.deadline ? (
|
||||
<time dateTime={request.deadline}>
|
||||
{formatDate(request.deadline)}
|
||||
</time>
|
||||
) : (
|
||||
<span className="text-txt-tertiary">{__("No deadline")}</span>
|
||||
)}
|
||||
</Td>
|
||||
{hasAnyAction && (
|
||||
<Td noLink width={50} className="text-end">
|
||||
<ActionDropdown>
|
||||
{isAuthorized("RightsRequest", "deleteRightsRequest") && (
|
||||
<DropdownItem
|
||||
icon={IconTrashCan}
|
||||
variant="danger"
|
||||
onSelect={handleDelete}
|
||||
>
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
return (
|
||||
<Tr to={detailsUrl}>
|
||||
<Td>
|
||||
<Badge variant="neutral">
|
||||
{getRightsRequestTypeLabel(__, request.requestType)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>
|
||||
<Badge
|
||||
variant={getRightsRequestStateVariant(request.requestState)}
|
||||
>
|
||||
{getRightsRequestStateLabel(__, request.requestState)}
|
||||
</Badge>
|
||||
</Td>
|
||||
<Td>{request.dataSubject || "-"}</Td>
|
||||
<Td>{request.contact || "-"}</Td>
|
||||
<Td>
|
||||
{request.deadline ? (
|
||||
<time dateTime={request.deadline}>
|
||||
{formatDate(request.deadline)}
|
||||
</time>
|
||||
) : (
|
||||
<span className="text-txt-tertiary">
|
||||
{__("No deadline")}
|
||||
</span>
|
||||
)}
|
||||
</Td>
|
||||
{hasAnyAction && (
|
||||
<Td noLink width={50} className="text-end">
|
||||
<ActionDropdown>
|
||||
{request.canDelete && (
|
||||
<DropdownItem
|
||||
icon={IconTrashCan}
|
||||
variant="danger"
|
||||
onSelect={handleDelete}
|
||||
>
|
||||
{__("Delete")}
|
||||
</DropdownItem>
|
||||
)}
|
||||
</ActionDropdown>
|
||||
</Td>
|
||||
)}
|
||||
</ActionDropdown>
|
||||
</Td>
|
||||
)}
|
||||
</Tr>
|
||||
);
|
||||
</Tr>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,8 +29,7 @@ import {
|
||||
useDeleteStateOfApplicability,
|
||||
updateStateOfApplicabilityMutation,
|
||||
} from "/hooks/graph/StateOfApplicabilityGraph";
|
||||
import { use, useState, Suspense } from "react";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
import { useState, Suspense } from "react";
|
||||
import { usePageTitle } from "@probo/hooks";
|
||||
import { formatDate, validateSnapshotConsistency } from "@probo/helpers";
|
||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||
@@ -67,7 +66,6 @@ export default function StateOfApplicabilityDetailPage(props: Props) {
|
||||
const stateOfApplicability = data.node;
|
||||
const { __ } = useTranslate();
|
||||
const navigate = useNavigate();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const isSnapshotMode = Boolean(snapshotId);
|
||||
|
||||
if (!stateOfApplicabilityId || !stateOfApplicability) {
|
||||
@@ -104,12 +102,8 @@ export default function StateOfApplicabilityDetailPage(props: Props) {
|
||||
},
|
||||
);
|
||||
|
||||
const canUpdate =
|
||||
!isSnapshotMode &&
|
||||
isAuthorized("StateOfApplicability", "updateStateOfApplicability");
|
||||
const canDelete =
|
||||
!isSnapshotMode &&
|
||||
isAuthorized("StateOfApplicability", "deleteStateOfApplicability");
|
||||
const canUpdate = !isSnapshotMode && stateOfApplicability.canUpdate;
|
||||
const canDelete = !isSnapshotMode && stateOfApplicability.canDelete;
|
||||
|
||||
const [exportStateOfApplicabilityPDF, isExporting] =
|
||||
useMutationWithToasts<StateOfApplicabilityDetailPageExportMutation>(
|
||||
|
||||
@@ -15,21 +15,29 @@ import {
|
||||
} from "@probo/ui";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import type { StateOfApplicabilityGraphPaginatedQuery } from "/__generated__/core/StateOfApplicabilityGraphPaginatedQuery.graphql";
|
||||
import { type PreloadedQuery } from "react-relay";
|
||||
import {
|
||||
useStateOfApplicabilityQuery,
|
||||
usePreloadedQuery,
|
||||
type PreloadedQuery,
|
||||
usePaginationFragment,
|
||||
} from "react-relay";
|
||||
import {
|
||||
useDeleteStateOfApplicability,
|
||||
paginatedStateOfApplicabilityFragment,
|
||||
paginatedStateOfApplicabilityQuery,
|
||||
} from "/hooks/graph/StateOfApplicabilityGraph";
|
||||
import type { StateOfApplicabilityGraphPaginatedFragment$data } from "/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql";
|
||||
import type {
|
||||
StateOfApplicabilityGraphPaginatedFragment$data,
|
||||
StateOfApplicabilityGraphPaginatedFragment$key,
|
||||
} from "/__generated__/core/StateOfApplicabilityGraphPaginatedFragment.graphql";
|
||||
import type { NodeOf } from "/types";
|
||||
import { usePageTitle } from "@probo/hooks";
|
||||
import { CreateStateOfApplicabilityDialog } from "./dialogs/CreateStateOfApplicabilityDialog";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
import { use, useEffect } from "react";
|
||||
import { useEffect } from "react";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
import { formatDate } from "@probo/helpers";
|
||||
import { useParams } from "react-router";
|
||||
import { SnapshotBanner } from "/components/SnapshotBanner";
|
||||
import type { StateOfApplicabilityListQuery } from "/__generated__/core/StateOfApplicabilityListQuery.graphql";
|
||||
|
||||
type StateOfApplicability = NodeOf<
|
||||
StateOfApplicabilityGraphPaginatedFragment$data["statesOfApplicability"]
|
||||
@@ -41,20 +49,32 @@ export default function StatesOfApplicabilityPage({
|
||||
queryRef: PreloadedQuery<StateOfApplicabilityGraphPaginatedQuery>;
|
||||
}) {
|
||||
const { __ } = useTranslate();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const { snapshotId } = useParams<{ snapshotId?: string }>();
|
||||
const isSnapshotMode = Boolean(snapshotId);
|
||||
const {
|
||||
statesOfApplicability,
|
||||
connectionId,
|
||||
hasNext,
|
||||
loadNext,
|
||||
isLoadingNext,
|
||||
refetch,
|
||||
} = useStateOfApplicabilityQuery(queryRef);
|
||||
|
||||
usePageTitle(__("States of Applicability"));
|
||||
|
||||
const { organization } =
|
||||
usePreloadedQuery<StateOfApplicabilityGraphPaginatedQuery>(
|
||||
paginatedStateOfApplicabilityQuery,
|
||||
queryRef,
|
||||
);
|
||||
|
||||
if (organization.__typename !== "Organization") {
|
||||
throw new Error("Organization not found");
|
||||
}
|
||||
|
||||
const {
|
||||
data: { statesOfApplicability },
|
||||
loadNext,
|
||||
hasNext,
|
||||
refetch,
|
||||
isLoadingNext,
|
||||
} = usePaginationFragment<
|
||||
StateOfApplicabilityListQuery,
|
||||
StateOfApplicabilityGraphPaginatedFragment$key
|
||||
>(paginatedStateOfApplicabilityFragment, organization);
|
||||
|
||||
// Refetch with snapshot filter when in snapshot mode
|
||||
useEffect(() => {
|
||||
if (snapshotId) {
|
||||
@@ -67,7 +87,9 @@ export default function StatesOfApplicabilityPage({
|
||||
|
||||
const hasAnyAction =
|
||||
!isSnapshotMode &&
|
||||
isAuthorized("StateOfApplicability", "deleteStateOfApplicability");
|
||||
statesOfApplicability.edges
|
||||
.map((edge) => edge.node)
|
||||
.some(({ canDelete }) => canDelete);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
@@ -79,12 +101,9 @@ export default function StatesOfApplicabilityPage({
|
||||
)}
|
||||
>
|
||||
{!isSnapshotMode &&
|
||||
isAuthorized(
|
||||
"Organization",
|
||||
"createStateOfApplicability",
|
||||
) && (
|
||||
organization.canCreateStateOfApplicability && (
|
||||
<CreateStateOfApplicabilityDialog
|
||||
connectionId={connectionId}
|
||||
connectionId={statesOfApplicability.__id}
|
||||
>
|
||||
<Button icon={IconPlusLarge}>
|
||||
{__("Add state of applicability")}
|
||||
@@ -93,7 +112,7 @@ export default function StatesOfApplicabilityPage({
|
||||
)}
|
||||
</PageHeader>
|
||||
|
||||
{statesOfApplicability && statesOfApplicability.length > 0 ? (
|
||||
{statesOfApplicability && statesOfApplicability.edges.length > 0 ? (
|
||||
<Card>
|
||||
<Table>
|
||||
<Thead>
|
||||
@@ -105,11 +124,11 @@ export default function StatesOfApplicabilityPage({
|
||||
</Tr>
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{statesOfApplicability.map((soa) => (
|
||||
{statesOfApplicability.edges.map((edge) => (
|
||||
<StateOfApplicabilityRow
|
||||
key={soa.id}
|
||||
stateOfApplicability={soa}
|
||||
connectionId={connectionId}
|
||||
key={edge.node.id}
|
||||
stateOfApplicability={edge.node}
|
||||
connectionId={statesOfApplicability.__id}
|
||||
hasAnyAction={hasAnyAction}
|
||||
/>
|
||||
))}
|
||||
@@ -164,7 +183,6 @@ function StateOfApplicabilityRow({
|
||||
stateOfApplicability,
|
||||
connectionId,
|
||||
);
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
|
||||
const detailUrl = snapshotId
|
||||
? `/organizations/${organizationId}/snapshots/${snapshotId}/states-of-applicability/${stateOfApplicability.id}`
|
||||
@@ -182,10 +200,7 @@ function StateOfApplicabilityRow({
|
||||
{hasAnyAction && (
|
||||
<Td noLink width={50} className="text-end">
|
||||
<ActionDropdown>
|
||||
{isAuthorized(
|
||||
"StateOfApplicability",
|
||||
"deleteStateOfApplicability",
|
||||
) && (
|
||||
{stateOfApplicability.canDelete && (
|
||||
<DropdownItem
|
||||
icon={IconTrashCan}
|
||||
variant="danger"
|
||||
|
||||
@@ -27,8 +27,6 @@ import {
|
||||
type EditControlDialogRef,
|
||||
} from "../dialogs/EditControlDialog";
|
||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||
import { use } from "react";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
|
||||
export const controlsFragment = graphql`
|
||||
fragment StateOfApplicabilityControlsTabFragment on StateOfApplicability
|
||||
@@ -37,6 +35,14 @@ export const controlsFragment = graphql`
|
||||
controlsInfo: controls(first: 0) {
|
||||
totalCount
|
||||
}
|
||||
|
||||
canCreateStateOfApplicabilityControlMapping: permission(
|
||||
action: "core:state-of-applicability:control-mapping:create"
|
||||
)
|
||||
canDeleteStateOfApplicabilityControlMapping: permission(
|
||||
action: "core:state-of-applicability:control-mapping:delete"
|
||||
)
|
||||
|
||||
availableControls {
|
||||
controlId
|
||||
sectionTitle
|
||||
@@ -84,7 +90,6 @@ export default function StateOfApplicabilityControlsTab({
|
||||
const organizationId = useOrganizationId();
|
||||
const manageDialogRef = useRef<LinkControlDialogRef>(null);
|
||||
const editDialogRef = useRef<EditControlDialogRef>(null);
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
|
||||
const linkedControls = useMemo(
|
||||
() =>
|
||||
@@ -103,11 +108,9 @@ export default function StateOfApplicabilityControlsTab({
|
||||
);
|
||||
|
||||
const canLink =
|
||||
!isSnapshotMode &&
|
||||
isAuthorized("StateOfApplicability", "updateStateOfApplicability");
|
||||
!isSnapshotMode && data.canCreateStateOfApplicabilityControlMapping;
|
||||
const canUnlink =
|
||||
!isSnapshotMode &&
|
||||
isAuthorized("StateOfApplicability", "updateStateOfApplicability");
|
||||
!isSnapshotMode && data.canDeleteStateOfApplicabilityControlMapping;
|
||||
|
||||
const handleOpenManageDialog = () => {
|
||||
manageDialogRef.current?.open(data.id, () => {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
import { createContext } from "react";
|
||||
|
||||
export type PermissionsContextType = Record<string, boolean>;
|
||||
|
||||
export const PermissionsContext = createContext<PermissionsContextType>({});
|
||||
@@ -1,72 +0,0 @@
|
||||
import { useEffect, type PropsWithChildren } from "react";
|
||||
import { PermissionsContext } from "./NewPermissionsContext";
|
||||
import {
|
||||
usePreloadedQuery,
|
||||
useQueryLoader,
|
||||
type PreloadedQuery,
|
||||
} from "react-relay";
|
||||
import type { GraphQLTaggedNode, OperationType } from "relay-runtime";
|
||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||
|
||||
type PermissionsQueryType = OperationType & {
|
||||
response: { viewer: Record<string, boolean> };
|
||||
};
|
||||
|
||||
type PermissionsProviderLoaderProps = PropsWithChildren<{
|
||||
query: GraphQLTaggedNode;
|
||||
}>;
|
||||
|
||||
export function PermissionsProviderLoader<T extends PermissionsQueryType>(
|
||||
props: PermissionsProviderLoaderProps,
|
||||
) {
|
||||
const { children, query } = props;
|
||||
|
||||
const organizationId = useOrganizationId();
|
||||
const [queryRef, loadQuery] = useQueryLoader<T>(query);
|
||||
|
||||
useEffect(() => {
|
||||
loadQuery({
|
||||
organizationId,
|
||||
});
|
||||
}, [loadQuery, organizationId]);
|
||||
|
||||
if (!queryRef) {
|
||||
// While permissions are loading, consider there are no permissions
|
||||
return <PermissionsContext value={{}}>{children}</PermissionsContext>;
|
||||
}
|
||||
|
||||
return (
|
||||
<PermissionsProvider query={query} queryRef={queryRef}>
|
||||
{children}
|
||||
</PermissionsProvider>
|
||||
);
|
||||
}
|
||||
|
||||
type PermissionsProviderProps<T extends PermissionsQueryType> =
|
||||
PermissionsProviderLoaderProps & {
|
||||
queryRef: PreloadedQuery<T>;
|
||||
};
|
||||
|
||||
function PermissionsProvider<T extends PermissionsQueryType>(
|
||||
props: PermissionsProviderProps<T>,
|
||||
) {
|
||||
const { children, query, queryRef } = props;
|
||||
|
||||
const { viewer: permissions } = usePreloadedQuery<T>(query, queryRef);
|
||||
|
||||
const handler = {
|
||||
get(target: Record<string, boolean>, prop: string) {
|
||||
if (!(prop in target)) {
|
||||
throw new Error(`Field ${prop} is not defined in IAM viewer node`);
|
||||
}
|
||||
|
||||
return Reflect.get(target, prop);
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
<PermissionsContext value={new Proxy(permissions, handler)}>
|
||||
{children}
|
||||
</PermissionsContext>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { createContext } from "react";
|
||||
import { Role } from "@probo/helpers";
|
||||
|
||||
export type PermissionsResponse = {
|
||||
permissions: Record<string, Record<string, boolean>>;
|
||||
role: Role;
|
||||
};
|
||||
|
||||
type PermissionsContextType = {
|
||||
isAuthorized: (entity: string, action: string) => boolean;
|
||||
} & PermissionsResponse;
|
||||
|
||||
export const PermissionsContext = createContext<PermissionsContextType>({
|
||||
permissions: {},
|
||||
role: Role.VIEWER,
|
||||
isAuthorized: () => false,
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
import { type PropsWithChildren } from "react";
|
||||
import { PermissionsContext } from "./PermissionsContext";
|
||||
import { Role } from "@probo/helpers";
|
||||
|
||||
export function PermissionsProvider(props: PropsWithChildren) {
|
||||
const { children } = props;
|
||||
|
||||
// const organizationId = useOrganizationId();
|
||||
|
||||
// const { data } = useSuspenseQuery<PermissionsResponse>({
|
||||
// queryKey: ["permissions", organizationId],
|
||||
// queryFn: async () => {
|
||||
// const response = await fetch(`/authz/${organizationId}/permissions`, { credentials: "include" });
|
||||
// if (!response.ok) {
|
||||
// throw new Error("Failed to fetch permissions");
|
||||
// }
|
||||
// return response.json() as Promise<PermissionsResponse>;
|
||||
// },
|
||||
// });
|
||||
|
||||
// @ts-expect-error wip refactor
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const isAuthorized = (entity: string, action: string) => {
|
||||
// return data.permissions[entity]?.[action] ?? false;
|
||||
return true;
|
||||
};
|
||||
|
||||
return (
|
||||
<PermissionsContext
|
||||
value={{ permissions: {}, role: Role.OWNER, isAuthorized }}
|
||||
>
|
||||
{children}
|
||||
</PermissionsContext>
|
||||
);
|
||||
|
||||
// return (
|
||||
// <PermissionsContext value={{ ...data, isAuthorized }}>
|
||||
// {children}
|
||||
// </PermissionsContext>
|
||||
// );
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
createBrowserRouter,
|
||||
Navigate,
|
||||
redirect,
|
||||
useOutletContext,
|
||||
useRouteError,
|
||||
} from "react-router";
|
||||
import { CenteredLayout, CenteredLayoutSkeleton } from "@probo/ui";
|
||||
@@ -29,8 +30,6 @@ import { statesOfApplicabilityRoutes } from "./routes/statesOfApplicabilityRoute
|
||||
import { lazy } from "@probo/react-lazy";
|
||||
import { routeFromAppRoute, type AppRoute } from "@probo/routes";
|
||||
import { Role } from "@probo/helpers";
|
||||
import { PermissionsContext } from "./providers/PermissionsContext";
|
||||
import { use } from "react";
|
||||
import {
|
||||
ForbiddenError,
|
||||
UnAuthenticatedError,
|
||||
@@ -98,13 +97,13 @@ const routes = [
|
||||
{
|
||||
index: true,
|
||||
Component: lazy(
|
||||
() => import("./pages/iam/memberships/MembershipsPageLoader")
|
||||
() => import("./pages/iam/memberships/MembershipsPageLoader"),
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "organizations/new",
|
||||
Component: lazy(
|
||||
() => import("./pages/iam/organizations/NewOrganizationPage")
|
||||
() => import("./pages/iam/organizations/NewOrganizationPage"),
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -121,7 +120,7 @@ const routes = [
|
||||
path: "/organizations/:organizationId/employee",
|
||||
Fallback: () => "fallback employee...",
|
||||
Component: lazy(
|
||||
() => import("./pages/iam/memberships/MembershipLayoutLoader")
|
||||
() => import("./pages/iam/memberships/MembershipLayoutLoader"),
|
||||
),
|
||||
ErrorBoundary: ErrorBoundary,
|
||||
children: [
|
||||
@@ -130,7 +129,7 @@ const routes = [
|
||||
// Component: () => "hello world",
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/organizations/employee/EmployeeDocumentsPageLoader")
|
||||
import("./pages/organizations/employee/EmployeeDocumentsPageLoader"),
|
||||
),
|
||||
},
|
||||
{
|
||||
@@ -138,7 +137,7 @@ const routes = [
|
||||
ErrorBoundary: ErrorBoundary,
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/organizations/employee/EmployeeDocumentSignaturePageLoader")
|
||||
import("./pages/organizations/employee/EmployeeDocumentSignaturePageLoader"),
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -146,14 +145,14 @@ const routes = [
|
||||
{
|
||||
path: "/organizations/:organizationId",
|
||||
Component: lazy(
|
||||
() => import("./pages/iam/memberships/MembershipLayoutLoader")
|
||||
() => import("./pages/iam/memberships/MembershipLayoutLoader"),
|
||||
),
|
||||
ErrorBoundary: ErrorBoundary,
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
Component: () => {
|
||||
const { role } = use(PermissionsContext);
|
||||
const role = useOutletContext<Role>();
|
||||
switch (role) {
|
||||
case Role.EMPLOYEE:
|
||||
return <Navigate to="employee" />;
|
||||
@@ -168,7 +167,7 @@ const routes = [
|
||||
path: "settings",
|
||||
Fallback: PageSkeleton,
|
||||
Component: lazy(
|
||||
() => import("./pages/iam/organizations/settings/SettingsLayout")
|
||||
() => import("./pages/iam/organizations/settings/SettingsLayout"),
|
||||
),
|
||||
children: [
|
||||
{
|
||||
@@ -181,28 +180,28 @@ const routes = [
|
||||
path: "general",
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/iam/organizations/settings/GeneralSettingsPageLoader")
|
||||
import("./pages/iam/organizations/settings/GeneralSettingsPageLoader"),
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "members",
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/iam/organizations/settings/MembersPageLoader")
|
||||
import("./pages/iam/organizations/settings/MembersPageLoader"),
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "domain",
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/organizations/settings/DomainSettingsPageLoader")
|
||||
import("./pages/organizations/settings/DomainSettingsPageLoader"),
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "saml-sso",
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("./pages/iam/organizations/settings/SAMLSettingsPageLoader")
|
||||
import("./pages/iam/organizations/settings/SAMLSettingsPageLoader"),
|
||||
),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user