diff --git a/apps/console2/public/policy.png b/apps/console2/public/document.png similarity index 100% rename from apps/console2/public/policy.png rename to apps/console2/public/document.png diff --git a/apps/console2/src/hooks/forms/__generated__/useVendorFormMutation.graphql.ts b/apps/console2/src/hooks/forms/__generated__/useVendorFormMutation.graphql.ts index 5f0106b8f..45bf92dcf 100644 --- a/apps/console2/src/hooks/forms/__generated__/useVendorFormMutation.graphql.ts +++ b/apps/console2/src/hooks/forms/__generated__/useVendorFormMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<6a680118da31fa610f9638d27a9b48d1>> + * @generated SignedSource<<95aa70195a3e90acb366441fd037c2f2>> * @lightSyntaxTransform * @nogrep */ @@ -10,9 +10,11 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; +export type VendorCategory = "ANALYTICS" | "CLOUD_MONITORING" | "CLOUD_PROVIDER" | "COLLABORATION" | "CUSTOMER_SUPPORT" | "DATA_STORAGE_AND_PROCESSING" | "DOCUMENT_MANAGEMENT" | "EMPLOYEE_MANAGEMENT" | "ENGINEERING" | "FINANCE" | "IDENTITY_PROVIDER" | "IT" | "MARKETING" | "OFFICE_OPERATIONS" | "OTHER" | "PASSWORD_MANAGEMENT" | "PRODUCT_AND_DESIGN" | "PROFESSIONAL_SERVICES" | "RECRUITING" | "SALES" | "SECURITY" | "VERSION_CONTROL"; export type UpdateVendorInput = { + businessAssociateAgreementUrl?: string | null | undefined; businessOwnerId?: string | null | undefined; - category?: string | null | undefined; + category?: VendorCategory | null | undefined; certifications?: ReadonlyArray | null | undefined; dataProcessingAgreementUrl?: string | null | undefined; description?: string | null | undefined; @@ -25,6 +27,7 @@ export type UpdateVendorInput = { securityPageUrl?: string | null | undefined; serviceLevelAgreementUrl?: string | null | undefined; statusPageUrl?: string | null | undefined; + subprocessorsListUrl?: string | null | undefined; termsOfServiceUrl?: string | null | undefined; trustPageUrl?: string | null | undefined; websiteUrl?: string | null | undefined; diff --git a/apps/console2/src/hooks/forms/usePolicyForm.tsx b/apps/console2/src/hooks/forms/useDocumentForm.tsx similarity index 55% rename from apps/console2/src/hooks/forms/usePolicyForm.tsx rename to apps/console2/src/hooks/forms/useDocumentForm.tsx index 79205a3a7..af9421d65 100644 --- a/apps/console2/src/hooks/forms/usePolicyForm.tsx +++ b/apps/console2/src/hooks/forms/useDocumentForm.tsx @@ -1,12 +1,12 @@ import { z } from "zod"; import { useFormWithSchema } from "../useFormWithSchema"; -export const policySchema = z.object({ +export const documentSchema = z.object({ title: z.string(), content: z.string(), ownerId: z.string(), }); -export const usePolicyForm = () => { - return useFormWithSchema(policySchema, {}); +export const useDocumentForm = () => { + return useFormWithSchema(documentSchema, {}); }; diff --git a/apps/console2/src/hooks/graph/DocumentGraph.ts b/apps/console2/src/hooks/graph/DocumentGraph.ts new file mode 100644 index 000000000..fc626950b --- /dev/null +++ b/apps/console2/src/hooks/graph/DocumentGraph.ts @@ -0,0 +1,48 @@ +import { useTranslate } from "@probo/i18n"; +import { graphql } from "relay-runtime"; +import { useMutationWithToasts } from "../useMutationWithToasts"; +import type { DocumentGraphDeleteMutation } from "./__generated__/DocumentGraphDeleteMutation.graphql"; + +export const documentsQuery = graphql` + query DocumentGraphListQuery($organizationId: ID!) { + organization: node(id: $organizationId) { + id + ...DocumentsPageListFragment + } + } +`; + +export const DocumentsConnectionKey = "DocumentsPageFragment_documents"; + +const deleteDocumentMutation = graphql` + mutation DocumentGraphDeleteMutation( + $input: DeleteDocumentInput! + $connections: [ID!]! + ) { + deleteDocument(input: $input) { + deletedDocumentId @deleteEdge(connections: $connections) + } + } +`; + +export function useDeleteDocumentMutation() { + const { __ } = useTranslate(); + + return useMutationWithToasts( + deleteDocumentMutation, + { + successMessage: __("Document deleted successfully."), + errorMessage: __("Failed to delete document. Please try again."), + } + ); +} + +export const documentNodeQuery = graphql` + query DocumentGraphNodeQuery($documentId: ID!) { + node(id: $documentId) { + ... on Document { + ...DocumentPageDocumentFragment + } + } + } +`; diff --git a/apps/console2/src/hooks/graph/FrameworkGraph.ts b/apps/console2/src/hooks/graph/FrameworkGraph.ts index 0b1a5f0f4..df6feb670 100644 --- a/apps/console2/src/hooks/graph/FrameworkGraph.ts +++ b/apps/console2/src/hooks/graph/FrameworkGraph.ts @@ -40,13 +40,10 @@ export const useDeleteFrameworkMutation = ( framework: { id: string; name: string }, connectionId: string ) => { - const [commitDelete, isDeleting] = useMutationWithToasts( - deleteFrameworkMutation, - { - errorMessage: "Failed to delete framework", - successMessage: "Framework deleted successfully", - } - ); + const [commitDelete] = useMutationWithToasts(deleteFrameworkMutation, { + errorMessage: "Failed to delete framework", + successMessage: "Framework deleted successfully", + }); const confirm = useConfirm(); const { __ } = useTranslate(); diff --git a/apps/console2/src/hooks/graph/PolicyGraph.ts b/apps/console2/src/hooks/graph/PolicyGraph.ts deleted file mode 100644 index dbd9f9e4f..000000000 --- a/apps/console2/src/hooks/graph/PolicyGraph.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { useTranslate } from "@probo/i18n"; -import { graphql } from "relay-runtime"; -import { useMutationWithToasts } from "../useMutationWithToasts"; -import type { PolicyGraphDeleteMutation } from "./__generated__/PolicyGraphDeleteMutation.graphql"; - -export const policiesQuery = graphql` - query PolicyGraphListQuery($organizationId: ID!) { - organization: node(id: $organizationId) { - id - ...PoliciesPageListFragment - } - } -`; - -export const PoliciesConnectionKey = "PoliciesPageFragment_policies"; - -const deletePolicyMutation = graphql` - mutation PolicyGraphDeleteMutation( - $input: DeletePolicyInput! - $connections: [ID!]! - ) { - deletePolicy(input: $input) { - deletedPolicyId @deleteEdge(connections: $connections) - } - } -`; - -export function useDeletePolicyMutation() { - const { __ } = useTranslate(); - - return useMutationWithToasts( - deletePolicyMutation, - { - successMessage: __("Policy deleted successfully."), - errorMessage: __("Failed to delete policy. Please try again."), - } - ); -} - -export const policyNodeQuery = graphql` - query PolicyGraphNodeQuery($policyId: ID!) { - node(id: $policyId) { - ... on Policy { - ...PolicyPagePolicyFragment - } - } - } -`; diff --git a/apps/console2/src/hooks/graph/__generated__/PolicyGraphDeleteMutation.graphql.ts b/apps/console2/src/hooks/graph/__generated__/DocumentGraphDeleteMutation.graphql.ts similarity index 63% rename from apps/console2/src/hooks/graph/__generated__/PolicyGraphDeleteMutation.graphql.ts rename to apps/console2/src/hooks/graph/__generated__/DocumentGraphDeleteMutation.graphql.ts index 4b5d0aef2..2d62ca753 100644 --- a/apps/console2/src/hooks/graph/__generated__/PolicyGraphDeleteMutation.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/DocumentGraphDeleteMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<64c2c92a2a0806f34243f8fc9904167c>> * @lightSyntaxTransform * @nogrep */ @@ -9,21 +9,21 @@ // @ts-nocheck import { ConcreteRequest } from 'relay-runtime'; -export type DeletePolicyInput = { - policyId: string; +export type DeleteDocumentInput = { + documentId: string; }; -export type PolicyGraphDeleteMutation$variables = { +export type DocumentGraphDeleteMutation$variables = { connections: ReadonlyArray; - input: DeletePolicyInput; + input: DeleteDocumentInput; }; -export type PolicyGraphDeleteMutation$data = { - readonly deletePolicy: { - readonly deletedPolicyId: string; +export type DocumentGraphDeleteMutation$data = { + readonly deleteDocument: { + readonly deletedDocumentId: string; }; }; -export type PolicyGraphDeleteMutation = { - response: PolicyGraphDeleteMutation$data; - variables: PolicyGraphDeleteMutation$variables; +export type DocumentGraphDeleteMutation = { + response: DocumentGraphDeleteMutation$data; + variables: DocumentGraphDeleteMutation$variables; }; const node: ConcreteRequest = (function(){ @@ -48,7 +48,7 @@ v3 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "deletedPolicyId", + "name": "deletedDocumentId", "storageKey": null }; return { @@ -59,14 +59,14 @@ return { ], "kind": "Fragment", "metadata": null, - "name": "PolicyGraphDeleteMutation", + "name": "DocumentGraphDeleteMutation", "selections": [ { "alias": null, "args": (v2/*: any*/), - "concreteType": "DeletePolicyPayload", + "concreteType": "DeleteDocumentPayload", "kind": "LinkedField", - "name": "deletePolicy", + "name": "deleteDocument", "plural": false, "selections": [ (v3/*: any*/) @@ -84,14 +84,14 @@ return { (v0/*: any*/) ], "kind": "Operation", - "name": "PolicyGraphDeleteMutation", + "name": "DocumentGraphDeleteMutation", "selections": [ { "alias": null, "args": (v2/*: any*/), - "concreteType": "DeletePolicyPayload", + "concreteType": "DeleteDocumentPayload", "kind": "LinkedField", - "name": "deletePolicy", + "name": "deleteDocument", "plural": false, "selections": [ (v3/*: any*/), @@ -102,7 +102,7 @@ return { "handle": "deleteEdge", "key": "", "kind": "ScalarHandle", - "name": "deletedPolicyId", + "name": "deletedDocumentId", "handleArgs": [ { "kind": "Variable", @@ -117,16 +117,16 @@ return { ] }, "params": { - "cacheID": "d635ed7113bd8ad32056f5b4fbb95b22", + "cacheID": "84c747138470346796393f93a85b7127", "id": null, "metadata": {}, - "name": "PolicyGraphDeleteMutation", + "name": "DocumentGraphDeleteMutation", "operationKind": "mutation", - "text": "mutation PolicyGraphDeleteMutation(\n $input: DeletePolicyInput!\n) {\n deletePolicy(input: $input) {\n deletedPolicyId\n }\n}\n" + "text": "mutation DocumentGraphDeleteMutation(\n $input: DeleteDocumentInput!\n) {\n deleteDocument(input: $input) {\n deletedDocumentId\n }\n}\n" } }; })(); -(node as any).hash = "f5178185f41864d20506abc44b37fa67"; +(node as any).hash = "355f3a70caecabb2146075657665633e"; export default node; diff --git a/apps/console2/src/hooks/graph/__generated__/PolicyGraphListQuery.graphql.ts b/apps/console2/src/hooks/graph/__generated__/DocumentGraphListQuery.graphql.ts similarity index 82% rename from apps/console2/src/hooks/graph/__generated__/PolicyGraphListQuery.graphql.ts rename to apps/console2/src/hooks/graph/__generated__/DocumentGraphListQuery.graphql.ts index 6ce5883a5..b5ed47e6e 100644 --- a/apps/console2/src/hooks/graph/__generated__/PolicyGraphListQuery.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/DocumentGraphListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -10,18 +10,18 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; -export type PolicyGraphListQuery$variables = { +export type DocumentGraphListQuery$variables = { organizationId: string; }; -export type PolicyGraphListQuery$data = { +export type DocumentGraphListQuery$data = { readonly organization: { readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageListFragment">; + readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageListFragment">; }; }; -export type PolicyGraphListQuery = { - response: PolicyGraphListQuery$data; - variables: PolicyGraphListQuery$variables; +export type DocumentGraphListQuery = { + response: DocumentGraphListQuery$data; + variables: DocumentGraphListQuery$variables; }; const node: ConcreteRequest = (function(){ @@ -65,7 +65,7 @@ return { "argumentDefinitions": (v0/*: any*/), "kind": "Fragment", "metadata": null, - "name": "PolicyGraphListQuery", + "name": "DocumentGraphListQuery", "selections": [ { "alias": "organization", @@ -79,7 +79,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "PoliciesPageListFragment" + "name": "DocumentsPageListFragment" } ], "storageKey": null @@ -92,7 +92,7 @@ return { "operation": { "argumentDefinitions": (v0/*: any*/), "kind": "Operation", - "name": "PolicyGraphListQuery", + "name": "DocumentGraphListQuery", "selections": [ { "alias": "organization", @@ -110,15 +110,15 @@ return { { "alias": null, "args": (v4/*: any*/), - "concreteType": "PolicyConnection", + "concreteType": "DocumentConnection", "kind": "LinkedField", - "name": "policies", + "name": "documents", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "PolicyEdge", + "concreteType": "DocumentEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -126,7 +126,7 @@ return { { "alias": null, "args": null, - "concreteType": "Policy", + "concreteType": "Document", "kind": "LinkedField", "name": "node", "plural": false, @@ -181,7 +181,7 @@ return { "value": 1 } ], - "concreteType": "PolicyVersionConnection", + "concreteType": "DocumentVersionConnection", "kind": "LinkedField", "name": "versions", "plural": false, @@ -189,7 +189,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionEdge", + "concreteType": "DocumentVersionEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -197,7 +197,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersion", + "concreteType": "DocumentVersion", "kind": "LinkedField", "name": "node", "plural": false, @@ -213,7 +213,7 @@ return { { "alias": null, "args": (v4/*: any*/), - "concreteType": "PolicyVersionSignatureConnection", + "concreteType": "DocumentVersionSignatureConnection", "kind": "LinkedField", "name": "signatures", "plural": false, @@ -221,7 +221,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignatureEdge", + "concreteType": "DocumentVersionSignatureEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -229,7 +229,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignature", + "concreteType": "DocumentVersionSignature", "kind": "LinkedField", "name": "node", "plural": false, @@ -312,16 +312,16 @@ return { ] } ], - "storageKey": "policies(first:100)" + "storageKey": "documents(first:100)" }, { "alias": null, "args": (v4/*: any*/), "filters": null, "handle": "connection", - "key": "PoliciesPageFragment_policies", + "key": "DocumentsPageFragment_documents", "kind": "LinkedHandle", - "name": "policies" + "name": "documents" } ], "type": "Organization", @@ -333,16 +333,16 @@ return { ] }, "params": { - "cacheID": "b0b3546b418ff2cfd5dd7678d3b0be14", + "cacheID": "d567583accd89d49f0c40fe1bac5ed84", "id": null, "metadata": {}, - "name": "PolicyGraphListQuery", + "name": "DocumentGraphListQuery", "operationKind": "query", - "text": "query PolicyGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ...PoliciesPageListFragment\n }\n}\n\nfragment PoliciesPageListFragment on Organization {\n policies(first: 100) {\n edges {\n node {\n id\n ...PoliciesPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PoliciesPageRowFragment on Policy {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n" + "text": "query DocumentGraphListQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n id\n ...DocumentsPageListFragment\n }\n}\n\nfragment DocumentsPageListFragment on Organization {\n documents(first: 100) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n" } }; })(); -(node as any).hash = "29761736de791476004e17ad21659a59"; +(node as any).hash = "63de39eb2c87fc45b83eeee047ddd36c"; export default node; diff --git a/apps/console2/src/hooks/graph/__generated__/PolicyGraphNodeQuery.graphql.ts b/apps/console2/src/hooks/graph/__generated__/DocumentGraphNodeQuery.graphql.ts similarity index 79% rename from apps/console2/src/hooks/graph/__generated__/PolicyGraphNodeQuery.graphql.ts rename to apps/console2/src/hooks/graph/__generated__/DocumentGraphNodeQuery.graphql.ts index 010b74867..78d5557f5 100644 --- a/apps/console2/src/hooks/graph/__generated__/PolicyGraphNodeQuery.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/DocumentGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<2cb115c83f67688124df197a8f944329>> * @lightSyntaxTransform * @nogrep */ @@ -10,17 +10,17 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; -export type PolicyGraphNodeQuery$variables = { - policyId: string; +export type DocumentGraphNodeQuery$variables = { + documentId: string; }; -export type PolicyGraphNodeQuery$data = { +export type DocumentGraphNodeQuery$data = { readonly node: { - readonly " $fragmentSpreads": FragmentRefs<"PolicyPagePolicyFragment">; + readonly " $fragmentSpreads": FragmentRefs<"DocumentPageDocumentFragment">; }; }; -export type PolicyGraphNodeQuery = { - response: PolicyGraphNodeQuery$data; - variables: PolicyGraphNodeQuery$variables; +export type DocumentGraphNodeQuery = { + response: DocumentGraphNodeQuery$data; + variables: DocumentGraphNodeQuery$variables; }; const node: ConcreteRequest = (function(){ @@ -28,14 +28,14 @@ var v0 = [ { "defaultValue": null, "kind": "LocalArgument", - "name": "policyId" + "name": "documentId" } ], v1 = [ { "kind": "Variable", "name": "id", - "variableName": "policyId" + "variableName": "documentId" } ], v2 = { @@ -122,7 +122,7 @@ return { "argumentDefinitions": (v0/*: any*/), "kind": "Fragment", "metadata": null, - "name": "PolicyGraphNodeQuery", + "name": "DocumentGraphNodeQuery", "selections": [ { "alias": null, @@ -138,10 +138,10 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "PolicyPagePolicyFragment" + "name": "DocumentPageDocumentFragment" } ], - "type": "Policy", + "type": "Document", "abstractKey": null } ], @@ -155,7 +155,7 @@ return { "operation": { "argumentDefinitions": (v0/*: any*/), "kind": "Operation", - "name": "PolicyGraphNodeQuery", + "name": "DocumentGraphNodeQuery", "selections": [ { "alias": null, @@ -193,7 +193,7 @@ return { { "alias": null, "args": (v5/*: any*/), - "concreteType": "PolicyVersionConnection", + "concreteType": "DocumentVersionConnection", "kind": "LinkedField", "name": "versions", "plural": false, @@ -201,7 +201,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionEdge", + "concreteType": "DocumentVersionEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -209,7 +209,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersion", + "concreteType": "DocumentVersion", "kind": "LinkedField", "name": "node", "plural": false, @@ -253,7 +253,7 @@ return { { "alias": null, "args": (v6/*: any*/), - "concreteType": "PolicyVersionSignatureConnection", + "concreteType": "DocumentVersionSignatureConnection", "kind": "LinkedField", "name": "signatures", "plural": false, @@ -261,7 +261,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignatureEdge", + "concreteType": "DocumentVersionSignatureEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -269,7 +269,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignature", + "concreteType": "DocumentVersionSignature", "kind": "LinkedField", "name": "node", "plural": false, @@ -334,7 +334,7 @@ return { "args": (v6/*: any*/), "filters": null, "handle": "connection", - "key": "PolicyPage_signatures", + "key": "DocumentPage_signatures", "kind": "LinkedHandle", "name": "signatures" }, @@ -376,12 +376,12 @@ return { "args": (v5/*: any*/), "filters": null, "handle": "connection", - "key": "PolicyPage_versions", + "key": "DocumentPage_versions", "kind": "LinkedHandle", "name": "versions" } ], - "type": "Policy", + "type": "Document", "abstractKey": null } ], @@ -390,16 +390,16 @@ return { ] }, "params": { - "cacheID": "e9c0e78ebbf62684edbfa11ac1ee5d25", + "cacheID": "671e1a9b133593847c68af3abd9a721f", "id": null, "metadata": {}, - "name": "PolicyGraphNodeQuery", + "name": "DocumentGraphNodeQuery", "operationKind": "query", - "text": "query PolicyGraphNodeQuery(\n $policyId: ID!\n) {\n node(id: $policyId) {\n __typename\n ... on Policy {\n ...PolicyPagePolicyFragment\n }\n id\n }\n}\n\nfragment PolicyPagePolicyFragment on Policy {\n id\n title\n owner {\n id\n fullName\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...PolicySignaturesDialog_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n ...PolicyVersionHistoryDialogFragment\n ...PolicySignaturesDialog_version\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment PolicySignaturesDialog_signature on PolicyVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment PolicySignaturesDialog_version on PolicyVersion {\n version\n status\n publishedAt\n updatedAt\n}\n\nfragment PolicyVersionHistoryDialogFragment on PolicyVersion {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n}\n" + "text": "query DocumentGraphNodeQuery(\n $documentId: ID!\n) {\n node(id: $documentId) {\n __typename\n ... on Document {\n ...DocumentPageDocumentFragment\n }\n id\n }\n}\n\nfragment DocumentPageDocumentFragment on Document {\n id\n title\n owner {\n id\n fullName\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesDialog_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n ...DocumentVersionHistoryDialogFragment\n ...DocumentSignaturesDialog_version\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentSignaturesDialog_signature on DocumentVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment DocumentSignaturesDialog_version on DocumentVersion {\n version\n status\n publishedAt\n updatedAt\n}\n\nfragment DocumentVersionHistoryDialogFragment on DocumentVersion {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n}\n" } }; })(); -(node as any).hash = "c06b24e46b33741678e07787ab1c69f3"; +(node as any).hash = "d6f55d4636b86d853b97b44e68e435f2"; export default node; diff --git a/apps/console2/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts b/apps/console2/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts index 887b32770..2f44c8feb 100644 --- a/apps/console2/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/PeopleGraphUpdateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -12,9 +12,12 @@ import { ConcreteRequest } from 'relay-runtime'; export type PeopleKind = "CONTRACTOR" | "EMPLOYEE" | "SERVICE_ACCOUNT"; export type UpdatePeopleInput = { additionalEmailAddresses?: ReadonlyArray | null | undefined; + contractEndDate?: any | null | undefined; + contractStartDate?: any | null | undefined; fullName?: string | null | undefined; id: string; kind?: PeopleKind | null | undefined; + position?: string | null | undefined; primaryEmailAddress?: string | null | undefined; }; export type PeopleGraphUpdateMutation$variables = { diff --git a/apps/console2/src/hooks/graph/__generated__/RisksListQuery.graphql.ts b/apps/console2/src/hooks/graph/__generated__/RisksListQuery.graphql.ts index 0a6f03f93..809571f09 100644 --- a/apps/console2/src/hooks/graph/__generated__/RisksListQuery.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/RisksListQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<7c5151b921734cd14b58af145eba7267>> + * @generated SignedSource<<6369aba92b58ca2a67d57110a829bde4>> * @lightSyntaxTransform * @nogrep */ @@ -11,7 +11,7 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type OrderDirection = "ASC" | "DESC"; -export type RiskOrderField = "CATEGORY" | "CREATED_AT" | "INITIAL_RISK_SCORE" | "NAME" | "RESIDUAL_RISK_SCORE" | "TREATMENT" | "UPDATED_AT"; +export type RiskOrderField = "CATEGORY" | "CREATED_AT" | "INHERENT_RISK_SCORE" | "NAME" | "RESIDUAL_RISK_SCORE" | "TREATMENT" | "UPDATED_AT"; export type RiskOrder = { direction: OrderDirection; field: RiskOrderField; diff --git a/apps/console2/src/hooks/graph/__generated__/VendorGraphCreateMutation.graphql.ts b/apps/console2/src/hooks/graph/__generated__/VendorGraphCreateMutation.graphql.ts index 417e9b44d..c1c3b9262 100644 --- a/apps/console2/src/hooks/graph/__generated__/VendorGraphCreateMutation.graphql.ts +++ b/apps/console2/src/hooks/graph/__generated__/VendorGraphCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<37dd4db659813ffa6fab65ffec643844>> + * @generated SignedSource<<8ef289e99926f279eb0e2d5ea955cb32>> * @lightSyntaxTransform * @nogrep */ @@ -9,9 +9,11 @@ // @ts-nocheck import { ConcreteRequest } from 'relay-runtime'; +export type VendorCategory = "ANALYTICS" | "CLOUD_MONITORING" | "CLOUD_PROVIDER" | "COLLABORATION" | "CUSTOMER_SUPPORT" | "DATA_STORAGE_AND_PROCESSING" | "DOCUMENT_MANAGEMENT" | "EMPLOYEE_MANAGEMENT" | "ENGINEERING" | "FINANCE" | "IDENTITY_PROVIDER" | "IT" | "MARKETING" | "OFFICE_OPERATIONS" | "OTHER" | "PASSWORD_MANAGEMENT" | "PRODUCT_AND_DESIGN" | "PROFESSIONAL_SERVICES" | "RECRUITING" | "SALES" | "SECURITY" | "VERSION_CONTROL"; export type CreateVendorInput = { + businessAssociateAgreementUrl?: string | null | undefined; businessOwnerId?: string | null | undefined; - category?: string | null | undefined; + category?: VendorCategory | null | undefined; certifications?: ReadonlyArray | null | undefined; dataProcessingAgreementUrl?: string | null | undefined; description?: string | null | undefined; @@ -24,6 +26,7 @@ export type CreateVendorInput = { securityPageUrl?: string | null | undefined; serviceLevelAgreementUrl?: string | null | undefined; statusPageUrl?: string | null | undefined; + subprocessorsListUrl?: string | null | undefined; termsOfServiceUrl?: string | null | undefined; trustPageUrl?: string | null | undefined; websiteUrl?: string | null | undefined; diff --git a/apps/console2/src/layouts/MainLayout.tsx b/apps/console2/src/layouts/MainLayout.tsx index 69e2c68b3..3823da633 100644 --- a/apps/console2/src/layouts/MainLayout.tsx +++ b/apps/console2/src/layouts/MainLayout.tsx @@ -111,9 +111,9 @@ export function MainLayout() { to={`${prefix}/vendors`} /> ; + queryRef: PreloadedQuery; }; -const policyFragment = graphql` - fragment PolicyPagePolicyFragment on Policy { +const documentFragment = graphql` + fragment DocumentPageDocumentFragment on Document { id title owner { id fullName } - versions(first: 20) @connection(key: "PolicyPage_versions") { + versions(first: 20) @connection(key: "DocumentPage_versions") { __id edges { node { @@ -64,7 +64,7 @@ const policyFragment = graphql` publishedAt version updatedAt - signatures(first: 100) @connection(key: "PolicyPage_signatures") { + signatures(first: 100) @connection(key: "DocumentPage_signatures") { __id edges { node { @@ -73,61 +73,61 @@ const policyFragment = graphql` signedBy { id } - ...PolicySignaturesDialog_signature + ...DocumentSignaturesDialog_signature } } } - ...PolicyVersionHistoryDialogFragment - ...PolicySignaturesDialog_version + ...DocumentVersionHistoryDialogFragment + ...DocumentSignaturesDialog_version } } } } `; -const publishPolicyVersionMutation = graphql` - mutation PolicyPagePublishMutation($input: PublishPolicyVersionInput!) { - publishPolicyVersion(input: $input) { - policy { +const publishDocumentVersionMutation = graphql` + mutation DocumentPagePublishMutation($input: PublishDocumentVersionInput!) { + publishDocumentVersion(input: $input) { + document { id } } } `; -export default function PolicyPage(props: Props) { - const node = usePreloadedQuery(policyNodeQuery, props.queryRef).node; - const policy = useFragment( - policyFragment, - node as PolicyPagePolicyFragment$key +export default function DocumentPage(props: Props) { + const node = usePreloadedQuery(documentNodeQuery, props.queryRef).node; + const document = useFragment( + documentFragment, + node as DocumentPageDocumentFragment$key ); const { __, dateFormat } = useTranslate(); const organizationId = useOrganizationId(); const navigate = useNavigate(); - const lastVersion = policy.versions.edges[0].node; + const lastVersion = document.versions.edges[0].node; const isDraft = lastVersion.status === "DRAFT"; - const [publishPolicyVersion, isPublishing] = useMutationWithToasts( - publishPolicyVersionMutation, + const [publishDocumentVersion, isPublishing] = useMutationWithToasts( + publishDocumentVersionMutation, { - successMessage: __("Policy published successfully."), - errorMessage: __("Failed to publish policy. Please try again."), + successMessage: __("Document published successfully."), + errorMessage: __("Failed to publish document. Please try again."), } ); - const [deletePolicy, isDeleting] = useDeletePolicyMutation(); - const versionConnectionId = policy.versions.__id; + const [deleteDocument, isDeleting] = useDeleteDocumentMutation(); + const versionConnectionId = document.versions.__id; - usePageTitle(policy.title); + usePageTitle(document.title); const handlePublish = () => { - publishPolicyVersion({ + publishDocumentVersion({ variables: { - input: { policyId: policy.id }, + input: { documentId: document.id }, }, onSuccess: () => { // Refresh the whole query to get the new version loadQuery( props.queryRef.environment, - policyNodeQuery, + documentNodeQuery, props.queryRef.variables, { fetchPolicy: "network-only" } ); @@ -143,15 +143,15 @@ export default function PolicyPage(props: Props) { new Promise((resolve) => { const connectionId = ConnectionHandler.getConnectionID( organizationId, - PoliciesConnectionKey + DocumentsConnectionKey ); - deletePolicy({ + deleteDocument({ variables: { - input: { policyId: policy.id }, + input: { documentId: document.id }, connections: [connectionId], }, onSuccess() { - navigate(`/organizations/${organizationId}/policies`); + navigate(`/organizations/${organizationId}/documents`); }, onError: () => resolve(), }); @@ -159,9 +159,9 @@ export default function PolicyPage(props: Props) { { message: sprintf( __( - 'This will permanently delete the policy "%s". This action cannot be undone.' + 'This will permanently delete the document "%s". This action cannot be undone.' ), - policy.title + document.title ), } ); @@ -173,7 +173,7 @@ export default function PolicyPage(props: Props) { <>
@@ -181,11 +181,11 @@ export default function PolicyPage(props: Props) { @@ -199,23 +199,23 @@ export default function PolicyPage(props: Props) { {__("Publish")} )} - + - - + + - + updateDialogRef.current?.open()} icon={IconPencil} > - {isDraft ? __("Edit draft policy") : __("Create new draft")} + {isDraft ? __("Edit draft document") : __("Create new draft")}
- + @@ -237,8 +237,8 @@ export default function PolicyPage(props: Props) { - - {policy.owner?.fullName} + + {document.owner?.fullName} diff --git a/apps/console2/src/pages/organizations/policies/PoliciesPage.tsx b/apps/console2/src/pages/organizations/documents/DocumentsPage.tsx similarity index 61% rename from apps/console2/src/pages/organizations/policies/PoliciesPage.tsx rename to apps/console2/src/pages/organizations/documents/DocumentsPage.tsx index bad27b681..f4317a242 100644 --- a/apps/console2/src/pages/organizations/policies/PoliciesPage.tsx +++ b/apps/console2/src/pages/organizations/documents/DocumentsPage.tsx @@ -22,25 +22,25 @@ import { type PreloadedQuery, } from "react-relay"; import { graphql } from "relay-runtime"; -import type { PolicyGraphListQuery } from "/hooks/graph/__generated__/PolicyGraphListQuery.graphql"; +import type { DocumentGraphListQuery } from "/hooks/graph/__generated__/DocumentGraphListQuery.graphql"; import { - policiesQuery, - useDeletePolicyMutation, -} from "/hooks/graph/PolicyGraph"; -import type { PoliciesPageListFragment$key } from "./__generated__/PoliciesPageListFragment.graphql"; + documentsQuery, + useDeleteDocumentMutation, +} from "/hooks/graph/DocumentGraph"; +import type { DocumentsPageListFragment$key } from "./__generated__/DocumentsPageListFragment.graphql"; import { usePageTitle } from "@probo/hooks"; import { sprintf } from "@probo/helpers"; -import { CreatePolicyDialog } from "./dialogs/CreatePolicyDialog"; -import type { PoliciesPageRowFragment$key } from "./__generated__/PoliciesPageRowFragment.graphql"; +import { CreateDocumentDialog } from "./dialogs/CreateDocumentDialog"; +import type { DocumentsPageRowFragment$key } from "./__generated__/DocumentsPageRowFragment.graphql"; -const policiesFragment = graphql` - fragment PoliciesPageListFragment on Organization { - policies(first: 100) @connection(key: "PoliciesPageFragment_policies") { +const documentsFragment = graphql` + fragment DocumentsPageListFragment on Organization { + documents(first: 100) @connection(key: "DocumentsPageFragment_documents") { __id edges { node { id - ...PoliciesPageRowFragment + ...DocumentsPageRowFragment } } } @@ -48,34 +48,34 @@ const policiesFragment = graphql` `; type Props = { - queryRef: PreloadedQuery; + queryRef: PreloadedQuery; }; -export default function PoliciesPage(props: Props) { +export default function DocumentsPage(props: Props) { const { __ } = useTranslate(); const organization = usePreloadedQuery( - policiesQuery, + documentsQuery, props.queryRef ).organization; - const data = useFragment( - policiesFragment, + const data = useFragment( + documentsFragment, organization ); - const policies = data.policies.edges.map((edge) => edge.node); - const connectionId = data.policies.__id; - usePageTitle(__("Policies")); + const documents = data.documents.edges.map((edge) => edge.node); + const connectionId = data.documents.__id; + usePageTitle(__("Documents")); return (
- {__("New policy")}} + trigger={} /> @@ -90,10 +90,10 @@ export default function PoliciesPage(props: Props) { - {policies.map((policy) => ( - ( + @@ -105,7 +105,7 @@ export default function PoliciesPage(props: Props) { } const rowFragment = graphql` - fragment PoliciesPageRowFragment on Policy { + fragment DocumentsPageRowFragment on Document { id title description @@ -133,61 +133,61 @@ const rowFragment = graphql` } `; -function PolicyRow({ - policy: policyKey, +function DocumentRow({ + document: documentKey, organizationId, connectionId, }: { - policy: PoliciesPageRowFragment$key; + document: DocumentsPageRowFragment$key; organizationId: string; connectionId: string; }) { - const policy = useFragment( + const document = useFragment( rowFragment, - policyKey + documentKey ); - const lastVersion = policy.versions.edges[0].node; + const lastVersion = document.versions.edges[0].node; const isDraft = lastVersion.status === "DRAFT"; const { __, dateFormat } = useTranslate(); const signatures = lastVersion.signatures.edges.map((edge) => edge.node); const signedCount = signatures.filter( (signature) => signature.state === "SIGNED" ).length; - const [deletePolicy, isDeleting] = useDeletePolicyMutation(); + const [deleteDocument] = useDeleteDocumentMutation(); const confirm = useConfirm(); const handleDelete = () => { confirm( () => - deletePolicy({ + deleteDocument({ variables: { - input: { policyId: policy.id }, + input: { documentId: document.id }, connections: [connectionId], }, }), { message: sprintf( __( - 'This will permanently delete the policy "%s". This action cannot be undone.' + 'This will permanently delete the document "%s". This action cannot be undone.' ), - policy.title + document.title ), } ); }; return ( - +
- {policy.title} + {document.title}
@@ -197,12 +197,12 @@ function PolicyRow({
- - {policy.owner.fullName} + + {document.owner.fullName}
- {dateFormat(policy.updatedAt, { + {dateFormat(document.updatedAt, { year: "numeric", month: "short", day: "numeric", diff --git a/apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePolicyFragment.graphql.ts b/apps/console2/src/pages/organizations/documents/__generated__/DocumentPageDocumentFragment.graphql.ts similarity index 81% rename from apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePolicyFragment.graphql.ts rename to apps/console2/src/pages/organizations/documents/__generated__/DocumentPageDocumentFragment.graphql.ts index e8f20cd26..a2d471953 100644 --- a/apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePolicyFragment.graphql.ts +++ b/apps/console2/src/pages/organizations/documents/__generated__/DocumentPageDocumentFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<088b04713ff854ffccb30532513bb093>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -9,10 +9,10 @@ // @ts-nocheck import { ReaderFragment } from 'relay-runtime'; -export type PolicyStatus = "DRAFT" | "PUBLISHED"; -export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; +export type DocumentStatus = "DRAFT" | "PUBLISHED"; +export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED"; import { FragmentRefs } from "relay-runtime"; -export type PolicyPagePolicyFragment$data = { +export type DocumentPageDocumentFragment$data = { readonly id: string; readonly owner: { readonly fullName: string; @@ -34,23 +34,23 @@ export type PolicyPagePolicyFragment$data = { readonly signedBy: { readonly id: string; }; - readonly state: PolicyVersionSignatureState; - readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_signature">; + readonly state: DocumentVersionSignatureState; + readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_signature">; }; }>; }; - readonly status: PolicyStatus; + readonly status: DocumentStatus; readonly updatedAt: any; readonly version: number; - readonly " $fragmentSpreads": FragmentRefs<"PolicySignaturesDialog_version" | "PolicyVersionHistoryDialogFragment">; + readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesDialog_version" | "DocumentVersionHistoryDialogFragment">; }; }>; }; - readonly " $fragmentType": "PolicyPagePolicyFragment"; + readonly " $fragmentType": "DocumentPageDocumentFragment"; }; -export type PolicyPagePolicyFragment$key = { - readonly " $data"?: PolicyPagePolicyFragment$data; - readonly " $fragmentSpreads": FragmentRefs<"PolicyPagePolicyFragment">; +export type DocumentPageDocumentFragment$key = { + readonly " $data"?: DocumentPageDocumentFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"DocumentPageDocumentFragment">; }; const node: ReaderFragment = (function(){ @@ -133,7 +133,7 @@ return { } ] }, - "name": "PolicyPagePolicyFragment", + "name": "DocumentPageDocumentFragment", "selections": [ (v0/*: any*/), { @@ -165,15 +165,15 @@ return { { "alias": "versions", "args": null, - "concreteType": "PolicyVersionConnection", + "concreteType": "DocumentVersionConnection", "kind": "LinkedField", - "name": "__PolicyPage_versions_connection", + "name": "__DocumentPage_versions_connection", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "PolicyVersionEdge", + "concreteType": "DocumentVersionEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -181,7 +181,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersion", + "concreteType": "DocumentVersion", "kind": "LinkedField", "name": "node", "plural": false, @@ -225,15 +225,15 @@ return { { "alias": "signatures", "args": null, - "concreteType": "PolicyVersionSignatureConnection", + "concreteType": "DocumentVersionSignatureConnection", "kind": "LinkedField", - "name": "__PolicyPage_signatures_connection", + "name": "__DocumentPage_signatures_connection", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "PolicyVersionSignatureEdge", + "concreteType": "DocumentVersionSignatureEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -241,7 +241,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignature", + "concreteType": "DocumentVersionSignature", "kind": "LinkedField", "name": "node", "plural": false, @@ -269,7 +269,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "PolicySignaturesDialog_signature" + "name": "DocumentSignaturesDialog_signature" }, (v1/*: any*/) ], @@ -287,12 +287,12 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "PolicyVersionHistoryDialogFragment" + "name": "DocumentVersionHistoryDialogFragment" }, { "args": null, "kind": "FragmentSpread", - "name": "PolicySignaturesDialog_version" + "name": "DocumentSignaturesDialog_version" }, (v1/*: any*/) ], @@ -308,11 +308,11 @@ return { "storageKey": null } ], - "type": "Policy", + "type": "Document", "abstractKey": null }; })(); -(node as any).hash = "b53b22a05e1abd608ecd688b6a9d5bad"; +(node as any).hash = "b42e98e8e26bc94a2d412bd73cd601f2"; export default node; diff --git a/apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePublishMutation.graphql.ts b/apps/console2/src/pages/organizations/documents/__generated__/DocumentPagePublishMutation.graphql.ts similarity index 57% rename from apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePublishMutation.graphql.ts rename to apps/console2/src/pages/organizations/documents/__generated__/DocumentPagePublishMutation.graphql.ts index c5d1eb112..9d6a248eb 100644 --- a/apps/console2/src/pages/organizations/policies/__generated__/PolicyPagePublishMutation.graphql.ts +++ b/apps/console2/src/pages/organizations/documents/__generated__/DocumentPagePublishMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<3ef23505e9378ce7ea92943b394ba290>> * @lightSyntaxTransform * @nogrep */ @@ -9,22 +9,22 @@ // @ts-nocheck import { ConcreteRequest } from 'relay-runtime'; -export type PublishPolicyVersionInput = { - policyId: string; +export type PublishDocumentVersionInput = { + documentId: string; }; -export type PolicyPagePublishMutation$variables = { - input: PublishPolicyVersionInput; +export type DocumentPagePublishMutation$variables = { + input: PublishDocumentVersionInput; }; -export type PolicyPagePublishMutation$data = { - readonly publishPolicyVersion: { - readonly policy: { +export type DocumentPagePublishMutation$data = { + readonly publishDocumentVersion: { + readonly document: { readonly id: string; }; }; }; -export type PolicyPagePublishMutation = { - response: PolicyPagePublishMutation$data; - variables: PolicyPagePublishMutation$variables; +export type DocumentPagePublishMutation = { + response: DocumentPagePublishMutation$data; + variables: DocumentPagePublishMutation$variables; }; const node: ConcreteRequest = (function(){ @@ -45,17 +45,17 @@ v1 = [ "variableName": "input" } ], - "concreteType": "PublishPolicyVersionPayload", + "concreteType": "PublishDocumentVersionPayload", "kind": "LinkedField", - "name": "publishPolicyVersion", + "name": "publishDocumentVersion", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "Policy", + "concreteType": "Document", "kind": "LinkedField", - "name": "policy", + "name": "document", "plural": false, "selections": [ { @@ -77,7 +77,7 @@ return { "argumentDefinitions": (v0/*: any*/), "kind": "Fragment", "metadata": null, - "name": "PolicyPagePublishMutation", + "name": "DocumentPagePublishMutation", "selections": (v1/*: any*/), "type": "Mutation", "abstractKey": null @@ -86,20 +86,20 @@ return { "operation": { "argumentDefinitions": (v0/*: any*/), "kind": "Operation", - "name": "PolicyPagePublishMutation", + "name": "DocumentPagePublishMutation", "selections": (v1/*: any*/) }, "params": { - "cacheID": "4279dd7a9a12d8d5fb6e07c1875de00a", + "cacheID": "fad75c1a396f60d6d13e1605fe85f33e", "id": null, "metadata": {}, - "name": "PolicyPagePublishMutation", + "name": "DocumentPagePublishMutation", "operationKind": "mutation", - "text": "mutation PolicyPagePublishMutation(\n $input: PublishPolicyVersionInput!\n) {\n publishPolicyVersion(input: $input) {\n policy {\n id\n }\n }\n}\n" + "text": "mutation DocumentPagePublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "8ee6cdf68342db34ec04aab82313eff0"; +(node as any).hash = "488029ccd88b4c637b63cd11d1bef986"; export default node; diff --git a/apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageListFragment.graphql.ts b/apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageListFragment.graphql.ts similarity index 78% rename from apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageListFragment.graphql.ts rename to apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageListFragment.graphql.ts index 0dfbc58fc..b9e2372ea 100644 --- a/apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageListFragment.graphql.ts +++ b/apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageListFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<89063899241b0557e2a6df4ff74ecea1>> + * @generated SignedSource<<5d1d855cd444dbaa6fc92493bc333dd4>> * @lightSyntaxTransform * @nogrep */ @@ -10,21 +10,21 @@ import { ReaderFragment } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; -export type PoliciesPageListFragment$data = { - readonly policies: { +export type DocumentsPageListFragment$data = { + readonly documents: { readonly __id: string; readonly edges: ReadonlyArray<{ readonly node: { readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageRowFragment">; + readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageRowFragment">; }; }>; }; - readonly " $fragmentType": "PoliciesPageListFragment"; + readonly " $fragmentType": "DocumentsPageListFragment"; }; -export type PoliciesPageListFragment$key = { - readonly " $data"?: PoliciesPageListFragment$data; - readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageListFragment">; +export type DocumentsPageListFragment$key = { + readonly " $data"?: DocumentsPageListFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageListFragment">; }; const node: ReaderFragment = { @@ -37,25 +37,25 @@ const node: ReaderFragment = { "cursor": null, "direction": "forward", "path": [ - "policies" + "documents" ] } ] }, - "name": "PoliciesPageListFragment", + "name": "DocumentsPageListFragment", "selections": [ { - "alias": "policies", + "alias": "documents", "args": null, - "concreteType": "PolicyConnection", + "concreteType": "DocumentConnection", "kind": "LinkedField", - "name": "__PoliciesPageFragment_policies_connection", + "name": "__DocumentsPageFragment_documents_connection", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "PolicyEdge", + "concreteType": "DocumentEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -63,7 +63,7 @@ const node: ReaderFragment = { { "alias": null, "args": null, - "concreteType": "Policy", + "concreteType": "Document", "kind": "LinkedField", "name": "node", "plural": false, @@ -78,7 +78,7 @@ const node: ReaderFragment = { { "args": null, "kind": "FragmentSpread", - "name": "PoliciesPageRowFragment" + "name": "DocumentsPageRowFragment" }, { "alias": null, @@ -145,6 +145,6 @@ const node: ReaderFragment = { "abstractKey": null }; -(node as any).hash = "1c1fa3340a1fe9de3995ffcb374c9124"; +(node as any).hash = "f6098fe2da00c369d0386e3854cd894b"; export default node; diff --git a/apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageRowFragment.graphql.ts b/apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts similarity index 81% rename from apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageRowFragment.graphql.ts rename to apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts index 8318f2c70..e9e7e6de5 100644 --- a/apps/console2/src/pages/organizations/policies/__generated__/PoliciesPageRowFragment.graphql.ts +++ b/apps/console2/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<3d1854151a950f0b4b85faf16c995c61>> + * @generated SignedSource<<394470df6f042c06c640caad2df537cc>> * @lightSyntaxTransform * @nogrep */ @@ -9,10 +9,10 @@ // @ts-nocheck import { ReaderFragment } from 'relay-runtime'; -export type PolicyStatus = "DRAFT" | "PUBLISHED"; -export type PolicyVersionSignatureState = "REQUESTED" | "SIGNED"; +export type DocumentStatus = "DRAFT" | "PUBLISHED"; +export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED"; import { FragmentRefs } from "relay-runtime"; -export type PoliciesPageRowFragment$data = { +export type DocumentsPageRowFragment$data = { readonly description: string; readonly id: string; readonly owner: { @@ -29,19 +29,19 @@ export type PoliciesPageRowFragment$data = { readonly edges: ReadonlyArray<{ readonly node: { readonly id: string; - readonly state: PolicyVersionSignatureState; + readonly state: DocumentVersionSignatureState; }; }>; }; - readonly status: PolicyStatus; + readonly status: DocumentStatus; }; }>; }; - readonly " $fragmentType": "PoliciesPageRowFragment"; + readonly " $fragmentType": "DocumentsPageRowFragment"; }; -export type PoliciesPageRowFragment$key = { - readonly " $data"?: PoliciesPageRowFragment$data; - readonly " $fragmentSpreads": FragmentRefs<"PoliciesPageRowFragment">; +export type DocumentsPageRowFragment$key = { + readonly " $data"?: DocumentsPageRowFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"DocumentsPageRowFragment">; }; const node: ReaderFragment = (function(){ @@ -56,7 +56,7 @@ return { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, - "name": "PoliciesPageRowFragment", + "name": "DocumentsPageRowFragment", "selections": [ (v0/*: any*/), { @@ -108,7 +108,7 @@ return { "value": 1 } ], - "concreteType": "PolicyVersionConnection", + "concreteType": "DocumentVersionConnection", "kind": "LinkedField", "name": "versions", "plural": false, @@ -116,7 +116,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionEdge", + "concreteType": "DocumentVersionEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -124,7 +124,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersion", + "concreteType": "DocumentVersion", "kind": "LinkedField", "name": "node", "plural": false, @@ -146,7 +146,7 @@ return { "value": 100 } ], - "concreteType": "PolicyVersionSignatureConnection", + "concreteType": "DocumentVersionSignatureConnection", "kind": "LinkedField", "name": "signatures", "plural": false, @@ -154,7 +154,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignatureEdge", + "concreteType": "DocumentVersionSignatureEdge", "kind": "LinkedField", "name": "edges", "plural": true, @@ -162,7 +162,7 @@ return { { "alias": null, "args": null, - "concreteType": "PolicyVersionSignature", + "concreteType": "DocumentVersionSignature", "kind": "LinkedField", "name": "node", "plural": false, @@ -194,11 +194,11 @@ return { "storageKey": "versions(first:1)" } ], - "type": "Policy", + "type": "Document", "abstractKey": null }; })(); -(node as any).hash = "b50c23e038e757685dfc7535825a389c"; +(node as any).hash = "b5339e945b607000f177036cad41e0d4"; export default node; diff --git a/apps/console2/src/pages/organizations/policies/dialogs/CreatePolicyDialog.tsx b/apps/console2/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx similarity index 70% rename from apps/console2/src/pages/organizations/policies/dialogs/CreatePolicyDialog.tsx rename to apps/console2/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx index bcc9dab22..533f09792 100644 --- a/apps/console2/src/pages/organizations/policies/dialogs/CreatePolicyDialog.tsx +++ b/apps/console2/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx @@ -15,25 +15,25 @@ import { import { type ReactNode } from "react"; import { graphql } from "relay-runtime"; import { useOrganizationId } from "/hooks/useOrganizationId"; -import { usePolicyForm } from "/hooks/forms/usePolicyForm"; +import { useDocumentForm } from "/hooks/forms/useDocumentForm"; import { useMutationWithToasts } from "/hooks/useMutationWithToasts"; import { PeopleSelectField } from "/components/form/PeopleSelectField"; -import type { CreatePolicyDialogMutation } from "./__generated__/CreatePolicyDialogMutation.graphql"; +import type { CreateDocumentDialogMutation } from "./__generated__/CreateDocumentDialogMutation.graphql"; type Props = { trigger?: ReactNode; connection: string; }; -const createPolicyMutation = graphql` - mutation CreatePolicyDialogMutation( - $input: CreatePolicyInput! +const createDocumentMutation = graphql` + mutation CreateDocumentDialogMutation( + $input: CreateDocumentInput! $connections: [ID!]! ) { - createPolicy(input: $input) { - policyEdge @prependEdge(connections: $connections) { + createDocument(input: $input) { + documentEdge @prependEdge(connections: $connections) { node { - ...PoliciesPageRowFragment + ...DocumentsPageRowFragment } } } @@ -41,28 +41,30 @@ const createPolicyMutation = graphql` `; /** - * Dialog to create or update a policy + * Dialog to create or update a document */ -export function CreatePolicyDialog({ trigger, connection }: Props) { +export function CreateDocumentDialog({ trigger, connection }: Props) { const { __ } = useTranslate(); const organizationId = useOrganizationId(); - const { control, handleSubmit, register, formState, reset } = usePolicyForm(); + const { control, handleSubmit, register, formState, reset } = + useDocumentForm(); const errors = formState.errors ?? {}; - const [createPolicy, isLoading] = - useMutationWithToasts(createPolicyMutation); + const [createDocument, isLoading] = + useMutationWithToasts(createDocumentMutation); const onSubmit = handleSubmit((data) => { - createPolicy({ + createDocument({ variables: { input: { ...data, organizationId, + documentType: "POLICY", }, connections: [connection!], }, - successMessage: __("Policy created successfully."), - errorMessage: __("Failed to create policy. Please try again."), + successMessage: __("Document created successfully."), + errorMessage: __("Failed to create document. Please try again."), onSuccess: () => { dialogRef.current?.close(); reset(); @@ -76,7 +78,7 @@ export function CreatePolicyDialog({ trigger, connection }: Props) { } + title={} >
@@ -86,7 +88,7 @@ export function CreatePolicyDialog({ trigger, connection }: Props) { aria-label={__("Title")} required variant="title" - placeholder={__("Policy title")} + placeholder={__("Document title")} {...register("title")} />