Add document classification

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-10-22 16:23:30 +02:00
parent 36ef29299c
commit c7cabf23de
32 changed files with 891 additions and 229 deletions

View File

@@ -0,0 +1,20 @@
import { useTranslate } from "@probo/i18n";
import { Option } from "@probo/ui";
import {
documentClassifications,
getDocumentClassificationLabel,
} from "@probo/helpers";
export function DocumentClassificationOptions() {
const { __ } = useTranslate();
return (
<>
{documentClassifications.map((classification) => (
<Option key={classification} value={classification}>
{getDocumentClassificationLabel(__, classification)}
</Option>
))}
</>
);
}

View File

@@ -6,12 +6,14 @@ export const documentSchema = z.object({
content: z.string(),
ownerId: z.string(),
documentType: z.enum(["OTHER", "ISMS", "POLICY", "PROCEDURE"]),
classification: z.enum(["PUBLIC", "INTERNAL", "CONFIDENTIAL", "SECRET"]),
});
export const useDocumentForm = () => {
return useFormWithSchema(documentSchema, {
defaultValues: {
documentType: "POLICY",
classification: "INTERNAL",
},
});
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<80c5f44dbb42b6501cd63d626d52518c>>
* @generated SignedSource<<42c3f270cfade27e94b4d0895a0641f5>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -161,6 +161,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -377,12 +384,12 @@ return {
]
},
"params": {
"cacheID": "e3e170d0a40aa1d0d4d07d9d414704ce",
"cacheID": "74570a2b122efea617c7e2559fb51053",
"id": null,
"metadata": {},
"name": "DocumentGraphListQuery",
"operationKind": "query",
"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: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\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: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n classification\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<d4ad1b45197821a3ac5d59350a5646d8>>
* @generated SignedSource<<a39062565d1126fbcbee36865fa8c0fb>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -53,48 +53,68 @@ v3 = {
"storageKey": null
},
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
v5 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
v5 = [
v6 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v5/*: any*/)
],
"storageKey": null
},
v7 = [
{
"kind": "Literal",
"name": "first",
"value": 20
}
],
v6 = {
v8 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
v7 = {
v9 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v8 = {
v10 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
v9 = {
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
},
v10 = {
v12 = {
"kind": "ClientExtension",
"selections": [
{
@@ -106,14 +126,14 @@ v10 = {
}
]
},
v11 = [
v13 = [
{
"kind": "Literal",
"name": "first",
"value": 1000
}
],
v12 = {
v14 = {
"alias": null,
"args": null,
"concreteType": "PageInfo",
@@ -121,8 +141,8 @@ v12 = {
"name": "pageInfo",
"plural": false,
"selections": [
(v8/*: any*/),
(v9/*: any*/)
(v10/*: any*/),
(v11/*: any*/)
],
"storageKey": null
};
@@ -193,22 +213,11 @@ return {
"name": "documentType",
"storageKey": null
},
(v4/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": (v5/*: any*/),
"args": (v7/*: any*/),
"concreteType": "ControlConnection",
"kind": "LinkedField",
"name": "controls",
@@ -231,7 +240,7 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
(v6/*: any*/),
(v8/*: any*/),
{
"alias": null,
"args": null,
@@ -248,7 +257,7 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
(v6/*: any*/)
(v8/*: any*/)
],
"storageKey": null
},
@@ -256,7 +265,7 @@ return {
],
"storageKey": null
},
(v7/*: any*/)
(v9/*: any*/)
],
"storageKey": null
},
@@ -268,8 +277,8 @@ return {
"name": "pageInfo",
"plural": false,
"selections": [
(v8/*: any*/),
(v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
{
"alias": null,
"args": null,
@@ -287,13 +296,13 @@ return {
],
"storageKey": null
},
(v10/*: any*/)
(v12/*: any*/)
],
"storageKey": "controls(first:20)"
},
{
"alias": null,
"args": (v5/*: any*/),
"args": (v7/*: any*/),
"filters": [
"orderBy",
"filter"
@@ -329,7 +338,7 @@ return {
},
{
"alias": null,
"args": (v5/*: any*/),
"args": (v7/*: any*/),
"concreteType": "DocumentVersionConnection",
"kind": "LinkedField",
"name": "versions",
@@ -387,9 +396,11 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v4/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": (v11/*: any*/),
"args": (v13/*: any*/),
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField",
"name": "signatures",
@@ -428,7 +439,7 @@ return {
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
(v5/*: any*/),
{
"alias": null,
"args": null,
@@ -457,18 +468,18 @@ return {
],
"storageKey": null
},
(v7/*: any*/)
(v9/*: any*/)
],
"storageKey": null
},
(v12/*: any*/),
(v10/*: any*/)
(v14/*: any*/),
(v12/*: any*/)
],
"storageKey": "signatures(first:1000)"
},
{
"alias": null,
"args": (v11/*: any*/),
"args": (v13/*: any*/),
"filters": [
"filter"
],
@@ -479,7 +490,7 @@ return {
},
{
"alias": null,
"args": (v11/*: any*/),
"args": (v13/*: any*/),
"filters": [],
"handle": "connection",
"key": "DocumentDetailPage_signatures",
@@ -490,18 +501,18 @@ return {
],
"storageKey": null
},
(v7/*: any*/)
(v9/*: any*/)
],
"storageKey": null
},
(v12/*: any*/),
(v10/*: any*/)
(v14/*: any*/),
(v12/*: any*/)
],
"storageKey": "versions(first:20)"
},
{
"alias": null,
"args": (v5/*: any*/),
"args": (v7/*: any*/),
"filters": null,
"handle": "connection",
"key": "DocumentDetailPage_versions",
@@ -518,12 +529,12 @@ return {
]
},
"params": {
"cacheID": "4dd1a6c2a9117deb789984766f9c3b36",
"cacheID": "72db9b5c4f2a4cd076ebf4e45f0eb662",
"id": null,
"metadata": {},
"name": "DocumentGraphNodeQuery",
"operationKind": "query",
"text": "query DocumentGraphNodeQuery(\n $documentId: ID!\n) {\n node(id: $documentId) {\n __typename\n ... on Document {\n ...DocumentDetailPageDocumentFragment\n }\n id\n }\n}\n\nfragment DocumentControlsTabFragment on Document {\n id\n controls(first: 20) {\n edges {\n node {\n id\n ...LinkedControlsCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment DocumentDetailPageDocumentFragment on Document {\n id\n title\n documentType\n owner {\n id\n fullName\n }\n ...DocumentControlsTabFragment\n controlsInfo: controls(first: 0) {\n totalCount\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n ...DocumentSignaturesTab_version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesTab_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentSignaturesTab_signature on DocumentVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment DocumentSignaturesTab_version on DocumentVersion {\n id\n status\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n signedBy {\n id\n fullName\n primaryEmailAddress\n }\n ...DocumentSignaturesTab_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment LinkedControlsCardFragment on Control {\n id\n name\n sectionTitle\n framework {\n id\n name\n }\n}\n"
"text": "query DocumentGraphNodeQuery(\n $documentId: ID!\n) {\n node(id: $documentId) {\n __typename\n ... on Document {\n ...DocumentDetailPageDocumentFragment\n }\n id\n }\n}\n\nfragment DocumentControlsTabFragment on Document {\n id\n controls(first: 20) {\n edges {\n node {\n id\n ...LinkedControlsCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment DocumentDetailPageDocumentFragment on Document {\n id\n title\n documentType\n classification\n owner {\n id\n fullName\n }\n ...DocumentControlsTabFragment\n controlsInfo: controls(first: 0) {\n totalCount\n }\n versions(first: 20) {\n edges {\n node {\n id\n content\n status\n publishedAt\n version\n updatedAt\n classification\n owner {\n id\n fullName\n }\n ...DocumentSignaturesTab_version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesTab_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment DocumentSignaturesTab_signature on DocumentVersionSignature {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n primaryEmailAddress\n id\n }\n}\n\nfragment DocumentSignaturesTab_version on DocumentVersion {\n id\n status\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n signedBy {\n id\n fullName\n primaryEmailAddress\n }\n ...DocumentSignaturesTab_signature\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment LinkedControlsCardFragment on Control {\n id\n name\n sectionTitle\n framework {\n id\n name\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<18b931f119e8ef68f016dfcdf76366cc>>
* @generated SignedSource<<383c2d6a9d25911bb5df8c148a8a3e51>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,9 +10,11 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type UpdateDocumentInput = {
classification?: DocumentClassification | null | undefined;
content?: string | null | undefined;
documentType?: DocumentType | null | undefined;
id: string;

View File

@@ -49,8 +49,10 @@ import { useOrganizationId } from "/hooks/useOrganizationId";
import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import {
getDocumentTypeLabel,
getDocumentClassificationLabel,
sprintf,
documentTypes,
documentClassifications,
formatDate,
} from "@probo/helpers";
import {
@@ -71,6 +73,7 @@ import clsx from "clsx";
import { PeopleSelectField } from "/components/form/PeopleSelectField";
import { ControlledField } from "/components/form/ControlledField";
import { DocumentTypeOptions } from "/components/form/DocumentTypeOptions";
import { DocumentClassificationOptions } from "/components/form/DocumentClassificationOptions";
import { z } from "zod";
import { useFormWithSchema } from "/hooks/useFormWithSchema";
@@ -83,6 +86,7 @@ const documentFragment = graphql`
id
title
documentType
classification
owner {
id
fullName
@@ -101,6 +105,11 @@ const documentFragment = graphql`
publishedAt
version
updatedAt
classification
owner {
id
fullName
}
...DocumentSignaturesTab_version
signatures(first: 1000)
@connection(key: "DocumentDetailPage_signatures", filters: []) {
@@ -128,6 +137,7 @@ graphql`
title
description
documentType
classification
updatedAt
owner {
id
@@ -182,6 +192,7 @@ const updateDocumentMutation = graphql`
id
title
documentType
classification
owner {
id
fullName
@@ -195,6 +206,7 @@ const documentUpdateSchema = z.object({
title: z.string().min(1, "Title is required").max(255),
ownerId: z.string().min(1, "Owner is required"),
documentType: z.enum(documentTypes),
classification: z.enum(documentClassifications),
});
const UserEmailQuery = graphql`
@@ -221,6 +233,7 @@ export default function DocumentDetailPage(props: Props) {
const [isEditingTitle, setIsEditingTitle] = useState(false);
const [isEditingOwner, setIsEditingOwner] = useState(false);
const [isEditingType, setIsEditingType] = useState(false);
const [isEditingClassification, setIsEditingClassification] = useState(false);
const versions = document.versions.edges.map((edge) => edge.node);
const currentVersion =
document.versions.edges.find((v) => v.node.id === versionId)?.node ??
@@ -267,8 +280,9 @@ export default function DocumentDetailPage(props: Props) {
{
defaultValues: {
title: document.title,
ownerId: document.owner?.id || "",
ownerId: currentVersion.owner?.id || "",
documentType: document.documentType,
classification: currentVersion.classification,
},
}
);
@@ -325,6 +339,28 @@ export default function DocumentDetailPage(props: Props) {
});
};
const handleUpdateClassification = (data: {
classification: (typeof documentClassifications)[number];
}) => {
updateDocument({
variables: {
input: {
id: document.id,
classification: data.classification,
},
},
onSuccess: () => {
setIsEditingClassification(false);
loadQuery(
props.queryRef.environment,
documentNodeQuery,
props.queryRef.variables,
{ fetchPolicy: "network-only" }
);
},
});
};
const handlePublish = () => {
publishDocumentVersion({
variables: {
@@ -610,8 +646,8 @@ export default function DocumentDetailPage(props: Props) {
) : (
<ReadOnlyPropertyContent onEdit={() => setIsEditingOwner(true)}>
<Badge variant="highlight" size="md" className="gap-2">
<Avatar name={document.owner?.fullName ?? ""} />
{document.owner?.fullName}
<Avatar name={currentVersion.owner?.fullName ?? ""} />
{currentVersion.owner?.fullName}
</Badge>
</ReadOnlyPropertyContent>
)}
@@ -642,6 +678,34 @@ export default function DocumentDetailPage(props: Props) {
</ReadOnlyPropertyContent>
)}
</PropertyRow>
<PropertyRow label={__("Classification")}>
{isEditingClassification ? (
<EditablePropertyContent
onSave={handleSubmit(handleUpdateClassification)}
onCancel={() => {
setIsEditingClassification(false);
reset();
}}
disabled={isUpdatingDocument}
>
<ControlledField
name="classification"
control={control}
type="select"
>
<DocumentClassificationOptions />
</ControlledField>
</EditablePropertyContent>
) : (
<ReadOnlyPropertyContent
onEdit={() => setIsEditingClassification(true)}
>
<div className="text-sm text-txt-secondary">
{getDocumentClassificationLabel(__, currentVersion.classification)}
</div>
</ReadOnlyPropertyContent>
)}
</PropertyRow>
<PropertyRow label={__("Status")}>
<Badge
variant={isDraft ? "highlight" : "success"}

View File

@@ -41,7 +41,12 @@ import {
} from "/hooks/graph/DocumentGraph";
import type { DocumentsPageListFragment$key } from "./__generated__/DocumentsPageListFragment.graphql";
import { useList, usePageTitle } from "@probo/hooks";
import { sprintf, getDocumentTypeLabel, formatDate } from "@probo/helpers";
import {
sprintf,
getDocumentTypeLabel,
getDocumentClassificationLabel,
formatDate,
} from "@probo/helpers";
import { CreateDocumentDialog } from "./dialogs/CreateDocumentDialog";
import type { DocumentsPageRowFragment$key } from "./__generated__/DocumentsPageRowFragment.graphql";
import { SortableTable, SortableTh } from "/components/SortableTable";
@@ -223,6 +228,7 @@ export default function DocumentsPage(props: Props) {
<SortableTh field="DOCUMENT_TYPE" className="w-28">
{__("Type")}
</SortableTh>
<Th className="w-32">{__("Classification")}</Th>
<Th className="w-60">{__("Owner")}</Th>
<Th className="w-60">{__("Last update")}</Th>
<Th className="w-20">{__("Signatures")}</Th>
@@ -230,7 +236,7 @@ export default function DocumentsPage(props: Props) {
</Tr>
) : (
<Tr>
<Th colspan={9} compact>
<Th colspan={10} compact>
<div className="flex justify-between items-center h-8">
<div className="flex gap-2 items-center">
{sprintf(__("%s documents selected"), selection.length)} -
@@ -330,6 +336,7 @@ const rowFragment = graphql`
title
description
documentType
classification
updatedAt
owner {
id
@@ -424,6 +431,9 @@ function DocumentRow({
<Td className="w-28">
{getDocumentTypeLabel(__, document.documentType)}
</Td>
<Td className="w-32">
{getDocumentClassificationLabel(__, document.classification)}
</Td>
<Td className="w-60">
<div className="flex gap-2 items-center">
<Avatar name={document.owner?.fullName ?? ""} />

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<c39dd56e0397cd63ae1d2da95977694c>>
* @generated SignedSource<<3ba79250c6ba07fa44aca6eff28b3d9d>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,11 +9,13 @@
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime";
export type DocumentDetailPageDocumentFragment$data = {
readonly classification: DocumentClassification;
readonly controlsInfo: {
readonly totalCount: number;
};
@@ -28,8 +30,13 @@ export type DocumentDetailPageDocumentFragment$data = {
readonly __id: string;
readonly edges: ReadonlyArray<{
readonly node: {
readonly classification: DocumentClassification;
readonly content: string;
readonly id: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
};
readonly publishedAt: any | null | undefined;
readonly signatures: {
readonly __id: string;
@@ -71,17 +78,43 @@ v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"name": "classification",
"storageKey": null
},
v2 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v0/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
}
],
"storageKey": null
},
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v3 = {
v5 = {
"alias": null,
"args": null,
"concreteType": "PageInfo",
@@ -106,7 +139,7 @@ v3 = {
],
"storageKey": null
},
v4 = {
v6 = {
"kind": "ClientExtension",
"selections": [
{
@@ -156,25 +189,8 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v0/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
}
],
"storageKey": null
},
(v1/*: any*/),
(v2/*: any*/),
{
"args": null,
"kind": "FragmentSpread",
@@ -264,6 +280,8 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v1/*: any*/),
(v2/*: any*/),
{
"args": null,
"kind": "FragmentSpread",
@@ -318,29 +336,29 @@ return {
"kind": "FragmentSpread",
"name": "DocumentSignaturesTab_signature"
},
(v1/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
(v2/*: any*/)
(v4/*: any*/)
],
"storageKey": null
},
(v3/*: any*/),
(v4/*: any*/)
(v5/*: any*/),
(v6/*: any*/)
],
"storageKey": null
},
(v1/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
(v2/*: any*/)
(v4/*: any*/)
],
"storageKey": null
},
(v3/*: any*/),
(v4/*: any*/)
(v5/*: any*/),
(v6/*: any*/)
],
"storageKey": null
}
@@ -350,6 +368,6 @@ return {
};
})();
(node as any).hash = "f1a7ec789a05b74cade1d3024119a844";
(node as any).hash = "e1418d5efeade64db32e9939132c03de";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<c802e03e4097ba191cb3738a0e45a4ed>>
* @generated SignedSource<<80564e817a10279d3bcbed4ad0ce8e27>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -135,6 +135,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -264,12 +271,12 @@ return {
]
},
"params": {
"cacheID": "e7734d4aece1b73c9bd85eddfbda2548",
"cacheID": "abf83afc77c45fa28de8d3c711633ec3",
"id": null,
"metadata": {},
"name": "DocumentDetailPagePublishMutation",
"operationKind": "mutation",
"text": "mutation DocumentDetailPagePublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n ...DocumentDetailPageRowFragment\n }\n }\n}\n\nfragment DocumentDetailPageRowFragment on Document {\n id\n title\n description\n documentType\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": "mutation DocumentDetailPagePublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n ...DocumentDetailPageRowFragment\n }\n }\n}\n\nfragment DocumentDetailPageRowFragment on Document {\n id\n title\n description\n documentType\n classification\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"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<07388b39e4109439464531d46a890841>>
* @generated SignedSource<<f6a6c2f623522098263a3b556d3c3658>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,11 +9,13 @@
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime";
export type DocumentDetailPageRowFragment$data = {
readonly classification: DocumentClassification;
readonly description: string;
readonly documentType: DocumentType;
readonly id: string;
@@ -82,6 +84,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -208,6 +217,6 @@ return {
};
})();
(node as any).hash = "2144e456e031960d8ceefd334741831e";
(node as any).hash = "405e3b543fa517a3754d74b4f8c03d46";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<575a6c27726fb3e5457989b0d5a4edc2>>
* @generated SignedSource<<7c1bfb7a8cc7cc0f426348c57a17f7c9>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,9 +9,11 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type UpdateDocumentInput = {
classification?: DocumentClassification | null | undefined;
content?: string | null | undefined;
documentType?: DocumentType | null | undefined;
id: string;
@@ -25,6 +27,7 @@ export type DocumentDetailPageUpdateMutation$variables = {
export type DocumentDetailPageUpdateMutation$data = {
readonly updateDocument: {
readonly document: {
readonly classification: DocumentClassification;
readonly documentType: DocumentType;
readonly id: string;
readonly owner: {
@@ -93,6 +96,13 @@ v2 = [
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -137,16 +147,16 @@ return {
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "23268b13b11a1a56164dcc4cb96e24b3",
"cacheID": "865056a65394e413822f798f31351341",
"id": null,
"metadata": {},
"name": "DocumentDetailPageUpdateMutation",
"operationKind": "mutation",
"text": "mutation DocumentDetailPageUpdateMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n title\n documentType\n owner {\n id\n fullName\n }\n }\n }\n}\n"
"text": "mutation DocumentDetailPageUpdateMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n title\n documentType\n classification\n owner {\n id\n fullName\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "507a2bd40b923d2064fdd864f16f29aa";
(node as any).hash = "bd6acddfc137a6bdce42628d05dc9ff6";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<739800753f29986463be3d9e4316a44a>>
* @generated SignedSource<<83dad18be7a9249bb99048ba14b6de41>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -236,6 +236,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -452,12 +459,12 @@ return {
]
},
"params": {
"cacheID": "ce2facebbd111ac1b3398933a5a06a05",
"cacheID": "2f5cd9919b919f4e9d80354cb26d3e9d",
"id": null,
"metadata": {},
"name": "DocumentsListQuery",
"operationKind": "query",
"text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentsPageListFragment_16fISc\n id\n }\n}\n\nfragment DocumentsPageListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
"text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentsPageListFragment_16fISc\n id\n }\n}\n\nfragment DocumentsPageListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n ...DocumentsPageRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n classification\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<96486371decaf730cf0a559125086bd8>>
* @generated SignedSource<<e853bbeba41d33327ee6612c84e21297>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,11 +9,13 @@
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime";
export type DocumentsPageRowFragment$data = {
readonly classification: DocumentClassification;
readonly description: string;
readonly documentType: DocumentType;
readonly id: string;
@@ -83,6 +85,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -216,6 +225,6 @@ return {
};
})();
(node as any).hash = "4151906ef10da152d053c46af6b9f890";
(node as any).hash = "cd6d6bebffb9ed17a251aeef4b86f753";
export default node;

View File

@@ -21,6 +21,7 @@ import { PeopleSelectField } from "/components/form/PeopleSelectField";
import type { CreateDocumentDialogMutation } from "./__generated__/CreateDocumentDialogMutation.graphql";
import { ControlledField } from "/components/form/ControlledField";
import { DocumentTypeOptions } from "/components/form/DocumentTypeOptions";
import { DocumentClassificationOptions } from "/components/form/DocumentClassificationOptions";
type Props = {
trigger?: ReactNode;
@@ -125,6 +126,20 @@ export function CreateDocumentDialog({ trigger, connection }: Props) {
</ControlledField>
</PropertyRow>
<PropertyRow
id="classification"
label={__("Classification")}
error={errors.classification?.message}
>
<ControlledField
control={control}
name="classification"
type="select"
>
<DocumentClassificationOptions />
</ControlledField>
</PropertyRow>
<PropertyRow
id="ownerId"
label={__("Owner")}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<429de5dec69b88e0abedd39ecac81ee3>>
* @generated SignedSource<<8f842e1d6a4c314a9bfba43097ac2795>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,9 +10,11 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type CreateDocumentInput = {
classification: DocumentClassification;
content: string;
documentType: DocumentType;
organizationId: string;
@@ -172,6 +174,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -327,12 +336,12 @@ return {
]
},
"params": {
"cacheID": "0a5f7934a498b696a268943176bdf910",
"cacheID": "319502472cd9600df506f084a7648571",
"id": null,
"metadata": {},
"name": "CreateDocumentDialogMutation",
"operationKind": "mutation",
"text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentsPageRowFragment\n }\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
"text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentsPageRowFragment\n }\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n classification\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<18ebf050c9c9ec64b126385ad8b8dd7d>>
* @generated SignedSource<<bf6b6a8a1f99fd0bfcc4eda44bbfe352>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -156,6 +156,13 @@ return {
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "classification",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -295,12 +302,12 @@ return {
]
},
"params": {
"cacheID": "5c79c67dcab25c8ead714ff999b0e7cf",
"cacheID": "d3e85ba061ad3937ad4a3c6727eb76fa",
"id": null,
"metadata": {},
"name": "PublishDocumentsDialogMutation",
"operationKind": "mutation",
"text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentsPageRowFragment\n }\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
"text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentsPageRowFragment\n }\n }\n }\n}\n\nfragment DocumentsPageRowFragment on Document {\n id\n title\n description\n documentType\n classification\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n}\n"
}
};
})();