Fix trust center references tab permissions handling
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<e67073eb7045d7e1b44337df273de6e0>>
|
||||
* @generated SignedSource<<18ee21b1b07c34808fb34640fd0eee77>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -51,6 +51,7 @@ export type TrustCenterGraphQuery$data = {
|
||||
};
|
||||
readonly trustCenter?: {
|
||||
readonly active: boolean;
|
||||
readonly canCreateReference: boolean;
|
||||
readonly canDeleteNDA: boolean;
|
||||
readonly canGetNDA: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
@@ -59,19 +60,6 @@ export type TrustCenterGraphQuery$data = {
|
||||
readonly id: string;
|
||||
readonly ndaFileName: string | null | undefined;
|
||||
readonly ndaFileUrl: string | null | undefined;
|
||||
readonly references: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
readonly logoUrl: string;
|
||||
readonly name: string;
|
||||
readonly updatedAt: any;
|
||||
readonly websiteUrl: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly updatedAt: any;
|
||||
} | null | undefined;
|
||||
readonly trustCenterFiles?: {
|
||||
@@ -174,18 +162,6 @@ v7 = {
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
},
|
||||
v9 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenter",
|
||||
@@ -270,88 +246,43 @@ v10 = {
|
||||
"storageKey": "permission(action:\"core:trust-center:delete-nda\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"alias": "canCreateReference",
|
||||
"args": [
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "DESC",
|
||||
"field": "CREATED_AT"
|
||||
}
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:create"
|
||||
}
|
||||
],
|
||||
"concreteType": "TrustCenterReferenceConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "references",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReferenceEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReference",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "websiteUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "logoUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "references(first:100,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:create\")"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = [
|
||||
(v8/*: any*/)
|
||||
v9 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
v12 = {
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v13 = {
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
},
|
||||
v14 = {
|
||||
v12 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
@@ -376,7 +307,7 @@ v14 = {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v15 = {
|
||||
v13 = {
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
@@ -388,9 +319,9 @@ v15 = {
|
||||
}
|
||||
]
|
||||
},
|
||||
v16 = {
|
||||
v14 = {
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "SlackConnectionConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "slackConnections",
|
||||
@@ -438,14 +369,14 @@ v16 = {
|
||||
],
|
||||
"storageKey": "slackConnections(first:100)"
|
||||
},
|
||||
v17 = {
|
||||
v15 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "trustCenterVisibility",
|
||||
"storageKey": null
|
||||
},
|
||||
v18 = {
|
||||
v16 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
@@ -474,10 +405,10 @@ return {
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "DocumentConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "documents",
|
||||
@@ -516,7 +447,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "AuditConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "audits",
|
||||
@@ -555,7 +486,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
@@ -622,20 +553,20 @@ return {
|
||||
"kind": "FragmentSpread",
|
||||
"name": "TrustCenterFilesCardFragment"
|
||||
},
|
||||
(v12/*: any*/)
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v13/*: any*/)
|
||||
(v11/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v14/*: any*/),
|
||||
(v15/*: any*/)
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v16/*: any*/)
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
@@ -661,7 +592,7 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v12/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
@@ -669,10 +600,10 @@ return {
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v10/*: any*/),
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "DocumentConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "documents",
|
||||
@@ -710,7 +641,7 @@ return {
|
||||
"name": "documentType",
|
||||
"storageKey": null
|
||||
},
|
||||
(v17/*: any*/),
|
||||
(v15/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
@@ -769,7 +700,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "AuditConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "audits",
|
||||
@@ -827,7 +758,7 @@ return {
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
(v17/*: any*/),
|
||||
(v15/*: any*/),
|
||||
(v6/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -840,7 +771,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "VendorConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "vendors",
|
||||
@@ -864,8 +795,14 @@ return {
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v18/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v16/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -885,7 +822,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"concreteType": "TrustCenterFileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "trustCenterFiles",
|
||||
@@ -909,7 +846,7 @@ return {
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
(v18/*: any*/),
|
||||
(v16/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -917,7 +854,7 @@ return {
|
||||
"name": "fileUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
(v17/*: any*/),
|
||||
(v15/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
{
|
||||
@@ -946,29 +883,29 @@ return {
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
||||
},
|
||||
(v12/*: any*/)
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v13/*: any*/)
|
||||
(v11/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v14/*: any*/),
|
||||
(v15/*: any*/)
|
||||
(v12/*: any*/),
|
||||
(v13/*: any*/)
|
||||
],
|
||||
"storageKey": "trustCenterFiles(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v11/*: any*/),
|
||||
"args": (v9/*: any*/),
|
||||
"filters": null,
|
||||
"handle": "connection",
|
||||
"key": "TrustCenterPage_trustCenterFiles",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "trustCenterFiles"
|
||||
},
|
||||
(v16/*: any*/)
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
@@ -979,7 +916,7 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "0fbd1275d4051e236a6f9711cf21c23b",
|
||||
"cacheID": "6af8bc39a3654fa715f0f235bcb5f488",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
@@ -996,11 +933,11 @@ return {
|
||||
},
|
||||
"name": "TrustCenterGraphQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n references(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n createdAt\n updatedAt\n }\n }\n }\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n"
|
||||
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n canGetNDA: permission(action: \"core:trust-center:get-nda\")\n canUploadNDA: permission(action: \"core:trust-center:upload-nda\")\n canDeleteNDA: permission(action: \"core:trust-center:delete-nda\")\n canCreateReference: permission(action: \"core:trust-center-reference:create\")\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "2c169dd5176d4dedd98ff82210335a86";
|
||||
(node as any).hash = "9669200b7f9e58c412b73b30fa506f51";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<566b652d24d80b551827cb5d3bf5518c>>
|
||||
* @generated SignedSource<<461baa03d93bbfde6ad39536a695caa7>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -25,6 +25,8 @@ export type TrustCenterReferenceGraphCreateMutation$data = {
|
||||
readonly trustCenterReferenceEdge: {
|
||||
readonly cursor: any;
|
||||
readonly node: {
|
||||
readonly canDelete: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
@@ -138,6 +140,32 @@ v3 = {
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:update\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:delete\")"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -211,16 +239,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "623c9df0fba82887a878addd1ddaf706",
|
||||
"cacheID": "4cffbce769a3af5a0b95188c5fdb1ab1",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterReferenceGraphCreateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterReferenceGraphCreateMutation(\n $input: CreateTrustCenterReferenceInput!\n) {\n createTrustCenterReference(input: $input) {\n trustCenterReferenceEdge {\n cursor\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n }\n }\n }\n}\n"
|
||||
"text": "mutation TrustCenterReferenceGraphCreateMutation(\n $input: CreateTrustCenterReferenceInput!\n) {\n createTrustCenterReference(input: $input) {\n trustCenterReferenceEdge {\n cursor\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-reference:update\")\n canDelete: permission(action: \"core:trust-center-reference:delete\")\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "ee754e6c9bc3aa992e1a40e828b0d07e";
|
||||
(node as any).hash = "2235fdf1f63c55b4a6670eaa0f32fe20";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<e7776b4ead5bff52ce340c208ec5bbc6>>
|
||||
* @generated SignedSource<<08cc43ef600ae775505f8446d31ae058>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -14,12 +14,15 @@ export type TrustCenterReferenceGraphQuery$variables = {
|
||||
};
|
||||
export type TrustCenterReferenceGraphQuery$data = {
|
||||
readonly node: {
|
||||
readonly id?: string;
|
||||
readonly references?: {
|
||||
readonly __typename: "TrustCenter";
|
||||
readonly id: string;
|
||||
readonly references: {
|
||||
readonly __id: string;
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly cursor: any;
|
||||
readonly node: {
|
||||
readonly canDelete: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
@@ -37,6 +40,10 @@ export type TrustCenterReferenceGraphQuery$data = {
|
||||
readonly startCursor: any | null | undefined;
|
||||
};
|
||||
};
|
||||
} | {
|
||||
// This will never be '%other', but we need some
|
||||
// value in case none of the concrete values match.
|
||||
readonly __typename: "%other";
|
||||
};
|
||||
};
|
||||
export type TrustCenterReferenceGraphQuery = {
|
||||
@@ -63,10 +70,17 @@ v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
@@ -74,153 +88,170 @@ v3 = {
|
||||
"field": "RANK"
|
||||
}
|
||||
},
|
||||
v4 = {
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasPreviousPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "startCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasPreviousPage",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "startCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReferenceEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReference",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "websiteUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "logoUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "rank",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
v6 = [
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReferenceEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterReference",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "description",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "websiteUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "logoUrl",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "rank",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "createdAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:update\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:delete\")"
|
||||
},
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = {
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
v8 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
},
|
||||
(v3/*: any*/)
|
||||
(v4/*: any*/)
|
||||
];
|
||||
return {
|
||||
"fragment": {
|
||||
@@ -237,21 +268,34 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": "references",
|
||||
"args": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"concreteType": "TrustCenterReferenceConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__TrustCenterReferencesSection_references_connection",
|
||||
"plural": false,
|
||||
"selections": (v5/*: any*/),
|
||||
"storageKey": "__TrustCenterReferencesSection_references_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"RANK\"})"
|
||||
"kind": "RequiredField",
|
||||
"field": {
|
||||
"alias": "references",
|
||||
"args": [
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"concreteType": "TrustCenterReferenceConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "__TrustCenterReferencesSection_references_connection",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v5/*: any*/),
|
||||
{
|
||||
"kind": "RequiredField",
|
||||
"field": (v6/*: any*/),
|
||||
"action": "THROW"
|
||||
},
|
||||
(v7/*: any*/)
|
||||
],
|
||||
"storageKey": "__TrustCenterReferencesSection_references_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"RANK\"})"
|
||||
},
|
||||
"action": "THROW"
|
||||
}
|
||||
],
|
||||
"type": "TrustCenter",
|
||||
@@ -278,24 +322,28 @@ return {
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v6/*: any*/),
|
||||
"args": (v8/*: any*/),
|
||||
"concreteType": "TrustCenterReferenceConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "references",
|
||||
"plural": false,
|
||||
"selections": (v5/*: any*/),
|
||||
"selections": [
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/)
|
||||
],
|
||||
"storageKey": "references(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"RANK\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v6/*: any*/),
|
||||
"args": (v8/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
@@ -314,7 +362,7 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "8fdd97abcaa0d9eb889eb454c85f2e4c",
|
||||
"cacheID": "3eaf772859927eca50f824a7298fd2d5",
|
||||
"id": null,
|
||||
"metadata": {
|
||||
"connection": [
|
||||
@@ -331,11 +379,11 @@ return {
|
||||
},
|
||||
"name": "TrustCenterReferenceGraphQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query TrustCenterReferenceGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n references(first: 100, orderBy: {field: RANK, direction: ASC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n __typename\n }\n }\n }\n }\n id\n }\n}\n"
|
||||
"text": "query TrustCenterReferenceGraphQuery(\n $trustCenterId: ID!\n) {\n node(id: $trustCenterId) {\n __typename\n ... on TrustCenter {\n id\n references(first: 100, orderBy: {field: RANK, direction: ASC}) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-reference:update\")\n canDelete: permission(action: \"core:trust-center-reference:delete\")\n __typename\n }\n }\n }\n }\n id\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "cb4b9b8a68249ae8066a3ff2bfc6acd8";
|
||||
(node as any).hash = "5c1e65a30423ec4357ef2cb546bca387";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<2b51f7fdbc055d912be03031b258c042>>
|
||||
* @generated SignedSource<<20900a908dde87c301e15c5af24f849d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -23,6 +23,8 @@ export type TrustCenterReferenceGraphUpdateMutation$variables = {
|
||||
export type TrustCenterReferenceGraphUpdateMutation$data = {
|
||||
readonly updateTrustCenterReference: {
|
||||
readonly trustCenterReference: {
|
||||
readonly canDelete: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
readonly createdAt: any;
|
||||
readonly description: string | null | undefined;
|
||||
readonly id: string;
|
||||
@@ -125,6 +127,32 @@ v1 = [
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canUpdate",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:update\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDelete",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:trust-center-reference:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:trust-center-reference:delete\")"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -151,16 +179,16 @@ return {
|
||||
"selections": (v1/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "f55510d6d1e0a686d4733f5bd82a605a",
|
||||
"cacheID": "7c0e441a6e51c68b72f3dc0b74079da1",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterReferenceGraphUpdateMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation TrustCenterReferenceGraphUpdateMutation(\n $input: UpdateTrustCenterReferenceInput!\n) {\n updateTrustCenterReference(input: $input) {\n trustCenterReference {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n }\n }\n}\n"
|
||||
"text": "mutation TrustCenterReferenceGraphUpdateMutation(\n $input: UpdateTrustCenterReferenceInput!\n) {\n updateTrustCenterReference(input: $input) {\n trustCenterReference {\n id\n name\n description\n websiteUrl\n logoUrl\n rank\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center-reference:update\")\n canDelete: permission(action: \"core:trust-center-reference:delete\")\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "bed2a3190570cd85d85dd38f20f375da";
|
||||
(node as any).hash = "f6add85271c2b048654bf586745252fc";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -29,13 +29,7 @@ type ReferenceFormData = z.infer<typeof referenceSchema>;
|
||||
|
||||
export type TrustCenterReferenceDialogRef = {
|
||||
openCreate: (trustCenterId: string, connectionId: string) => void;
|
||||
openEdit: (reference: {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
websiteUrl: string;
|
||||
rank: number;
|
||||
}) => void;
|
||||
openEdit: (reference: Reference) => void;
|
||||
};
|
||||
|
||||
type Reference = {
|
||||
|
||||
@@ -14,43 +14,54 @@ import {
|
||||
IconPencil,
|
||||
IconArrowLink,
|
||||
} from "@probo/ui";
|
||||
import { type ReactNode, useRef, useState, use } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
import {
|
||||
useTrustCenterReferences,
|
||||
trustCenterReferencesQuery,
|
||||
useUpdateTrustCenterReferenceRankMutation,
|
||||
} from "/hooks/graph/TrustCenterReferenceGraph";
|
||||
import { TrustCenterReferenceDialog, type TrustCenterReferenceDialogRef } from "./TrustCenterReferenceDialog";
|
||||
import {
|
||||
TrustCenterReferenceDialog,
|
||||
type TrustCenterReferenceDialogRef,
|
||||
} from "./TrustCenterReferenceDialog";
|
||||
import { DeleteTrustCenterReferenceDialog } from "./DeleteTrustCenterReferenceDialog";
|
||||
import { PermissionsContext } from "/providers/PermissionsContext";
|
||||
import type {
|
||||
TrustCenterReferenceGraphQuery,
|
||||
TrustCenterReferenceGraphQuery$data,
|
||||
} from "/__generated__/core/TrustCenterReferenceGraphQuery.graphql";
|
||||
import { useLazyLoadQuery } from "react-relay";
|
||||
|
||||
type Props = {
|
||||
trustCenterId: string;
|
||||
children?: ReactNode;
|
||||
canCreateReference: boolean;
|
||||
};
|
||||
|
||||
type Reference = {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string | null;
|
||||
websiteUrl: string;
|
||||
logoUrl: string;
|
||||
rank: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
export type Reference = Extract<
|
||||
TrustCenterReferenceGraphQuery$data["node"],
|
||||
{ __typename: "TrustCenter" }
|
||||
>["references"]["edges"][number]["node"];
|
||||
|
||||
export function TrustCenterReferencesSection({ trustCenterId }: Props) {
|
||||
export function TrustCenterReferencesSection({
|
||||
canCreateReference,
|
||||
trustCenterId,
|
||||
}: Props) {
|
||||
const { __ } = useTranslate();
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
const dialogRef = useRef<TrustCenterReferenceDialogRef>(null);
|
||||
const [draggedIndex, setDraggedIndex] = useState<number | null>(null);
|
||||
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
|
||||
const [refetchKey, setRefetchKey] = useState(0);
|
||||
const data = useTrustCenterReferences(trustCenterId, refetchKey);
|
||||
const { node: trustCenterNode } =
|
||||
useLazyLoadQuery<TrustCenterReferenceGraphQuery>(
|
||||
trustCenterReferencesQuery,
|
||||
{ trustCenterId: trustCenterId || "" },
|
||||
{ fetchPolicy: "network-only", fetchKey: refetchKey },
|
||||
);
|
||||
if (trustCenterNode.__typename !== "TrustCenter") {
|
||||
throw new Error("invalid node type");
|
||||
}
|
||||
const [updateRank] = useUpdateTrustCenterReferenceRankMutation();
|
||||
|
||||
const trustCenterNode = data?.node;
|
||||
const references = trustCenterNode?.references?.edges?.map((edge) => edge.node) || [];
|
||||
const references =
|
||||
trustCenterNode?.references?.edges?.map((edge) => edge.node) || [];
|
||||
const referencesConnectionId = trustCenterNode?.references?.__id || "";
|
||||
|
||||
const handleCreate = () => {
|
||||
@@ -113,11 +124,8 @@ export function TrustCenterReferencesSection({ trustCenterId }: Props) {
|
||||
{__("Showcase your customers and partners on your trust center")}
|
||||
</p>
|
||||
</div>
|
||||
{isAuthorized("TrustCenter", "createTrustCenterReference") && (
|
||||
<Button
|
||||
icon={IconPlusLarge}
|
||||
onClick={handleCreate}
|
||||
>
|
||||
{canCreateReference && (
|
||||
<Button icon={IconPlusLarge} onClick={handleCreate}>
|
||||
{__("Add Reference")}
|
||||
</Button>
|
||||
)}
|
||||
@@ -191,14 +199,15 @@ function ReferenceRow({
|
||||
onDrop,
|
||||
}: ReferenceRowProps) {
|
||||
const [isMouseDown, setIsMouseDown] = useState(false);
|
||||
const { isAuthorized } = use(PermissionsContext);
|
||||
|
||||
const className = [
|
||||
isDragging && "opacity-50 cursor-grabbing",
|
||||
!isDragging && !isMouseDown && "cursor-grab",
|
||||
!isDragging && isMouseDown && "cursor-grabbing",
|
||||
isDropTarget && "!bg-primary-50 border-y-2 border-primary-500",
|
||||
].filter(Boolean).join(" ");
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
|
||||
return (
|
||||
<Tr
|
||||
@@ -213,11 +222,7 @@ function ReferenceRow({
|
||||
>
|
||||
<Td>
|
||||
<div className="flex items-center gap-3">
|
||||
<Avatar
|
||||
src={reference.logoUrl}
|
||||
name={reference.name}
|
||||
size="m"
|
||||
/>
|
||||
<Avatar src={reference.logoUrl} name={reference.name} size="m" />
|
||||
<span className="font-medium">{reference.name}</span>
|
||||
</div>
|
||||
</Td>
|
||||
@@ -233,23 +238,16 @@ function ReferenceRow({
|
||||
icon={IconArrowLink}
|
||||
onClick={onVisitWebsite}
|
||||
/>
|
||||
{isAuthorized("TrustCenterReference", "updateTrustCenterReference") && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
icon={IconPencil}
|
||||
onClick={onEdit}
|
||||
/>
|
||||
{reference.canUpdate && (
|
||||
<Button variant="secondary" icon={IconPencil} onClick={onEdit} />
|
||||
)}
|
||||
{isAuthorized("TrustCenterReference", "deleteTrustCenterReference") && (
|
||||
{reference.canDelete && (
|
||||
<DeleteTrustCenterReferenceDialog
|
||||
referenceId={reference.id}
|
||||
referenceName={reference.name}
|
||||
connectionId={connectionId}
|
||||
>
|
||||
<Button
|
||||
variant="danger"
|
||||
icon={IconTrashCan}
|
||||
/>
|
||||
<Button variant="danger" icon={IconTrashCan} />
|
||||
</DeleteTrustCenterReferenceDialog>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -26,22 +26,9 @@ export const trustCenterQuery = graphql`
|
||||
canGetNDA: permission(action: "core:trust-center:get-nda")
|
||||
canUploadNDA: permission(action: "core:trust-center:upload-nda")
|
||||
canDeleteNDA: permission(action: "core:trust-center:delete-nda")
|
||||
references(
|
||||
first: 100
|
||||
orderBy: { field: CREATED_AT, direction: DESC }
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
description
|
||||
websiteUrl
|
||||
logoUrl
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
canCreateReference: permission(
|
||||
action: "core:trust-center-reference:create"
|
||||
)
|
||||
}
|
||||
documents(first: 100) {
|
||||
edges {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
import { graphql } from "react-relay";
|
||||
import { useLazyLoadQuery } from "react-relay";
|
||||
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
|
||||
import type {
|
||||
TrustCenterReferenceGraphQuery,
|
||||
TrustCenterReferenceGraphQuery$data,
|
||||
} from "/__generated__/core/TrustCenterReferenceGraphQuery.graphql";
|
||||
import type { TrustCenterReferenceGraphCreateMutation } from "/__generated__/core/TrustCenterReferenceGraphCreateMutation.graphql";
|
||||
import type { TrustCenterReferenceGraphUpdateMutation } from "/__generated__/core/TrustCenterReferenceGraphUpdateMutation.graphql";
|
||||
import type { TrustCenterReferenceGraphUpdateRankMutation } from "/__generated__/core/TrustCenterReferenceGraphUpdateRankMutation.graphql";
|
||||
@@ -13,10 +8,12 @@ import type { TrustCenterReferenceGraphDeleteMutation } from "/__generated__/cor
|
||||
export const trustCenterReferencesQuery = graphql`
|
||||
query TrustCenterReferenceGraphQuery($trustCenterId: ID!) {
|
||||
node(id: $trustCenterId) {
|
||||
__typename
|
||||
... on TrustCenter {
|
||||
id
|
||||
references(first: 100, orderBy: { field: RANK, direction: ASC })
|
||||
@connection(key: "TrustCenterReferencesSection_references") {
|
||||
@connection(key: "TrustCenterReferencesSection_references")
|
||||
@required(action: THROW) {
|
||||
__id
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
@@ -24,7 +21,7 @@ export const trustCenterReferencesQuery = graphql`
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
edges {
|
||||
edges @required(action: THROW) {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
@@ -35,6 +32,12 @@ export const trustCenterReferencesQuery = graphql`
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(
|
||||
action: "core:trust-center-reference:update"
|
||||
)
|
||||
canDelete: permission(
|
||||
action: "core:trust-center-reference:delete"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +63,8 @@ export const createTrustCenterReferenceMutation = graphql`
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "core:trust-center-reference:update")
|
||||
canDelete: permission(action: "core:trust-center-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +85,8 @@ export const updateTrustCenterReferenceMutation = graphql`
|
||||
rank
|
||||
createdAt
|
||||
updatedAt
|
||||
canUpdate: permission(action: "core:trust-center-reference:update")
|
||||
canDelete: permission(action: "core:trust-center-reference:delete")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,19 +103,6 @@ export const deleteTrustCenterReferenceMutation = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
export function useTrustCenterReferences(
|
||||
trustCenterId: string,
|
||||
refetchKey = 0,
|
||||
): TrustCenterReferenceGraphQuery$data | null {
|
||||
const data = useLazyLoadQuery<TrustCenterReferenceGraphQuery>(
|
||||
trustCenterReferencesQuery,
|
||||
{ trustCenterId: trustCenterId || "" },
|
||||
{ fetchPolicy: "network-only", fetchKey: refetchKey },
|
||||
);
|
||||
|
||||
return trustCenterId ? data : null;
|
||||
}
|
||||
|
||||
export function useCreateTrustCenterReferenceMutation() {
|
||||
return useMutationWithToasts<TrustCenterReferenceGraphCreateMutation>(
|
||||
createTrustCenterReferenceMutation,
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
import { useOutletContext } from "react-router";
|
||||
import { TrustCenterReferencesSection } from "/components/trustCenter/TrustCenterReferencesSection";
|
||||
|
||||
type ContextType = {
|
||||
organization: {
|
||||
trustCenter?: {
|
||||
id: string;
|
||||
} | null;
|
||||
};
|
||||
};
|
||||
import type { TrustCenterGraphQuery$data } from "/__generated__/core/TrustCenterGraphQuery.graphql";
|
||||
|
||||
export default function TrustCenterReferencesTab() {
|
||||
const { organization } = useOutletContext<ContextType>();
|
||||
const { organization } = useOutletContext<TrustCenterGraphQuery$data>();
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
{organization.trustCenter?.id && (
|
||||
<TrustCenterReferencesSection trustCenterId={organization.trustCenter.id} />
|
||||
<TrustCenterReferencesSection
|
||||
trustCenterId={organization.trustCenter.id}
|
||||
canCreateReference={!!organization.trustCenter.canCreateReference}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -32,18 +32,18 @@ const (
|
||||
ActionTrustCenterGetNda = "core:trust-center:get-nda"
|
||||
ActionTrustCenterNonDisclosureAgreementUpload = "core:trust-center:upload-nda"
|
||||
ActionTrustCenterNonDisclosureAgreementDelete = "core:trust-center:delete-nda"
|
||||
ActionTrustCenterAccessCreate = "core:trust-center:create-access"
|
||||
ActionTrustCenterReferenceCreate = "core:trust-center:create-reference"
|
||||
|
||||
// TrustCenterAccess actions
|
||||
ActionTrustCenterAccessGet = "core:trust-center-access:get"
|
||||
ActionTrustCenterAccessList = "core:trust-center-access:list"
|
||||
ActionTrustCenterAccessCreate = "core:trust-center-access:create"
|
||||
ActionTrustCenterAccessUpdate = "core:trust-center-access:update"
|
||||
ActionTrustCenterAccessDelete = "core:trust-center-access:delete"
|
||||
|
||||
// TrustCenterReference actions
|
||||
ActionTrustCenterReferenceList = "core:trust-center-reference:list"
|
||||
ActionTrustCenterReferenceGetLogoUrl = "core:trust-center-reference:get-logo-url"
|
||||
ActionTrustCenterReferenceCreate = "core:trust-center-reference:create"
|
||||
ActionTrustCenterReferenceUpdate = "core:trust-center-reference:update"
|
||||
ActionTrustCenterReferenceDelete = "core:trust-center-reference:delete"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user