Refactor compliance page files page
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
173
apps/console/src/__generated__/core/CompliancePageFileListFragment.graphql.ts
generated
Normal file
173
apps/console/src/__generated__/core/CompliancePageFileListFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<6d08eaab8a421f1908e103b1343e72ac>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type CompliancePageFileListFragment$data = {
|
||||||
|
readonly compliancePage: {
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_compliancePageFragment">;
|
||||||
|
};
|
||||||
|
readonly trustCenterFiles: {
|
||||||
|
readonly __id: string;
|
||||||
|
readonly edges: ReadonlyArray<{
|
||||||
|
readonly node: {
|
||||||
|
readonly id: string;
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">;
|
||||||
|
};
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
readonly " $fragmentType": "CompliancePageFileListFragment";
|
||||||
|
};
|
||||||
|
export type CompliancePageFileListFragment$key = {
|
||||||
|
readonly " $data"?: CompliancePageFileListFragment$data;
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListFragment">;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ReaderFragment = {
|
||||||
|
"argumentDefinitions": [],
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": {
|
||||||
|
"connection": [
|
||||||
|
{
|
||||||
|
"count": null,
|
||||||
|
"cursor": null,
|
||||||
|
"direction": "forward",
|
||||||
|
"path": [
|
||||||
|
"trustCenterFiles"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"name": "CompliancePageFileListFragment",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"kind": "RequiredField",
|
||||||
|
"field": {
|
||||||
|
"alias": "compliancePage",
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenter",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenter",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListItem_compliancePageFragment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
"action": "THROW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "trustCenterFiles",
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFileConnection",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "__CompliancePageFileList_trustCenterFiles_connection",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFileEdge",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "edges",
|
||||||
|
"plural": true,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "id",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListItem_fileFragment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "__typename",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "cursor",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "PageInfo",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "pageInfo",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "endCursor",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "hasNextPage",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "ClientExtension",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "__id",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Organization",
|
||||||
|
"abstractKey": null
|
||||||
|
};
|
||||||
|
|
||||||
|
(node as any).hash = "ebbed925b4bbca03e906f63a2d18ab7b";
|
||||||
|
|
||||||
|
export default node;
|
||||||
199
apps/console/src/__generated__/core/CompliancePageFileListItemMutation.graphql.ts
generated
Normal file
199
apps/console/src/__generated__/core/CompliancePageFileListItemMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<edbba02a5cd970d35a5c351936e9f160>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
export type UpdateTrustCenterFileInput = {
|
||||||
|
category?: string | null | undefined;
|
||||||
|
id: string;
|
||||||
|
name?: string | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
|
};
|
||||||
|
export type CompliancePageFileListItemMutation$variables = {
|
||||||
|
input: UpdateTrustCenterFileInput;
|
||||||
|
};
|
||||||
|
export type CompliancePageFileListItemMutation$data = {
|
||||||
|
readonly updateTrustCenterFile: {
|
||||||
|
readonly trustCenterFile: {
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type CompliancePageFileListItemMutation = {
|
||||||
|
response: CompliancePageFileListItemMutation$data;
|
||||||
|
variables: CompliancePageFileListItemMutation$variables;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ConcreteRequest = (function(){
|
||||||
|
var v0 = [
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "input"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v1 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "input",
|
||||||
|
"variableName": "input"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
return {
|
||||||
|
"fragment": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "CompliancePageFileListItemMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": "UpdateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "updateTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListItem_fileFragment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Mutation",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
"kind": "Request",
|
||||||
|
"operation": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Operation",
|
||||||
|
"name": "CompliancePageFileListItemMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": "UpdateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "updateTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "id",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "name",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "category",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "fileUrl",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "trustCenterVisibility",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "createdAt",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"cacheID": "963de1bddf6d9339854e8c147436ea36",
|
||||||
|
"id": null,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "CompliancePageFileListItemMutation",
|
||||||
|
"operationKind": "mutation",
|
||||||
|
"text": "mutation CompliancePageFileListItemMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
(node as any).hash = "e4f65173916a702e8e9ea587e0b560b2";
|
||||||
|
|
||||||
|
export default node;
|
||||||
48
apps/console/src/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql.ts
generated
Normal file
48
apps/console/src/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<b40dce1506005cda2d2be9bd6aeee6dd>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type CompliancePageFileListItem_compliancePageFragment$data = {
|
||||||
|
readonly canUpdate: boolean;
|
||||||
|
readonly " $fragmentType": "CompliancePageFileListItem_compliancePageFragment";
|
||||||
|
};
|
||||||
|
export type CompliancePageFileListItem_compliancePageFragment$key = {
|
||||||
|
readonly " $data"?: CompliancePageFileListItem_compliancePageFragment$data;
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_compliancePageFragment">;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ReaderFragment = {
|
||||||
|
"argumentDefinitions": [],
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "CompliancePageFileListItem_compliancePageFragment",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center:update\")"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "TrustCenter",
|
||||||
|
"abstractKey": null
|
||||||
|
};
|
||||||
|
|
||||||
|
(node as any).hash = "83a20628bcc627902e29c5515741efc5";
|
||||||
|
|
||||||
|
export default node;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<f9b0d1c5f1852bef8797dcf34920e519>>
|
* @generated SignedSource<<e798de547d8804086770073da5d19f76>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type TrustCenterFilesCardFragment$data = {
|
export type CompliancePageFileListItem_fileFragment$data = {
|
||||||
readonly canDelete: boolean;
|
readonly canDelete: boolean;
|
||||||
readonly canUpdate: boolean;
|
readonly canUpdate: boolean;
|
||||||
readonly category: string;
|
readonly category: string;
|
||||||
@@ -20,19 +20,18 @@ export type TrustCenterFilesCardFragment$data = {
|
|||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly trustCenterVisibility: TrustCenterVisibility;
|
readonly trustCenterVisibility: TrustCenterVisibility;
|
||||||
readonly updatedAt: string;
|
readonly " $fragmentType": "CompliancePageFileListItem_fileFragment";
|
||||||
readonly " $fragmentType": "TrustCenterFilesCardFragment";
|
|
||||||
};
|
};
|
||||||
export type TrustCenterFilesCardFragment$key = {
|
export type CompliancePageFileListItem_fileFragment$key = {
|
||||||
readonly " $data"?: TrustCenterFilesCardFragment$data;
|
readonly " $data"?: CompliancePageFileListItem_fileFragment$data;
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterFilesCardFragment">;
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">;
|
||||||
};
|
};
|
||||||
|
|
||||||
const node: ReaderFragment = {
|
const node: ReaderFragment = {
|
||||||
"argumentDefinitions": [],
|
"argumentDefinitions": [],
|
||||||
"kind": "Fragment",
|
"kind": "Fragment",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "TrustCenterFilesCardFragment",
|
"name": "CompliancePageFileListItem_fileFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
@@ -76,13 +75,6 @@ const node: ReaderFragment = {
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "updatedAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"alias": "canUpdate",
|
"alias": "canUpdate",
|
||||||
"args": [
|
"args": [
|
||||||
@@ -114,6 +106,6 @@ const node: ReaderFragment = {
|
|||||||
"abstractKey": null
|
"abstractKey": null
|
||||||
};
|
};
|
||||||
|
|
||||||
(node as any).hash = "7b9e482868fc5d815923fbefdbafc8bb";
|
(node as any).hash = "0e5caf3d8c62ca0cd3ed8b37787e2b86";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
327
apps/console/src/__generated__/core/CompliancePageFilesPageQuery.graphql.ts
generated
Normal file
327
apps/console/src/__generated__/core/CompliancePageFilesPageQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,327 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<43d75c2e4c035f883790d1d854b60bfc>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type CompliancePageFilesPageQuery$variables = {
|
||||||
|
organizationId: string;
|
||||||
|
};
|
||||||
|
export type CompliancePageFilesPageQuery$data = {
|
||||||
|
readonly organization: {
|
||||||
|
readonly canCreateTrustCenterFile?: boolean;
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListFragment">;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type CompliancePageFilesPageQuery = {
|
||||||
|
response: CompliancePageFilesPageQuery$data;
|
||||||
|
variables: CompliancePageFilesPageQuery$variables;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ConcreteRequest = (function(){
|
||||||
|
var v0 = [
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "organizationId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v1 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "id",
|
||||||
|
"variableName": "organizationId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v2 = {
|
||||||
|
"alias": "canCreateTrustCenterFile",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:create"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:create\")"
|
||||||
|
},
|
||||||
|
v3 = {
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "__typename",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
v4 = {
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "id",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
v5 = [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "first",
|
||||||
|
"value": 1000
|
||||||
|
}
|
||||||
|
];
|
||||||
|
return {
|
||||||
|
"fragment": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "CompliancePageFilesPageQuery",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": "organization",
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": null,
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"kind": "InlineFragment",
|
||||||
|
"selections": [
|
||||||
|
(v2/*: any*/)
|
||||||
|
],
|
||||||
|
"type": "Organization",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListFragment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Query",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
"kind": "Request",
|
||||||
|
"operation": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Operation",
|
||||||
|
"name": "CompliancePageFilesPageQuery",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": "organization",
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": null,
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
(v3/*: any*/),
|
||||||
|
{
|
||||||
|
"kind": "InlineFragment",
|
||||||
|
"selections": [
|
||||||
|
(v2/*: any*/),
|
||||||
|
{
|
||||||
|
"alias": "compliancePage",
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenter",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenter",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center:update\")"
|
||||||
|
},
|
||||||
|
(v4/*: any*/)
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v5/*: any*/),
|
||||||
|
"concreteType": "TrustCenterFileConnection",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFiles",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFileEdge",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "edges",
|
||||||
|
"plural": true,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
(v4/*: any*/),
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "name",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "category",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "fileUrl",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "trustCenterVisibility",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "createdAt",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
||||||
|
},
|
||||||
|
(v3/*: any*/)
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "cursor",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "PageInfo",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "pageInfo",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "endCursor",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "hasNextPage",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"kind": "ClientExtension",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "__id",
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": "trustCenterFiles(first:1000)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v5/*: any*/),
|
||||||
|
"filters": null,
|
||||||
|
"handle": "connection",
|
||||||
|
"key": "CompliancePageFileList_trustCenterFiles",
|
||||||
|
"kind": "LinkedHandle",
|
||||||
|
"name": "trustCenterFiles"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Organization",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
(v4/*: any*/)
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"cacheID": "115af8c7555ab3ab0277f16c8ec7ea6d",
|
||||||
|
"id": null,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "CompliancePageFilesPageQuery",
|
||||||
|
"operationKind": "query",
|
||||||
|
"text": "query CompliancePageFilesPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateTrustCenterFile: permission(action: \"core:trust-center-file:create\")\n }\n ...CompliancePageFileListFragment\n id\n }\n}\n\nfragment CompliancePageFileListFragment on Organization {\n compliancePage: trustCenter {\n ...CompliancePageFileListItem_compliancePageFragment\n id\n }\n trustCenterFiles(first: 1000) {\n edges {\n node {\n id\n ...CompliancePageFileListItem_fileFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment CompliancePageFileListItem_compliancePageFragment on TrustCenter {\n canUpdate: permission(action: \"core:trust-center:update\")\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
(node as any).hash = "77e598eaad239dcac7b5036c52442ed4";
|
||||||
|
|
||||||
|
export default node;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<f788919caaf846a6a1bdc81f19841823>>
|
* @generated SignedSource<<883f3a053aa51e1c94ad7c75a2fb91d2>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -12,18 +12,18 @@ import { ConcreteRequest } from 'relay-runtime';
|
|||||||
export type DeleteTrustCenterFileInput = {
|
export type DeleteTrustCenterFileInput = {
|
||||||
id: string;
|
id: string;
|
||||||
};
|
};
|
||||||
export type TrustCenterFileGraphDeleteMutation$variables = {
|
export type DeleteCompliancePageFileDialogMutation$variables = {
|
||||||
connections: ReadonlyArray<string>;
|
connections: ReadonlyArray<string>;
|
||||||
input: DeleteTrustCenterFileInput;
|
input: DeleteTrustCenterFileInput;
|
||||||
};
|
};
|
||||||
export type TrustCenterFileGraphDeleteMutation$data = {
|
export type DeleteCompliancePageFileDialogMutation$data = {
|
||||||
readonly deleteTrustCenterFile: {
|
readonly deleteTrustCenterFile: {
|
||||||
readonly deletedTrustCenterFileId: string;
|
readonly deletedTrustCenterFileId: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
export type TrustCenterFileGraphDeleteMutation = {
|
export type DeleteCompliancePageFileDialogMutation = {
|
||||||
response: TrustCenterFileGraphDeleteMutation$data;
|
response: DeleteCompliancePageFileDialogMutation$data;
|
||||||
variables: TrustCenterFileGraphDeleteMutation$variables;
|
variables: DeleteCompliancePageFileDialogMutation$variables;
|
||||||
};
|
};
|
||||||
|
|
||||||
const node: ConcreteRequest = (function(){
|
const node: ConcreteRequest = (function(){
|
||||||
@@ -59,7 +59,7 @@ return {
|
|||||||
],
|
],
|
||||||
"kind": "Fragment",
|
"kind": "Fragment",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "TrustCenterFileGraphDeleteMutation",
|
"name": "DeleteCompliancePageFileDialogMutation",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
@@ -84,7 +84,7 @@ return {
|
|||||||
(v0/*: any*/)
|
(v0/*: any*/)
|
||||||
],
|
],
|
||||||
"kind": "Operation",
|
"kind": "Operation",
|
||||||
"name": "TrustCenterFileGraphDeleteMutation",
|
"name": "DeleteCompliancePageFileDialogMutation",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
@@ -117,16 +117,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "ad78a064da9b58291653f8283012ffc6",
|
"cacheID": "d3d7dcdb4201d8f3eeaa66973545bed0",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterFileGraphDeleteMutation",
|
"name": "DeleteCompliancePageFileDialogMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation TrustCenterFileGraphDeleteMutation(\n $input: DeleteTrustCenterFileInput!\n) {\n deleteTrustCenterFile(input: $input) {\n deletedTrustCenterFileId\n }\n}\n"
|
"text": "mutation DeleteCompliancePageFileDialogMutation(\n $input: DeleteTrustCenterFileInput!\n) {\n deleteTrustCenterFile(input: $input) {\n deletedTrustCenterFileId\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "26c1ce69e74f3a4a39d060b38afbe3e0";
|
(node as any).hash = "1bf5628f93e3ec6ee240290f5aaf5761";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
199
apps/console/src/__generated__/core/EditCompliancePageFileDialogMutation.graphql.ts
generated
Normal file
199
apps/console/src/__generated__/core/EditCompliancePageFileDialogMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<4b69c7a9c52b20ca2556b68e16e87cc1>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
export type UpdateTrustCenterFileInput = {
|
||||||
|
category?: string | null | undefined;
|
||||||
|
id: string;
|
||||||
|
name?: string | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
|
};
|
||||||
|
export type EditCompliancePageFileDialogMutation$variables = {
|
||||||
|
input: UpdateTrustCenterFileInput;
|
||||||
|
};
|
||||||
|
export type EditCompliancePageFileDialogMutation$data = {
|
||||||
|
readonly updateTrustCenterFile: {
|
||||||
|
readonly trustCenterFile: {
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type EditCompliancePageFileDialogMutation = {
|
||||||
|
response: EditCompliancePageFileDialogMutation$data;
|
||||||
|
variables: EditCompliancePageFileDialogMutation$variables;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ConcreteRequest = (function(){
|
||||||
|
var v0 = [
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "input"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v1 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "input",
|
||||||
|
"variableName": "input"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
return {
|
||||||
|
"fragment": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "EditCompliancePageFileDialogMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": "UpdateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "updateTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListItem_fileFragment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Mutation",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
"kind": "Request",
|
||||||
|
"operation": {
|
||||||
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
|
"kind": "Operation",
|
||||||
|
"name": "EditCompliancePageFileDialogMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v1/*: any*/),
|
||||||
|
"concreteType": "UpdateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "updateTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "id",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "name",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "category",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "fileUrl",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "trustCenterVisibility",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "createdAt",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"cacheID": "7870997778d7b97e32afa90f4fd94e37",
|
||||||
|
"id": null,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "EditCompliancePageFileDialogMutation",
|
||||||
|
"operationKind": "mutation",
|
||||||
|
"text": "mutation EditCompliancePageFileDialogMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
(node as any).hash = "c49b56acdfa7d0764ced16a9f0b39c69";
|
||||||
|
|
||||||
|
export default node;
|
||||||
250
apps/console/src/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql.ts
generated
Normal file
250
apps/console/src/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
/**
|
||||||
|
* @generated SignedSource<<50c909a6a1d81679625acf045c6ca1c2>>
|
||||||
|
* @lightSyntaxTransform
|
||||||
|
* @nogrep
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
|
import { FragmentRefs } from "relay-runtime";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
export type CreateTrustCenterFileInput = {
|
||||||
|
category: string;
|
||||||
|
file: any;
|
||||||
|
name: string;
|
||||||
|
organizationId: string;
|
||||||
|
trustCenterVisibility: TrustCenterVisibility;
|
||||||
|
};
|
||||||
|
export type NewCompliancePageFileDialog_createMutation$variables = {
|
||||||
|
connections: ReadonlyArray<string>;
|
||||||
|
input: CreateTrustCenterFileInput;
|
||||||
|
};
|
||||||
|
export type NewCompliancePageFileDialog_createMutation$data = {
|
||||||
|
readonly createTrustCenterFile: {
|
||||||
|
readonly trustCenterFileEdge: {
|
||||||
|
readonly node: {
|
||||||
|
readonly " $fragmentSpreads": FragmentRefs<"CompliancePageFileListItem_fileFragment">;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export type NewCompliancePageFileDialog_createMutation = {
|
||||||
|
response: NewCompliancePageFileDialog_createMutation$data;
|
||||||
|
variables: NewCompliancePageFileDialog_createMutation$variables;
|
||||||
|
};
|
||||||
|
|
||||||
|
const node: ConcreteRequest = (function(){
|
||||||
|
var v0 = {
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "connections"
|
||||||
|
},
|
||||||
|
v1 = {
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "input"
|
||||||
|
},
|
||||||
|
v2 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "input",
|
||||||
|
"variableName": "input"
|
||||||
|
}
|
||||||
|
];
|
||||||
|
return {
|
||||||
|
"fragment": {
|
||||||
|
"argumentDefinitions": [
|
||||||
|
(v0/*: any*/),
|
||||||
|
(v1/*: any*/)
|
||||||
|
],
|
||||||
|
"kind": "Fragment",
|
||||||
|
"metadata": null,
|
||||||
|
"name": "NewCompliancePageFileDialog_createMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v2/*: any*/),
|
||||||
|
"concreteType": "CreateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "createTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFileEdge",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFileEdge",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"args": null,
|
||||||
|
"kind": "FragmentSpread",
|
||||||
|
"name": "CompliancePageFileListItem_fileFragment"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Mutation",
|
||||||
|
"abstractKey": null
|
||||||
|
},
|
||||||
|
"kind": "Request",
|
||||||
|
"operation": {
|
||||||
|
"argumentDefinitions": [
|
||||||
|
(v1/*: any*/),
|
||||||
|
(v0/*: any*/)
|
||||||
|
],
|
||||||
|
"kind": "Operation",
|
||||||
|
"name": "NewCompliancePageFileDialog_createMutation",
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": (v2/*: any*/),
|
||||||
|
"concreteType": "CreateTrustCenterFilePayload",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "createTrustCenterFile",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFileEdge",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "trustCenterFileEdge",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"concreteType": "TrustCenterFile",
|
||||||
|
"kind": "LinkedField",
|
||||||
|
"name": "node",
|
||||||
|
"plural": false,
|
||||||
|
"selections": [
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "id",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "name",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "category",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "fileUrl",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "trustCenterVisibility",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "createdAt",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canUpdate",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:update"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:update\")"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": "canDelete",
|
||||||
|
"args": [
|
||||||
|
{
|
||||||
|
"kind": "Literal",
|
||||||
|
"name": "action",
|
||||||
|
"value": "core:trust-center-file:delete"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "permission",
|
||||||
|
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"filters": null,
|
||||||
|
"handle": "prependEdge",
|
||||||
|
"key": "",
|
||||||
|
"kind": "LinkedHandle",
|
||||||
|
"name": "trustCenterFileEdge",
|
||||||
|
"handleArgs": [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "connections",
|
||||||
|
"variableName": "connections"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"storageKey": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"cacheID": "337ae413f581adb0256b0b47f0514f43",
|
||||||
|
"id": null,
|
||||||
|
"metadata": {},
|
||||||
|
"name": "NewCompliancePageFileDialog_createMutation",
|
||||||
|
"operationKind": "mutation",
|
||||||
|
"text": "mutation NewCompliancePageFileDialog_createMutation(\n $input: CreateTrustCenterFileInput!\n) {\n createTrustCenterFile(input: $input) {\n trustCenterFileEdge {\n node {\n ...CompliancePageFileListItem_fileFragment\n id\n }\n }\n }\n}\n\nfragment CompliancePageFileListItem_fileFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n canUpdate: permission(action: \"core:trust-center-file:update\")\n canDelete: permission(action: \"core:trust-center-file:delete\")\n}\n"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
|
||||||
|
(node as any).hash = "826c457285dd9890c39b9c11e600316f";
|
||||||
|
|
||||||
|
export default node;
|
||||||
@@ -1,211 +0,0 @@
|
|||||||
/**
|
|
||||||
* @generated SignedSource<<d2fbf38ca892f7eda55510d3fa35f15f>>
|
|
||||||
* @lightSyntaxTransform
|
|
||||||
* @nogrep
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
|
||||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
|
||||||
export type CreateTrustCenterFileInput = {
|
|
||||||
category: string;
|
|
||||||
file: any;
|
|
||||||
name: string;
|
|
||||||
organizationId: string;
|
|
||||||
trustCenterVisibility: TrustCenterVisibility;
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphCreateMutation$variables = {
|
|
||||||
connections: ReadonlyArray<string>;
|
|
||||||
input: CreateTrustCenterFileInput;
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphCreateMutation$data = {
|
|
||||||
readonly createTrustCenterFile: {
|
|
||||||
readonly trustCenterFileEdge: {
|
|
||||||
readonly node: {
|
|
||||||
readonly category: string;
|
|
||||||
readonly createdAt: string;
|
|
||||||
readonly fileUrl: string;
|
|
||||||
readonly id: string;
|
|
||||||
readonly name: string;
|
|
||||||
readonly trustCenterVisibility: TrustCenterVisibility;
|
|
||||||
readonly updatedAt: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphCreateMutation = {
|
|
||||||
response: TrustCenterFileGraphCreateMutation$data;
|
|
||||||
variables: TrustCenterFileGraphCreateMutation$variables;
|
|
||||||
};
|
|
||||||
|
|
||||||
const node: ConcreteRequest = (function(){
|
|
||||||
var v0 = {
|
|
||||||
"defaultValue": null,
|
|
||||||
"kind": "LocalArgument",
|
|
||||||
"name": "connections"
|
|
||||||
},
|
|
||||||
v1 = {
|
|
||||||
"defaultValue": null,
|
|
||||||
"kind": "LocalArgument",
|
|
||||||
"name": "input"
|
|
||||||
},
|
|
||||||
v2 = [
|
|
||||||
{
|
|
||||||
"kind": "Variable",
|
|
||||||
"name": "input",
|
|
||||||
"variableName": "input"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
v3 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFileEdge",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "trustCenterFileEdge",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFile",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "node",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "id",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "name",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "category",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "fileUrl",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "trustCenterVisibility",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "createdAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "updatedAt",
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
};
|
|
||||||
return {
|
|
||||||
"fragment": {
|
|
||||||
"argumentDefinitions": [
|
|
||||||
(v0/*: any*/),
|
|
||||||
(v1/*: any*/)
|
|
||||||
],
|
|
||||||
"kind": "Fragment",
|
|
||||||
"metadata": null,
|
|
||||||
"name": "TrustCenterFileGraphCreateMutation",
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": (v2/*: any*/),
|
|
||||||
"concreteType": "CreateTrustCenterFilePayload",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "createTrustCenterFile",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
(v3/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type": "Mutation",
|
|
||||||
"abstractKey": null
|
|
||||||
},
|
|
||||||
"kind": "Request",
|
|
||||||
"operation": {
|
|
||||||
"argumentDefinitions": [
|
|
||||||
(v1/*: any*/),
|
|
||||||
(v0/*: any*/)
|
|
||||||
],
|
|
||||||
"kind": "Operation",
|
|
||||||
"name": "TrustCenterFileGraphCreateMutation",
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": (v2/*: any*/),
|
|
||||||
"concreteType": "CreateTrustCenterFilePayload",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "createTrustCenterFile",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
(v3/*: any*/),
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"filters": null,
|
|
||||||
"handle": "prependEdge",
|
|
||||||
"key": "",
|
|
||||||
"kind": "LinkedHandle",
|
|
||||||
"name": "trustCenterFileEdge",
|
|
||||||
"handleArgs": [
|
|
||||||
{
|
|
||||||
"kind": "Variable",
|
|
||||||
"name": "connections",
|
|
||||||
"variableName": "connections"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"params": {
|
|
||||||
"cacheID": "57c42327b83556d36745cf8218eb01b1",
|
|
||||||
"id": null,
|
|
||||||
"metadata": {},
|
|
||||||
"name": "TrustCenterFileGraphCreateMutation",
|
|
||||||
"operationKind": "mutation",
|
|
||||||
"text": "mutation TrustCenterFileGraphCreateMutation(\n $input: CreateTrustCenterFileInput!\n) {\n createTrustCenterFile(input: $input) {\n trustCenterFileEdge {\n node {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n }\n }\n }\n}\n"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
(node as any).hash = "fa3851bf4f5e38bc26d8a063d6afab4e";
|
|
||||||
|
|
||||||
export default node;
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/**
|
|
||||||
* @generated SignedSource<<981cc2a2716995f5e1f22d2554598992>>
|
|
||||||
* @lightSyntaxTransform
|
|
||||||
* @nogrep
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
|
||||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
|
||||||
export type UpdateTrustCenterFileInput = {
|
|
||||||
category?: string | null | undefined;
|
|
||||||
id: string;
|
|
||||||
name?: string | null | undefined;
|
|
||||||
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphUpdateMutation$variables = {
|
|
||||||
input: UpdateTrustCenterFileInput;
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphUpdateMutation$data = {
|
|
||||||
readonly updateTrustCenterFile: {
|
|
||||||
readonly trustCenterFile: {
|
|
||||||
readonly category: string;
|
|
||||||
readonly id: string;
|
|
||||||
readonly name: string;
|
|
||||||
readonly trustCenterVisibility: TrustCenterVisibility;
|
|
||||||
readonly updatedAt: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
export type TrustCenterFileGraphUpdateMutation = {
|
|
||||||
response: TrustCenterFileGraphUpdateMutation$data;
|
|
||||||
variables: TrustCenterFileGraphUpdateMutation$variables;
|
|
||||||
};
|
|
||||||
|
|
||||||
const node: ConcreteRequest = (function(){
|
|
||||||
var v0 = [
|
|
||||||
{
|
|
||||||
"defaultValue": null,
|
|
||||||
"kind": "LocalArgument",
|
|
||||||
"name": "input"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
v1 = [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"kind": "Variable",
|
|
||||||
"name": "input",
|
|
||||||
"variableName": "input"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"concreteType": "UpdateTrustCenterFilePayload",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "updateTrustCenterFile",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFile",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "trustCenterFile",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "id",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "name",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "category",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "trustCenterVisibility",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "updatedAt",
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
];
|
|
||||||
return {
|
|
||||||
"fragment": {
|
|
||||||
"argumentDefinitions": (v0/*: any*/),
|
|
||||||
"kind": "Fragment",
|
|
||||||
"metadata": null,
|
|
||||||
"name": "TrustCenterFileGraphUpdateMutation",
|
|
||||||
"selections": (v1/*: any*/),
|
|
||||||
"type": "Mutation",
|
|
||||||
"abstractKey": null
|
|
||||||
},
|
|
||||||
"kind": "Request",
|
|
||||||
"operation": {
|
|
||||||
"argumentDefinitions": (v0/*: any*/),
|
|
||||||
"kind": "Operation",
|
|
||||||
"name": "TrustCenterFileGraphUpdateMutation",
|
|
||||||
"selections": (v1/*: any*/)
|
|
||||||
},
|
|
||||||
"params": {
|
|
||||||
"cacheID": "9ad761d91cfe34e7fa905a3f6a4d9e37",
|
|
||||||
"id": null,
|
|
||||||
"metadata": {},
|
|
||||||
"name": "TrustCenterFileGraphUpdateMutation",
|
|
||||||
"operationKind": "mutation",
|
|
||||||
"text": "mutation TrustCenterFileGraphUpdateMutation(\n $input: UpdateTrustCenterFileInput!\n) {\n updateTrustCenterFile(input: $input) {\n trustCenterFile {\n id\n name\n category\n trustCenterVisibility\n updatedAt\n }\n }\n}\n"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
|
|
||||||
(node as any).hash = "7306c3f9530a7636adc0b6a0cf28b67e";
|
|
||||||
|
|
||||||
export default node;
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<0f4473cdf4275afaab6b6825f6b6d546>>
|
* @generated SignedSource<<2d62f164c109bbc5fa46add3bd2dbf23>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -36,15 +36,6 @@ export type TrustCenterGraphQuery$data = {
|
|||||||
readonly ndaFileUrl: string | null | undefined;
|
readonly ndaFileUrl: string | null | undefined;
|
||||||
readonly updatedAt: string;
|
readonly updatedAt: string;
|
||||||
} | null | undefined;
|
} | null | undefined;
|
||||||
readonly trustCenterFiles?: {
|
|
||||||
readonly __id: string;
|
|
||||||
readonly edges: ReadonlyArray<{
|
|
||||||
readonly node: {
|
|
||||||
readonly id: string;
|
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterFilesCardFragment">;
|
|
||||||
};
|
|
||||||
}>;
|
|
||||||
};
|
|
||||||
readonly vendors?: {
|
readonly vendors?: {
|
||||||
readonly edges: ReadonlyArray<{
|
readonly edges: ReadonlyArray<{
|
||||||
readonly node: {
|
readonly node: {
|
||||||
@@ -129,13 +120,6 @@ v6 = {
|
|||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v7 = {
|
v7 = {
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "updatedAt",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v8 = {
|
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"concreteType": "TrustCenter",
|
"concreteType": "TrustCenter",
|
||||||
@@ -166,7 +150,13 @@ v8 = {
|
|||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v6/*: any*/),
|
(v6/*: any*/),
|
||||||
(v7/*: any*/),
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "updatedAt",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"alias": "canUpdate",
|
"alias": "canUpdate",
|
||||||
"args": [
|
"args": [
|
||||||
@@ -248,71 +238,13 @@ v8 = {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v9 = [
|
v8 = [
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
"value": 100
|
"value": 100
|
||||||
}
|
}
|
||||||
],
|
];
|
||||||
v10 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "__typename",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v11 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "cursor",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v12 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "PageInfo",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "pageInfo",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "endCursor",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "hasNextPage",
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v13 = {
|
|
||||||
"kind": "ClientExtension",
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "__id",
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
v14 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "category",
|
|
||||||
"storageKey": null
|
|
||||||
};
|
|
||||||
return {
|
return {
|
||||||
"fragment": {
|
"fragment": {
|
||||||
"argumentDefinitions": (v0/*: any*/),
|
"argumentDefinitions": (v0/*: any*/),
|
||||||
@@ -335,10 +267,10 @@ return {
|
|||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
(v8/*: any*/),
|
(v7/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v9/*: any*/),
|
"args": (v8/*: any*/),
|
||||||
"concreteType": "VendorConnection",
|
"concreteType": "VendorConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "vendors",
|
"name": "vendors",
|
||||||
@@ -374,49 +306,6 @@ return {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": "vendors(first:100)"
|
"storageKey": "vendors(first:100)"
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": "trustCenterFiles",
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFileConnection",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "__TrustCenterPage_trustCenterFiles_connection",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFileEdge",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "edges",
|
|
||||||
"plural": true,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFile",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "node",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
(v2/*: any*/),
|
|
||||||
{
|
|
||||||
"args": null,
|
|
||||||
"kind": "FragmentSpread",
|
|
||||||
"name": "TrustCenterFilesCardFragment"
|
|
||||||
},
|
|
||||||
(v10/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v11/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v12/*: any*/),
|
|
||||||
(v13/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "Organization",
|
"type": "Organization",
|
||||||
@@ -443,7 +332,13 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v10/*: any*/),
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "__typename",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
@@ -451,10 +346,10 @@ return {
|
|||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
(v8/*: any*/),
|
(v7/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v9/*: any*/),
|
"args": (v8/*: any*/),
|
||||||
"concreteType": "VendorConnection",
|
"concreteType": "VendorConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "vendors",
|
"name": "vendors",
|
||||||
@@ -478,7 +373,13 @@ return {
|
|||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
(v14/*: any*/),
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "category",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -515,97 +416,6 @@ return {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": "vendors(first:100)"
|
"storageKey": "vendors(first:100)"
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": (v9/*: any*/),
|
|
||||||
"concreteType": "TrustCenterFileConnection",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "trustCenterFiles",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFileEdge",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "edges",
|
|
||||||
"plural": true,
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"concreteType": "TrustCenterFile",
|
|
||||||
"kind": "LinkedField",
|
|
||||||
"name": "node",
|
|
||||||
"plural": false,
|
|
||||||
"selections": [
|
|
||||||
(v2/*: any*/),
|
|
||||||
(v3/*: any*/),
|
|
||||||
(v14/*: any*/),
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "fileUrl",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "trustCenterVisibility",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v6/*: any*/),
|
|
||||||
(v7/*: any*/),
|
|
||||||
{
|
|
||||||
"alias": "canUpdate",
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"kind": "Literal",
|
|
||||||
"name": "action",
|
|
||||||
"value": "core:trust-center-file:update"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "permission",
|
|
||||||
"storageKey": "permission(action:\"core:trust-center-file:update\")"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": "canDelete",
|
|
||||||
"args": [
|
|
||||||
{
|
|
||||||
"kind": "Literal",
|
|
||||||
"name": "action",
|
|
||||||
"value": "core:trust-center-file:delete"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "permission",
|
|
||||||
"storageKey": "permission(action:\"core:trust-center-file:delete\")"
|
|
||||||
},
|
|
||||||
(v10/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v11/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v12/*: any*/),
|
|
||||||
(v13/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": "trustCenterFiles(first:100)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": (v9/*: any*/),
|
|
||||||
"filters": null,
|
|
||||||
"handle": "connection",
|
|
||||||
"key": "TrustCenterPage_trustCenterFiles",
|
|
||||||
"kind": "LinkedHandle",
|
|
||||||
"name": "trustCenterFiles"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"type": "Organization",
|
"type": "Organization",
|
||||||
@@ -617,28 +427,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "ae3ba021303da59b774b89df514bd91e",
|
"cacheID": "050ad842df04d5130394e7b0a052bf69",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {
|
"metadata": {},
|
||||||
"connection": [
|
|
||||||
{
|
|
||||||
"count": null,
|
|
||||||
"cursor": null,
|
|
||||||
"direction": "forward",
|
|
||||||
"path": [
|
|
||||||
"organization",
|
|
||||||
"trustCenterFiles"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"name": "TrustCenterGraphQuery",
|
"name": "TrustCenterGraphQuery",
|
||||||
"operationKind": "query",
|
"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 canCreateReference: permission(action: \"core:trust-center-reference:create\")\n canCreateAccess: permission(action: \"core:trust-center-access:create\")\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 }\n id\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 canUpdate: permission(action: \"core:vendor:update\")\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 canCreateAccess: permission(action: \"core:trust-center-access:create\")\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n canUpdate: permission(action: \"core:vendor:update\")\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "abd5b3222d2bd168213a8ede829b4881";
|
(node as any).hash = "4804fdce46976e5597cb1fa263686b8e";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,241 +0,0 @@
|
|||||||
import { formatDate, getTrustCenterVisibilityOptions, sprintf } from "@probo/helpers";
|
|
||||||
import { useTranslate } from "@probo/i18n";
|
|
||||||
import {
|
|
||||||
Badge,
|
|
||||||
Button,
|
|
||||||
Field,
|
|
||||||
IconArrowLink,
|
|
||||||
IconChevronDown,
|
|
||||||
IconPencil,
|
|
||||||
IconTrashCan,
|
|
||||||
Option,
|
|
||||||
Table,
|
|
||||||
Tbody,
|
|
||||||
Td,
|
|
||||||
Th,
|
|
||||||
Thead,
|
|
||||||
Tr,
|
|
||||||
} from "@probo/ui";
|
|
||||||
import { useCallback, useMemo, useState } from "react";
|
|
||||||
import { useFragment } from "react-relay";
|
|
||||||
import { graphql } from "relay-runtime";
|
|
||||||
|
|
||||||
import type {
|
|
||||||
TrustCenterFilesCardFragment$data,
|
|
||||||
TrustCenterFilesCardFragment$key,
|
|
||||||
} from "#/__generated__/core/TrustCenterFilesCardFragment.graphql";
|
|
||||||
|
|
||||||
const trustCenterFileFragment = graphql`
|
|
||||||
fragment TrustCenterFilesCardFragment on TrustCenterFile {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
category
|
|
||||||
fileUrl
|
|
||||||
trustCenterVisibility
|
|
||||||
createdAt
|
|
||||||
updatedAt
|
|
||||||
canUpdate: permission(action: "core:trust-center-file:update")
|
|
||||||
canDelete: permission(action: "core:trust-center-file:delete")
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
type Mutation<Params> = (p: {
|
|
||||||
variables: {
|
|
||||||
input: {
|
|
||||||
id: string;
|
|
||||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
|
||||||
} & Params;
|
|
||||||
};
|
|
||||||
}) => Promise<void>;
|
|
||||||
|
|
||||||
type Props<Params> = {
|
|
||||||
files: TrustCenterFilesCardFragment$key[];
|
|
||||||
params: Params;
|
|
||||||
disabled?: boolean;
|
|
||||||
onChangeVisibility: Mutation<Params>;
|
|
||||||
onEdit: (file: { id: string; name: string; category: string }) => void;
|
|
||||||
onDelete: (id: string) => void;
|
|
||||||
canUpdate: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export function TrustCenterFilesCard<Params>(props: Props<Params>) {
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
const [limit, setLimit] = useState<number | null>(100);
|
|
||||||
const files = useMemo(() => {
|
|
||||||
return limit ? props.files.slice(0, limit) : props.files;
|
|
||||||
}, [props.files, limit]);
|
|
||||||
const showMoreButton = limit !== null && props.files.length > limit;
|
|
||||||
|
|
||||||
const onChangeVisibility = async (
|
|
||||||
fileId: string,
|
|
||||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
|
||||||
) => {
|
|
||||||
await props.onChangeVisibility({
|
|
||||||
variables: {
|
|
||||||
input: {
|
|
||||||
id: fileId,
|
|
||||||
trustCenterVisibility,
|
|
||||||
...props.params,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-[10px]">
|
|
||||||
<Table>
|
|
||||||
<Thead>
|
|
||||||
<Tr>
|
|
||||||
<Th>{__("Name")}</Th>
|
|
||||||
<Th>{__("Category")}</Th>
|
|
||||||
<Th>{__("Upload Date")}</Th>
|
|
||||||
<Th>{__("Visibility")}</Th>
|
|
||||||
<Th></Th>
|
|
||||||
</Tr>
|
|
||||||
</Thead>
|
|
||||||
<Tbody>
|
|
||||||
{files.length === 0 && (
|
|
||||||
<Tr>
|
|
||||||
<Td colSpan={5} className="text-center text-txt-secondary">
|
|
||||||
{__("No files available")}
|
|
||||||
</Td>
|
|
||||||
</Tr>
|
|
||||||
)}
|
|
||||||
{files.map((fileFragmentRef, index) => (
|
|
||||||
<FileRowWrapper
|
|
||||||
key={index}
|
|
||||||
fileFragmentRef={fileFragmentRef}
|
|
||||||
onChangeVisibility={onChangeVisibility}
|
|
||||||
onEdit={props.onEdit}
|
|
||||||
onDelete={props.onDelete}
|
|
||||||
disabled={props.disabled}
|
|
||||||
canUpdate={props.canUpdate}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Tbody>
|
|
||||||
</Table>
|
|
||||||
{showMoreButton && (
|
|
||||||
<Button
|
|
||||||
variant="tertiary"
|
|
||||||
onClick={() => setLimit(null)}
|
|
||||||
className="mt-3 mx-auto"
|
|
||||||
icon={IconChevronDown}
|
|
||||||
>
|
|
||||||
{sprintf(__("Show %s more"), props.files.length - limit)}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FileRowWrapper(props: {
|
|
||||||
fileFragmentRef: TrustCenterFilesCardFragment$key;
|
|
||||||
onChangeVisibility: (
|
|
||||||
fileId: string,
|
|
||||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
|
||||||
) => Promise<void>;
|
|
||||||
onEdit: (file: { id: string; name: string; category: string }) => void;
|
|
||||||
onDelete: (id: string) => void;
|
|
||||||
disabled?: boolean;
|
|
||||||
canUpdate: boolean;
|
|
||||||
}) {
|
|
||||||
const file = useFragment(trustCenterFileFragment, props.fileFragmentRef);
|
|
||||||
return (
|
|
||||||
<FileRow
|
|
||||||
file={file}
|
|
||||||
onChangeVisibility={props.onChangeVisibility}
|
|
||||||
onEdit={props.onEdit}
|
|
||||||
onDelete={props.onDelete}
|
|
||||||
disabled={props.disabled}
|
|
||||||
canUpdate={props.canUpdate}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function FileRow(props: {
|
|
||||||
file: TrustCenterFilesCardFragment$data;
|
|
||||||
onChangeVisibility: (
|
|
||||||
fileId: string,
|
|
||||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC",
|
|
||||||
) => Promise<void>;
|
|
||||||
onEdit: (file: { id: string; name: string; category: string }) => void;
|
|
||||||
onDelete: (id: string) => void;
|
|
||||||
disabled?: boolean;
|
|
||||||
canUpdate: boolean;
|
|
||||||
}) {
|
|
||||||
const { file, onChangeVisibility, onEdit, onDelete, disabled, canUpdate }
|
|
||||||
= props;
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
|
|
||||||
const handleValueChange = useCallback(
|
|
||||||
async (value: string) => {
|
|
||||||
const stringValue = typeof value === "string" ? value : "";
|
|
||||||
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
|
||||||
await onChangeVisibility(file.id, typedValue);
|
|
||||||
},
|
|
||||||
[file.id, onChangeVisibility],
|
|
||||||
);
|
|
||||||
|
|
||||||
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Tr>
|
|
||||||
<Td>
|
|
||||||
<div className="flex gap-4 items-center">{file.name}</div>
|
|
||||||
</Td>
|
|
||||||
<Td>{file.category}</Td>
|
|
||||||
<Td>{formatDate(file.createdAt)}</Td>
|
|
||||||
<Td noLink width={130} className="pr-0">
|
|
||||||
<Field
|
|
||||||
type="select"
|
|
||||||
value={file.trustCenterVisibility}
|
|
||||||
onValueChange={value => void handleValueChange(value)}
|
|
||||||
disabled={disabled || !canUpdate}
|
|
||||||
className="w-[105px]"
|
|
||||||
>
|
|
||||||
{visibilityOptions.map(option => (
|
|
||||||
<Option key={option.value} value={option.value}>
|
|
||||||
<div className="flex items-center justify-between w-full">
|
|
||||||
<Badge variant={option.variant}>{option.label}</Badge>
|
|
||||||
</div>
|
|
||||||
</Option>
|
|
||||||
))}
|
|
||||||
</Field>
|
|
||||||
</Td>
|
|
||||||
<Td noLink width={120}>
|
|
||||||
<div className="flex gap-2">
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
icon={IconArrowLink}
|
|
||||||
onClick={() =>
|
|
||||||
window.open(file.fileUrl, "_blank", "noopener,noreferrer")}
|
|
||||||
title={__("Download")}
|
|
||||||
/>
|
|
||||||
{file.canUpdate && (
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
icon={IconPencil}
|
|
||||||
onClick={() =>
|
|
||||||
onEdit({
|
|
||||||
id: file.id,
|
|
||||||
name: file.name,
|
|
||||||
category: file.category,
|
|
||||||
})}
|
|
||||||
disabled={disabled}
|
|
||||||
title={__("Edit")}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{file.canDelete && (
|
|
||||||
<Button
|
|
||||||
variant="danger"
|
|
||||||
icon={IconTrashCan}
|
|
||||||
onClick={() => onDelete(file.id)}
|
|
||||||
disabled={disabled}
|
|
||||||
title={__("Delete")}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Td>
|
|
||||||
</Tr>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
import { graphql } from "relay-runtime";
|
|
||||||
|
|
||||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
|
||||||
|
|
||||||
export const createTrustCenterFileMutation = graphql`
|
|
||||||
mutation TrustCenterFileGraphCreateMutation(
|
|
||||||
$input: CreateTrustCenterFileInput!
|
|
||||||
$connections: [ID!]!
|
|
||||||
) {
|
|
||||||
createTrustCenterFile(input: $input) {
|
|
||||||
trustCenterFileEdge @prependEdge(connections: $connections) {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
category
|
|
||||||
fileUrl
|
|
||||||
trustCenterVisibility
|
|
||||||
createdAt
|
|
||||||
updatedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export function useCreateTrustCenterFileMutation() {
|
|
||||||
return useMutationWithToasts(
|
|
||||||
createTrustCenterFileMutation,
|
|
||||||
{
|
|
||||||
successMessage: "File uploaded successfully",
|
|
||||||
errorMessage: "Failed to upload file",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const updateTrustCenterFileMutation = graphql`
|
|
||||||
mutation TrustCenterFileGraphUpdateMutation($input: UpdateTrustCenterFileInput!) {
|
|
||||||
updateTrustCenterFile(input: $input) {
|
|
||||||
trustCenterFile {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
category
|
|
||||||
trustCenterVisibility
|
|
||||||
updatedAt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export function useUpdateTrustCenterFileMutation() {
|
|
||||||
return useMutationWithToasts(
|
|
||||||
updateTrustCenterFileMutation,
|
|
||||||
{
|
|
||||||
successMessage: "File updated successfully",
|
|
||||||
errorMessage: "Failed to update file",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const deleteTrustCenterFileMutation = graphql`
|
|
||||||
mutation TrustCenterFileGraphDeleteMutation(
|
|
||||||
$input: DeleteTrustCenterFileInput!
|
|
||||||
$connections: [ID!]!
|
|
||||||
) {
|
|
||||||
deleteTrustCenterFile(input: $input) {
|
|
||||||
deletedTrustCenterFileId @deleteEdge(connections: $connections)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export function useDeleteTrustCenterFileMutation() {
|
|
||||||
return useMutationWithToasts(
|
|
||||||
deleteTrustCenterFileMutation,
|
|
||||||
{
|
|
||||||
successMessage: "File deleted successfully",
|
|
||||||
errorMessage: "Failed to delete file",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -40,16 +40,6 @@ export const trustCenterQuery = graphql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trustCenterFiles(first: 100)
|
|
||||||
@connection(key: "TrustCenterPage_trustCenterFiles") {
|
|
||||||
__id
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
...TrustCenterFilesCardFragment
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Button, IconPlusLarge, useDialogRef } from "@probo/ui";
|
||||||
|
import { ConnectionHandler, graphql, type PreloadedQuery, usePreloadedQuery } from "react-relay";
|
||||||
|
|
||||||
|
import type { CompliancePageFilesPageQuery } from "#/__generated__/core/CompliancePageFilesPageQuery.graphql";
|
||||||
|
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||||
|
|
||||||
|
import { CompliancePageFileList } from "./_components/CompliancePageFileList";
|
||||||
|
import { NewCompliancePageFileDialog } from "./_components/NewCompliancePageFileDialog";
|
||||||
|
|
||||||
|
export const compliancePageFilesPageQuery = graphql`
|
||||||
|
query CompliancePageFilesPageQuery($organizationId: ID!) {
|
||||||
|
organization: node(id: $organizationId) {
|
||||||
|
... on Organization {
|
||||||
|
canCreateTrustCenterFile: permission(action: "core:trust-center-file:create")
|
||||||
|
}
|
||||||
|
...CompliancePageFileListFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function CompliancePageFilesPage(props: {
|
||||||
|
queryRef: PreloadedQuery<CompliancePageFilesPageQuery>;
|
||||||
|
}) {
|
||||||
|
const { queryRef } = props;
|
||||||
|
|
||||||
|
const organizationId = useOrganizationId();
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
const createDialogRef = useDialogRef();
|
||||||
|
|
||||||
|
const { organization } = usePreloadedQuery<CompliancePageFilesPageQuery>(compliancePageFilesPageQuery, queryRef);
|
||||||
|
|
||||||
|
const filesConnectionId = ConnectionHandler.getConnectionID(
|
||||||
|
organizationId,
|
||||||
|
"CompliancePageFileList_trustCenterFiles",
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<h3 className="text-base font-medium">{__("Files")}</h3>
|
||||||
|
<p className="text-sm text-txt-tertiary">
|
||||||
|
{__("Upload and manage files for your trust center")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{organization.canCreateTrustCenterFile && (
|
||||||
|
<Button
|
||||||
|
icon={IconPlusLarge}
|
||||||
|
onClick={() => createDialogRef.current?.open()}
|
||||||
|
>
|
||||||
|
{__("Add File")}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<CompliancePageFileList fragmentRef={organization} />
|
||||||
|
|
||||||
|
<NewCompliancePageFileDialog
|
||||||
|
connectionId={filesConnectionId}
|
||||||
|
ref={createDialogRef}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import { useEffect } from "react";
|
||||||
|
import { useQueryLoader } from "react-relay";
|
||||||
|
|
||||||
|
import type { CompliancePageFilesPageQuery } from "#/__generated__/core/CompliancePageFilesPageQuery.graphql";
|
||||||
|
import { LinkCardSkeleton } from "#/components/skeletons/LinkCardSkeleton";
|
||||||
|
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||||
|
import { CoreRelayProvider } from "#/providers/CoreRelayProvider";
|
||||||
|
|
||||||
|
import { CompliancePageFilesPage, compliancePageFilesPageQuery } from "./CompliancePageFilesPage";
|
||||||
|
|
||||||
|
function CompliancePageFilesPageQueryLoader() {
|
||||||
|
const organizationId = useOrganizationId();
|
||||||
|
const [queryRef, loadQuery] = useQueryLoader<CompliancePageFilesPageQuery>(compliancePageFilesPageQuery);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!queryRef) {
|
||||||
|
loadQuery({ organizationId });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!queryRef) return <LinkCardSkeleton />;
|
||||||
|
|
||||||
|
return <CompliancePageFilesPage queryRef={queryRef} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function CompliancePageFilesPageLoader() {
|
||||||
|
return (
|
||||||
|
<CoreRelayProvider>
|
||||||
|
<CompliancePageFilesPageQueryLoader />
|
||||||
|
</CoreRelayProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import { sprintf } from "@probo/helpers";
|
||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Button, IconChevronDown, Table, Tbody, Td, Th, Thead, Tr, useDialogRef } from "@probo/ui";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import { useFragment } from "react-relay";
|
||||||
|
import { graphql } from "relay-runtime";
|
||||||
|
|
||||||
|
import type { CompliancePageFileListFragment$key } from "#/__generated__/core/CompliancePageFileListFragment.graphql";
|
||||||
|
import type { CompliancePageFileListItem_fileFragment$data } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql";
|
||||||
|
|
||||||
|
import { CompliancePageFileListItem } from "./CompliancePageFileListItem";
|
||||||
|
import { DeleteCompliancePageFileDialog } from "./DeleteCompliancePageFileDialog";
|
||||||
|
import { EditCompliancePageFileDialog } from "./EditCompliancePageFileDialog";
|
||||||
|
|
||||||
|
const fragment = graphql`
|
||||||
|
fragment CompliancePageFileListFragment on Organization {
|
||||||
|
compliancePage: trustCenter @required(action: THROW) {
|
||||||
|
...CompliancePageFileListItem_compliancePageFragment
|
||||||
|
}
|
||||||
|
trustCenterFiles(first: 1000)
|
||||||
|
@connection(key: "CompliancePageFileList_trustCenterFiles") {
|
||||||
|
__id
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
...CompliancePageFileListItem_fileFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function CompliancePageFileList(props: { fragmentRef: CompliancePageFileListFragment$key }) {
|
||||||
|
const { fragmentRef } = props;
|
||||||
|
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
const deleteDialogRef = useDialogRef();
|
||||||
|
|
||||||
|
const {
|
||||||
|
compliancePage,
|
||||||
|
trustCenterFiles: files,
|
||||||
|
} = useFragment<CompliancePageFileListFragment$key>(fragment, fragmentRef);
|
||||||
|
|
||||||
|
const [limit, setLimit] = useState<number | null>(100);
|
||||||
|
const showMoreButton = limit !== null && files.edges.length > limit;
|
||||||
|
|
||||||
|
const [editingFile, setEditingFile] = useState<
|
||||||
|
CompliancePageFileListItem_fileFragment$data | null>(null);
|
||||||
|
const [deletingFileId, setDeletingFileId] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const handleDelete = useCallback(
|
||||||
|
(id: string) => {
|
||||||
|
setDeletingFileId(id);
|
||||||
|
deleteDialogRef.current?.open();
|
||||||
|
},
|
||||||
|
[deleteDialogRef],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="space-y-[10px]">
|
||||||
|
<Table>
|
||||||
|
<Thead>
|
||||||
|
<Tr>
|
||||||
|
<Th>{__("Name")}</Th>
|
||||||
|
<Th>{__("Category")}</Th>
|
||||||
|
<Th>{__("Upload Date")}</Th>
|
||||||
|
<Th>{__("Visibility")}</Th>
|
||||||
|
<Th></Th>
|
||||||
|
</Tr>
|
||||||
|
</Thead>
|
||||||
|
<Tbody>
|
||||||
|
{files.edges.length === 0 && (
|
||||||
|
<Tr>
|
||||||
|
<Td colSpan={5} className="text-center text-txt-secondary">
|
||||||
|
{__("No files available")}
|
||||||
|
</Td>
|
||||||
|
</Tr>
|
||||||
|
)}
|
||||||
|
{files.edges.map(({ node: file }) => (
|
||||||
|
<CompliancePageFileListItem
|
||||||
|
key={file.id}
|
||||||
|
compliancePageFragmentRef={compliancePage}
|
||||||
|
fileFragmentRef={file}
|
||||||
|
onEdit={setEditingFile}
|
||||||
|
onDelete={handleDelete}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Tbody>
|
||||||
|
</Table>
|
||||||
|
{showMoreButton && (
|
||||||
|
<Button
|
||||||
|
variant="tertiary"
|
||||||
|
onClick={() => setLimit(null)}
|
||||||
|
className="mt-3 mx-auto"
|
||||||
|
icon={IconChevronDown}
|
||||||
|
>
|
||||||
|
{sprintf(__("Show %s more"), files.edges.length - limit)}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{editingFile
|
||||||
|
&& (
|
||||||
|
<EditCompliancePageFileDialog
|
||||||
|
file={editingFile}
|
||||||
|
onClose={() => setEditingFile(null)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<DeleteCompliancePageFileDialog
|
||||||
|
connectionId={files.__id}
|
||||||
|
fileId={deletingFileId}
|
||||||
|
ref={deleteDialogRef}
|
||||||
|
onDelete={() => setDeletingFileId(null)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import { formatDate, getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Badge, Button, Field, IconArrowLink, IconPencil, IconTrashCan, Option, Td, Tr } from "@probo/ui";
|
||||||
|
import { useCallback } from "react";
|
||||||
|
import { useFragment } from "react-relay";
|
||||||
|
import { graphql } from "relay-runtime";
|
||||||
|
|
||||||
|
import type { CompliancePageFileListItem_compliancePageFragment$key } from "#/__generated__/core/CompliancePageFileListItem_compliancePageFragment.graphql";
|
||||||
|
import type { CompliancePageFileListItem_fileFragment$data, CompliancePageFileListItem_fileFragment$key } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql";
|
||||||
|
import type { CompliancePageFileListItemMutation } from "#/__generated__/core/CompliancePageFileListItemMutation.graphql";
|
||||||
|
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||||
|
|
||||||
|
const compliancePageFragment = graphql`
|
||||||
|
fragment CompliancePageFileListItem_compliancePageFragment on TrustCenter {
|
||||||
|
canUpdate: permission(action: "core:trust-center:update")
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const fileFragment = graphql`
|
||||||
|
fragment CompliancePageFileListItem_fileFragment on TrustCenterFile {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
category
|
||||||
|
fileUrl
|
||||||
|
trustCenterVisibility
|
||||||
|
createdAt
|
||||||
|
canUpdate: permission(action: "core:trust-center-file:update")
|
||||||
|
canDelete: permission(action: "core:trust-center-file:delete")
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const updateCompliancePageFileMutation = graphql`
|
||||||
|
mutation CompliancePageFileListItemMutation($input: UpdateTrustCenterFileInput!) {
|
||||||
|
updateTrustCenterFile(input: $input) {
|
||||||
|
trustCenterFile {
|
||||||
|
...CompliancePageFileListItem_fileFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function CompliancePageFileListItem(props: {
|
||||||
|
compliancePageFragmentRef: CompliancePageFileListItem_compliancePageFragment$key;
|
||||||
|
fileFragmentRef: CompliancePageFileListItem_fileFragment$key;
|
||||||
|
onEdit: (file: CompliancePageFileListItem_fileFragment$data) => void;
|
||||||
|
onDelete: (id: string) => void;
|
||||||
|
}) {
|
||||||
|
const { compliancePageFragmentRef, fileFragmentRef, onEdit, onDelete } = props;
|
||||||
|
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||||
|
|
||||||
|
const compliancePage = useFragment<CompliancePageFileListItem_compliancePageFragment$key>(
|
||||||
|
compliancePageFragment,
|
||||||
|
compliancePageFragmentRef,
|
||||||
|
);
|
||||||
|
const file = useFragment<CompliancePageFileListItem_fileFragment$key>(fileFragment, fileFragmentRef);
|
||||||
|
|
||||||
|
const [updateFile, isUpdating] = useMutationWithToasts<CompliancePageFileListItemMutation>(
|
||||||
|
updateCompliancePageFileMutation,
|
||||||
|
{
|
||||||
|
successMessage: "File updated successfully",
|
||||||
|
errorMessage: "Failed to update file",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleValueChange = useCallback(
|
||||||
|
async (value: string) => {
|
||||||
|
const stringValue = typeof value === "string" ? value : "";
|
||||||
|
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
await updateFile({
|
||||||
|
variables: {
|
||||||
|
input: {
|
||||||
|
id: file.id,
|
||||||
|
trustCenterVisibility: typedValue,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[file.id, updateFile],
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tr>
|
||||||
|
<Td>
|
||||||
|
<div className="flex gap-4 items-center">{file.name}</div>
|
||||||
|
</Td>
|
||||||
|
<Td>{file.category}</Td>
|
||||||
|
<Td>{formatDate(file.createdAt)}</Td>
|
||||||
|
<Td noLink width={130} className="pr-0">
|
||||||
|
<Field
|
||||||
|
type="select"
|
||||||
|
value={file.trustCenterVisibility}
|
||||||
|
onValueChange={value => void handleValueChange(value)}
|
||||||
|
disabled={isUpdating || !compliancePage.canUpdate}
|
||||||
|
className="w-[105px]"
|
||||||
|
>
|
||||||
|
{visibilityOptions.map(option => (
|
||||||
|
<Option key={option.value} value={option.value}>
|
||||||
|
<div className="flex items-center justify-between w-full">
|
||||||
|
<Badge variant={option.variant}>{option.label}</Badge>
|
||||||
|
</div>
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Field>
|
||||||
|
</Td>
|
||||||
|
<Td noLink width={120}>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
icon={IconArrowLink}
|
||||||
|
onClick={() =>
|
||||||
|
window.open(file.fileUrl, "_blank", "noopener,noreferrer")}
|
||||||
|
title={__("Download")}
|
||||||
|
/>
|
||||||
|
{file.canUpdate && (
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
icon={IconPencil}
|
||||||
|
onClick={() => onEdit(file)}
|
||||||
|
disabled={isUpdating}
|
||||||
|
title={__("Edit")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{file.canDelete && (
|
||||||
|
<Button
|
||||||
|
variant="danger"
|
||||||
|
icon={IconTrashCan}
|
||||||
|
onClick={() => onDelete(file.id)}
|
||||||
|
disabled={isUpdating}
|
||||||
|
title={__("Delete")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</Td>
|
||||||
|
</Tr>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Button, Dialog, DialogContent, DialogFooter, type DialogRef, Spinner } from "@probo/ui";
|
||||||
|
import { useCallback } from "react";
|
||||||
|
import { type DataID, graphql } from "relay-runtime";
|
||||||
|
|
||||||
|
import type { DeleteCompliancePageFileDialogMutation } from "#/__generated__/core/DeleteCompliancePageFileDialogMutation.graphql";
|
||||||
|
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||||
|
|
||||||
|
const deleteCompliancePageFileMutation = graphql`
|
||||||
|
mutation DeleteCompliancePageFileDialogMutation(
|
||||||
|
$input: DeleteTrustCenterFileInput!
|
||||||
|
$connections: [ID!]!
|
||||||
|
) {
|
||||||
|
deleteTrustCenterFile(input: $input) {
|
||||||
|
deletedTrustCenterFileId @deleteEdge(connections: $connections)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function DeleteCompliancePageFileDialog(props: {
|
||||||
|
connectionId: DataID;
|
||||||
|
fileId: string | null;
|
||||||
|
ref: DialogRef;
|
||||||
|
onDelete: () => void;
|
||||||
|
}) {
|
||||||
|
const { connectionId, fileId, ref, onDelete } = props;
|
||||||
|
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
|
const [deleteFile, isDeleting] = useMutationWithToasts<DeleteCompliancePageFileDialogMutation>(
|
||||||
|
deleteCompliancePageFileMutation,
|
||||||
|
{
|
||||||
|
successMessage: "File deleted successfully",
|
||||||
|
errorMessage: "Failed to delete file",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleDelete = useCallback(async () => {
|
||||||
|
if (!fileId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await deleteFile({
|
||||||
|
variables: {
|
||||||
|
input: { id: fileId },
|
||||||
|
connections: connectionId ? [connectionId] : [],
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
ref.current?.close();
|
||||||
|
onDelete();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, [fileId, deleteFile, ref, connectionId, onDelete]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog ref={ref} title={__("Delete File")}>
|
||||||
|
<DialogContent padded>
|
||||||
|
<p>
|
||||||
|
{__(
|
||||||
|
"Are you sure you want to delete this file? This action cannot be undone.",
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogFooter>
|
||||||
|
<Button
|
||||||
|
variant="danger"
|
||||||
|
onClick={() => void handleDelete()}
|
||||||
|
disabled={isDeleting}
|
||||||
|
>
|
||||||
|
{isDeleting && <Spinner />}
|
||||||
|
{__("Delete")}
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Button, Dialog, DialogContent, DialogFooter, Field, Spinner } from "@probo/ui";
|
||||||
|
import { graphql } from "relay-runtime";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import type { CompliancePageFileListItem_fileFragment$data } from "#/__generated__/core/CompliancePageFileListItem_fileFragment.graphql";
|
||||||
|
import type { EditCompliancePageFileDialogMutation } from "#/__generated__/core/EditCompliancePageFileDialogMutation.graphql";
|
||||||
|
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
|
||||||
|
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||||
|
|
||||||
|
const updateCompliancePageFileMutation = graphql`
|
||||||
|
mutation EditCompliancePageFileDialogMutation($input: UpdateTrustCenterFileInput!) {
|
||||||
|
updateTrustCenterFile(input: $input) {
|
||||||
|
trustCenterFile {
|
||||||
|
...CompliancePageFileListItem_fileFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function EditCompliancePageFileDialog(props: {
|
||||||
|
file: CompliancePageFileListItem_fileFragment$data;
|
||||||
|
onClose: () => void;
|
||||||
|
}) {
|
||||||
|
const { file, onClose } = props;
|
||||||
|
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
|
const editSchema = z.object({
|
||||||
|
name: z.string().min(1, __("Name is required")),
|
||||||
|
category: z.string().min(1, __("Category is required")),
|
||||||
|
});
|
||||||
|
const editForm = useFormWithSchema(editSchema, {
|
||||||
|
defaultValues: { name: file.name, category: file.category },
|
||||||
|
});
|
||||||
|
|
||||||
|
const [updateFile, isUpdating] = useMutationWithToasts<EditCompliancePageFileDialogMutation>(
|
||||||
|
updateCompliancePageFileMutation,
|
||||||
|
{
|
||||||
|
successMessage: "File updated successfully",
|
||||||
|
errorMessage: "Failed to update file",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleUpdate = async (data: z.infer<typeof editSchema>) => {
|
||||||
|
await updateFile({
|
||||||
|
variables: {
|
||||||
|
input: {
|
||||||
|
id: file.id,
|
||||||
|
name: data.name,
|
||||||
|
category: data.category,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
onClose();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog defaultOpen={true} title={__("Edit File")} onClose={onClose}>
|
||||||
|
<form onSubmit={e => void editForm.handleSubmit(handleUpdate)(e)}>
|
||||||
|
<DialogContent padded className="space-y-4">
|
||||||
|
<Field
|
||||||
|
label={__("Name")}
|
||||||
|
type="text"
|
||||||
|
{...editForm.register("name")}
|
||||||
|
error={editForm.formState.errors.name?.message}
|
||||||
|
/>
|
||||||
|
<Field
|
||||||
|
label={__("Category")}
|
||||||
|
type="text"
|
||||||
|
{...editForm.register("category")}
|
||||||
|
error={editForm.formState.errors.category?.message}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogFooter>
|
||||||
|
<Button type="submit" disabled={isUpdating}>
|
||||||
|
{isUpdating && <Spinner />}
|
||||||
|
{__("Save")}
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</form>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
import { getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||||
|
import { useTranslate } from "@probo/i18n";
|
||||||
|
import { Badge, Button, Dialog, DialogContent, DialogFooter, type DialogRef, Dropzone, Field, Option, Spinner } from "@probo/ui";
|
||||||
|
import { useCallback, useState } from "react";
|
||||||
|
import { type DataID, graphql } from "relay-runtime";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import type { NewCompliancePageFileDialog_createMutation } from "#/__generated__/core/NewCompliancePageFileDialog_createMutation.graphql";
|
||||||
|
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
|
||||||
|
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||||
|
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||||
|
|
||||||
|
const acceptedFileTypes = {
|
||||||
|
"application/csv": [".csv"],
|
||||||
|
"application/json": [".json"],
|
||||||
|
"application/msword": [".doc"],
|
||||||
|
"application/pdf": [".pdf"],
|
||||||
|
"application/vnd.ms-excel": [".xls"],
|
||||||
|
"application/vnd.ms-powerpoint": [".ppt"],
|
||||||
|
"application/vnd.oasis.opendocument.presentation": [".odp"],
|
||||||
|
"application/vnd.oasis.opendocument.spreadsheet": [".ods"],
|
||||||
|
"application/vnd.oasis.opendocument.text": [".odt"],
|
||||||
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
||||||
|
".pptx",
|
||||||
|
],
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
|
||||||
|
".xlsx",
|
||||||
|
],
|
||||||
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
||||||
|
".docx",
|
||||||
|
],
|
||||||
|
"application/yaml": [".yaml", ".yml"],
|
||||||
|
"image/gif": [".gif"],
|
||||||
|
"image/jpeg": [".jpeg", ".jpg"],
|
||||||
|
"image/png": [".png"],
|
||||||
|
"image/svg+xml": [".svg"],
|
||||||
|
"image/webp": [".webp"],
|
||||||
|
"text/csv": [".csv"],
|
||||||
|
"text/json": [".json"],
|
||||||
|
"text/markdown": [".md"],
|
||||||
|
"text/plain": [".txt"],
|
||||||
|
"text/uri-list; charset=utf-8": [".uri"],
|
||||||
|
"text/uri-list": [".uri"],
|
||||||
|
"text/x-log": [".log"],
|
||||||
|
"text/yaml": [".yaml", ".yml"],
|
||||||
|
};
|
||||||
|
|
||||||
|
const createCompliancePageFileMutation = graphql`
|
||||||
|
mutation NewCompliancePageFileDialog_createMutation(
|
||||||
|
$input: CreateTrustCenterFileInput!
|
||||||
|
$connections: [ID!]!
|
||||||
|
) {
|
||||||
|
createTrustCenterFile(input: $input) {
|
||||||
|
trustCenterFileEdge @prependEdge(connections: $connections) {
|
||||||
|
node {
|
||||||
|
...CompliancePageFileListItem_fileFragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export function NewCompliancePageFileDialog(props: {
|
||||||
|
connectionId: DataID;
|
||||||
|
ref: DialogRef;
|
||||||
|
}) {
|
||||||
|
const { connectionId, ref } = props;
|
||||||
|
|
||||||
|
const organizationId = useOrganizationId();
|
||||||
|
const { __ } = useTranslate();
|
||||||
|
|
||||||
|
const [uploadedFile, setUploadedFile] = useState<File | null>(null);
|
||||||
|
|
||||||
|
const createSchema = z.object({
|
||||||
|
name: z.string().min(1, __("Name is required")),
|
||||||
|
category: z.string().min(1, __("Category is required")),
|
||||||
|
trustCenterVisibility: z.enum(["NONE", "PRIVATE", "PUBLIC"]),
|
||||||
|
});
|
||||||
|
const createForm = useFormWithSchema(createSchema, {
|
||||||
|
defaultValues: { name: "", category: "", trustCenterVisibility: "NONE" },
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleFileUpload = useCallback(
|
||||||
|
(acceptedFiles: File[]) => {
|
||||||
|
if (acceptedFiles.length > 0) {
|
||||||
|
const file = acceptedFiles[0];
|
||||||
|
|
||||||
|
if (!Object.keys(acceptedFileTypes).includes(file.type)) {
|
||||||
|
createForm.setError("root", {
|
||||||
|
type: "manual",
|
||||||
|
message: __("File type is not allowed"),
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setUploadedFile(file);
|
||||||
|
createForm.clearErrors("root");
|
||||||
|
if (!createForm.getValues().name) {
|
||||||
|
createForm.setValue("name", file.name.replace(/\.[^/.]+$/, ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[createForm, __],
|
||||||
|
);
|
||||||
|
|
||||||
|
const [createFile, isCreating] = useMutationWithToasts<NewCompliancePageFileDialog_createMutation>(
|
||||||
|
createCompliancePageFileMutation, {
|
||||||
|
successMessage: "File uploaded successfully",
|
||||||
|
errorMessage: "Failed to upload file",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const handleCreate = async (data: z.infer<typeof createSchema>) => {
|
||||||
|
if (!uploadedFile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await createFile({
|
||||||
|
variables: {
|
||||||
|
input: {
|
||||||
|
organizationId,
|
||||||
|
name: data.name,
|
||||||
|
category: data.category,
|
||||||
|
trustCenterVisibility: data.trustCenterVisibility,
|
||||||
|
file: null,
|
||||||
|
},
|
||||||
|
connections: connectionId ? [connectionId] : [],
|
||||||
|
},
|
||||||
|
uploadables: {
|
||||||
|
"input.file": uploadedFile,
|
||||||
|
},
|
||||||
|
onSuccess: () => {
|
||||||
|
ref.current?.close();
|
||||||
|
createForm.reset();
|
||||||
|
setUploadedFile(null);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog ref={ref} title={__("Add File")}>
|
||||||
|
<form onSubmit={e => void createForm.handleSubmit(handleCreate)(e)}>
|
||||||
|
<DialogContent padded className="space-y-4">
|
||||||
|
<Dropzone
|
||||||
|
description={__("Upload file (max 10MB)")}
|
||||||
|
isUploading={isCreating}
|
||||||
|
onDrop={handleFileUpload}
|
||||||
|
maxSize={10}
|
||||||
|
accept={acceptedFileTypes}
|
||||||
|
/>
|
||||||
|
{uploadedFile && (
|
||||||
|
<div className="text-sm text-txt-secondary">
|
||||||
|
{__("Selected file")}
|
||||||
|
:
|
||||||
|
{uploadedFile.name}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{createForm.formState.errors.root && (
|
||||||
|
<p className="text-sm text-txt-danger">
|
||||||
|
{createForm.formState.errors.root.message}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
<Field
|
||||||
|
label={__("Name")}
|
||||||
|
type="text"
|
||||||
|
{...createForm.register("name")}
|
||||||
|
error={createForm.formState.errors.name?.message}
|
||||||
|
/>
|
||||||
|
<Field
|
||||||
|
label={__("Category")}
|
||||||
|
type="text"
|
||||||
|
{...createForm.register("category")}
|
||||||
|
error={createForm.formState.errors.category?.message}
|
||||||
|
/>
|
||||||
|
<Field
|
||||||
|
label={__("Visibility")}
|
||||||
|
type="select"
|
||||||
|
value={createForm.watch("trustCenterVisibility")}
|
||||||
|
onValueChange={value =>
|
||||||
|
createForm.setValue(
|
||||||
|
"trustCenterVisibility",
|
||||||
|
value as "NONE" | "PRIVATE" | "PUBLIC",
|
||||||
|
)}
|
||||||
|
error={createForm.formState.errors.trustCenterVisibility?.message}
|
||||||
|
>
|
||||||
|
{getTrustCenterVisibilityOptions(__).map(option => (
|
||||||
|
<Option key={option.value} value={option.value}>
|
||||||
|
<div className="flex items-center justify-between w-full">
|
||||||
|
<Badge variant={option.variant}>{option.label}</Badge>
|
||||||
|
</div>
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Field>
|
||||||
|
</DialogContent>
|
||||||
|
<DialogFooter>
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
disabled={isCreating || !uploadedFile}
|
||||||
|
>
|
||||||
|
{isCreating && <Spinner />}
|
||||||
|
{__("Add File")}
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</form>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -29,6 +29,11 @@ export const compliancePageRoutes = [
|
|||||||
Fallback: LinkCardSkeleton,
|
Fallback: LinkCardSkeleton,
|
||||||
Component: lazy(() => import("#/pages/organizations/compliance-page/documents/CompliancePageDocumentsPageLoader")),
|
Component: lazy(() => import("#/pages/organizations/compliance-page/documents/CompliancePageDocumentsPageLoader")),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "files",
|
||||||
|
Fallback: LinkCardSkeleton,
|
||||||
|
Component: lazy(() => import("#/pages/organizations/compliance-page/files/CompliancePageFilesPageLoader")),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,384 +0,0 @@
|
|||||||
import { getTrustCenterVisibilityOptions } from "@probo/helpers";
|
|
||||||
import { useTranslate } from "@probo/i18n";
|
|
||||||
import {
|
|
||||||
Badge,
|
|
||||||
Button,
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogFooter,
|
|
||||||
Dropzone,
|
|
||||||
Field,
|
|
||||||
IconPlusLarge,
|
|
||||||
Option,
|
|
||||||
Spinner,
|
|
||||||
useDialogRef,
|
|
||||||
} from "@probo/ui";
|
|
||||||
import { useCallback, useState } from "react";
|
|
||||||
import { useOutletContext } from "react-router";
|
|
||||||
import { z } from "zod";
|
|
||||||
|
|
||||||
import type { TrustCenterGraphQuery$data } from "#/__generated__/core/TrustCenterGraphQuery.graphql";
|
|
||||||
import { TrustCenterFilesCard } from "#/components/trustCenter/TrustCenterFilesCard";
|
|
||||||
import {
|
|
||||||
useCreateTrustCenterFileMutation,
|
|
||||||
useDeleteTrustCenterFileMutation,
|
|
||||||
useUpdateTrustCenterFileMutation,
|
|
||||||
} from "#/hooks/graph/TrustCenterFileGraph";
|
|
||||||
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
|
|
||||||
|
|
||||||
const acceptedFileTypes = {
|
|
||||||
"application/csv": [".csv"],
|
|
||||||
"application/json": [".json"],
|
|
||||||
"application/msword": [".doc"],
|
|
||||||
"application/pdf": [".pdf"],
|
|
||||||
"application/vnd.ms-excel": [".xls"],
|
|
||||||
"application/vnd.ms-powerpoint": [".ppt"],
|
|
||||||
"application/vnd.oasis.opendocument.presentation": [".odp"],
|
|
||||||
"application/vnd.oasis.opendocument.spreadsheet": [".ods"],
|
|
||||||
"application/vnd.oasis.opendocument.text": [".odt"],
|
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
|
||||||
".pptx",
|
|
||||||
],
|
|
||||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
|
|
||||||
".xlsx",
|
|
||||||
],
|
|
||||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
|
||||||
".docx",
|
|
||||||
],
|
|
||||||
"application/yaml": [".yaml", ".yml"],
|
|
||||||
"image/gif": [".gif"],
|
|
||||||
"image/jpeg": [".jpeg", ".jpg"],
|
|
||||||
"image/png": [".png"],
|
|
||||||
"image/svg+xml": [".svg"],
|
|
||||||
"image/webp": [".webp"],
|
|
||||||
"text/csv": [".csv"],
|
|
||||||
"text/json": [".json"],
|
|
||||||
"text/markdown": [".md"],
|
|
||||||
"text/plain": [".txt"],
|
|
||||||
"text/uri-list; charset=utf-8": [".uri"],
|
|
||||||
"text/uri-list": [".uri"],
|
|
||||||
"text/x-log": [".log"],
|
|
||||||
"text/yaml": [".yaml", ".yml"],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function TrustCenterFilesTab() {
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
const { organization } = useOutletContext<TrustCenterGraphQuery$data>();
|
|
||||||
const createSchema = z.object({
|
|
||||||
name: z.string().min(1, __("Name is required")),
|
|
||||||
category: z.string().min(1, __("Category is required")),
|
|
||||||
trustCenterVisibility: z.enum(["NONE", "PRIVATE", "PUBLIC"]),
|
|
||||||
});
|
|
||||||
|
|
||||||
const editSchema = z.object({
|
|
||||||
name: z.string().min(1, __("Name is required")),
|
|
||||||
category: z.string().min(1, __("Category is required")),
|
|
||||||
});
|
|
||||||
|
|
||||||
const [createFile, isCreating] = useCreateTrustCenterFileMutation();
|
|
||||||
const [updateFile, isUpdating] = useUpdateTrustCenterFileMutation();
|
|
||||||
const [deleteFile, isDeleting] = useDeleteTrustCenterFileMutation();
|
|
||||||
|
|
||||||
const createDialogRef = useDialogRef();
|
|
||||||
const editDialogRef = useDialogRef();
|
|
||||||
const deleteDialogRef = useDialogRef();
|
|
||||||
|
|
||||||
const [editingFile, setEditingFile] = useState<{
|
|
||||||
id: string;
|
|
||||||
name: string;
|
|
||||||
category: string;
|
|
||||||
} | null>(null);
|
|
||||||
const [deletingFileId, setDeletingFileId] = useState<string | null>(null);
|
|
||||||
const [uploadedFile, setUploadedFile] = useState<File | null>(null);
|
|
||||||
const [isUploading, setIsUploading] = useState(false);
|
|
||||||
|
|
||||||
const createForm = useFormWithSchema(createSchema, {
|
|
||||||
defaultValues: { name: "", category: "", trustCenterVisibility: "NONE" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const editForm = useFormWithSchema(editSchema, {
|
|
||||||
defaultValues: { name: "", category: "" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const files
|
|
||||||
= organization.trustCenterFiles?.edges?.map(edge => edge.node) || [];
|
|
||||||
|
|
||||||
const handleFileUpload = useCallback(
|
|
||||||
(acceptedFiles: File[]) => {
|
|
||||||
if (acceptedFiles.length > 0) {
|
|
||||||
const file = acceptedFiles[0];
|
|
||||||
|
|
||||||
if (!Object.keys(acceptedFileTypes).includes(file.type)) {
|
|
||||||
createForm.setError("root", {
|
|
||||||
type: "manual",
|
|
||||||
message: __("File type is not allowed"),
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setUploadedFile(file);
|
|
||||||
createForm.clearErrors("root");
|
|
||||||
if (!createForm.getValues().name) {
|
|
||||||
createForm.setValue("name", file.name.replace(/\.[^/.]+$/, ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[createForm, __],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleCreate = createForm.handleSubmit(async (data) => {
|
|
||||||
if (!uploadedFile) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsUploading(true);
|
|
||||||
|
|
||||||
const connectionId = organization.trustCenterFiles?.__id;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await createFile({
|
|
||||||
variables: {
|
|
||||||
input: {
|
|
||||||
organizationId: organization.id,
|
|
||||||
name: data.name,
|
|
||||||
category: data.category,
|
|
||||||
trustCenterVisibility: data.trustCenterVisibility,
|
|
||||||
file: null,
|
|
||||||
},
|
|
||||||
connections: connectionId ? [connectionId] : [],
|
|
||||||
},
|
|
||||||
uploadables: {
|
|
||||||
"input.file": uploadedFile,
|
|
||||||
},
|
|
||||||
onSuccess: () => {
|
|
||||||
createDialogRef.current?.close();
|
|
||||||
createForm.reset();
|
|
||||||
setUploadedFile(null);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
setIsUploading(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleEdit = useCallback(
|
|
||||||
(file: { id: string; name: string; category: string }) => {
|
|
||||||
setEditingFile(file);
|
|
||||||
editForm.reset({ name: file.name, category: file.category });
|
|
||||||
editDialogRef.current?.open();
|
|
||||||
},
|
|
||||||
[editDialogRef, editForm],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleUpdate = editForm.handleSubmit(async (data) => {
|
|
||||||
if (!editingFile) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await updateFile({
|
|
||||||
variables: {
|
|
||||||
input: {
|
|
||||||
id: editingFile.id,
|
|
||||||
name: data.name,
|
|
||||||
category: data.category,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
onSuccess: () => {
|
|
||||||
editDialogRef.current?.close();
|
|
||||||
setEditingFile(null);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleDeleteClick = useCallback(
|
|
||||||
(id: string) => {
|
|
||||||
setDeletingFileId(id);
|
|
||||||
deleteDialogRef.current?.open();
|
|
||||||
},
|
|
||||||
[deleteDialogRef],
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleDeleteConfirm = useCallback(async () => {
|
|
||||||
if (!deletingFileId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const connectionId = organization.trustCenterFiles?.__id;
|
|
||||||
|
|
||||||
await deleteFile({
|
|
||||||
variables: {
|
|
||||||
input: { id: deletingFileId },
|
|
||||||
connections: connectionId ? [connectionId] : [],
|
|
||||||
},
|
|
||||||
onSuccess: () => {
|
|
||||||
deleteDialogRef.current?.close();
|
|
||||||
setDeletingFileId(null);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}, [
|
|
||||||
deletingFileId,
|
|
||||||
deleteFile,
|
|
||||||
deleteDialogRef,
|
|
||||||
organization.trustCenterFiles?.__id,
|
|
||||||
]);
|
|
||||||
|
|
||||||
const handleChangeVisibility = useCallback(
|
|
||||||
async (params: {
|
|
||||||
variables: {
|
|
||||||
input: {
|
|
||||||
id: string;
|
|
||||||
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}) => {
|
|
||||||
await updateFile(params);
|
|
||||||
},
|
|
||||||
[updateFile],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<div>
|
|
||||||
<h3 className="text-base font-medium">{__("Files")}</h3>
|
|
||||||
<p className="text-sm text-txt-tertiary">
|
|
||||||
{__("Upload and manage files for your trust center")}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{organization.canCreateTrustCenterFile && (
|
|
||||||
<Button
|
|
||||||
icon={IconPlusLarge}
|
|
||||||
onClick={() => createDialogRef.current?.open()}
|
|
||||||
>
|
|
||||||
{__("Add File")}
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
{(isUpdating || isDeleting) && (
|
|
||||||
<div className="flex items-center justify-center">
|
|
||||||
<Spinner />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<TrustCenterFilesCard
|
|
||||||
files={files}
|
|
||||||
params={{}}
|
|
||||||
disabled={isUpdating || isDeleting}
|
|
||||||
onChangeVisibility={handleChangeVisibility}
|
|
||||||
onEdit={handleEdit}
|
|
||||||
onDelete={handleDeleteClick}
|
|
||||||
canUpdate={!!organization.trustCenter?.canUpdate}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Dialog ref={createDialogRef} title={__("Add File")}>
|
|
||||||
<form onSubmit={e => void handleCreate(e)}>
|
|
||||||
<DialogContent padded className="space-y-4">
|
|
||||||
<Dropzone
|
|
||||||
description={__("Upload file (max 10MB)")}
|
|
||||||
isUploading={isUploading}
|
|
||||||
onDrop={handleFileUpload}
|
|
||||||
maxSize={10}
|
|
||||||
accept={acceptedFileTypes}
|
|
||||||
/>
|
|
||||||
{uploadedFile && (
|
|
||||||
<div className="text-sm text-txt-secondary">
|
|
||||||
{__("Selected file")}
|
|
||||||
:
|
|
||||||
{uploadedFile.name}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{createForm.formState.errors.root && (
|
|
||||||
<p className="text-sm text-txt-danger">
|
|
||||||
{createForm.formState.errors.root.message}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
<Field
|
|
||||||
label={__("Name")}
|
|
||||||
type="text"
|
|
||||||
{...createForm.register("name")}
|
|
||||||
error={createForm.formState.errors.name?.message}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
label={__("Category")}
|
|
||||||
type="text"
|
|
||||||
{...createForm.register("category")}
|
|
||||||
error={createForm.formState.errors.category?.message}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
label={__("Visibility")}
|
|
||||||
type="select"
|
|
||||||
value={createForm.watch("trustCenterVisibility")}
|
|
||||||
onValueChange={value =>
|
|
||||||
createForm.setValue(
|
|
||||||
"trustCenterVisibility",
|
|
||||||
value as "NONE" | "PRIVATE" | "PUBLIC",
|
|
||||||
)}
|
|
||||||
error={createForm.formState.errors.trustCenterVisibility?.message}
|
|
||||||
>
|
|
||||||
{getTrustCenterVisibilityOptions(__).map(option => (
|
|
||||||
<Option key={option.value} value={option.value}>
|
|
||||||
<div className="flex items-center justify-between w-full">
|
|
||||||
<Badge variant={option.variant}>{option.label}</Badge>
|
|
||||||
</div>
|
|
||||||
</Option>
|
|
||||||
))}
|
|
||||||
</Field>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button
|
|
||||||
type="submit"
|
|
||||||
disabled={isCreating || isUploading || !uploadedFile}
|
|
||||||
>
|
|
||||||
{(isCreating || isUploading) && <Spinner />}
|
|
||||||
{__("Add File")}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</form>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog ref={editDialogRef} title={__("Edit File")}>
|
|
||||||
<form onSubmit={e => void handleUpdate(e)}>
|
|
||||||
<DialogContent padded className="space-y-4">
|
|
||||||
<Field
|
|
||||||
label={__("Name")}
|
|
||||||
type="text"
|
|
||||||
{...editForm.register("name")}
|
|
||||||
error={editForm.formState.errors.name?.message}
|
|
||||||
/>
|
|
||||||
<Field
|
|
||||||
label={__("Category")}
|
|
||||||
type="text"
|
|
||||||
{...editForm.register("category")}
|
|
||||||
error={editForm.formState.errors.category?.message}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button type="submit" disabled={isUpdating}>
|
|
||||||
{isUpdating && <Spinner />}
|
|
||||||
{__("Save")}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</form>
|
|
||||||
</Dialog>
|
|
||||||
|
|
||||||
<Dialog ref={deleteDialogRef} title={__("Delete File")}>
|
|
||||||
<DialogContent padded>
|
|
||||||
<p>
|
|
||||||
{__(
|
|
||||||
"Are you sure you want to delete this file? This action cannot be undone.",
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
</DialogContent>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button
|
|
||||||
variant="danger"
|
|
||||||
onClick={() => void handleDeleteConfirm()}
|
|
||||||
disabled={isDeleting}
|
|
||||||
>
|
|
||||||
{isDeleting && <Spinner />}
|
|
||||||
{__("Delete")}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -29,13 +29,6 @@ export const trustCenterRoutes = [
|
|||||||
lazy(() => import("#/pages/organizations/trustCenter/TrustCenterPage")),
|
lazy(() => import("#/pages/organizations/trustCenter/TrustCenterPage")),
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
{
|
|
||||||
path: "files",
|
|
||||||
Fallback: LinkCardSkeleton,
|
|
||||||
Component: lazy(
|
|
||||||
() => import("#/pages/organizations/trustCenter/TrustCenterFilesTab"),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: "vendors",
|
path: "vendors",
|
||||||
Fallback: LinkCardSkeleton,
|
Fallback: LinkCardSkeleton,
|
||||||
|
|||||||
Reference in New Issue
Block a user