Add type to document

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-05-30 09:15:49 -07:00
parent e1b4079e1f
commit 2391b19db3
17 changed files with 7433 additions and 6257 deletions

View File

@@ -45,6 +45,13 @@ import {
import PeopleSelector from "@/components/PeopleSelector";
import type { PeopleSelector_organization$key } from "@/components/__generated__/PeopleSelector_organization.graphql";
import { Textarea } from "@/components/ui/textarea";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
const documentListViewQuery = graphql`
query DocumentListViewQuery($organizationId: ID!) {
@@ -64,6 +71,7 @@ const documentListViewQuery = graphql`
id
title
description
documentType
currentPublishedVersion
createdAt
updatedAt
@@ -229,6 +237,17 @@ function DocumentTableRow({
</span>
</div>
</td>
<td className="py-4 px-6">
<Badge
className={`font-medium border-0 py-0 px-[6px] h-5 text-xs rounded-md bg-secondary-bg text-tertiary`}
>
{document.documentType === "POLICY"
? "Policy"
: document.documentType === "ISMS"
? "ISMS"
: "Other"}
</Badge>
</td>
<td className="py-4 px-6">
<span className="text-sm text-primary">
{document.owner?.fullName || "Unassigned"}
@@ -306,6 +325,7 @@ function CreateDocumentModal({
const [title, setTitle] = useState("");
const [content, setContent] = useState("");
const [ownerId, setOwnerId] = useState<string | null>(null);
const [documentType, setDocumentType] = useState<"OTHER" | "ISMS" | "POLICY">("POLICY");
const [createDocument, isCreating] =
useMutation<DocumentListViewCreateMutation>(createDocumentMutation);
@@ -341,6 +361,7 @@ function CreateDocumentModal({
title,
content,
ownerId,
documentType,
};
createDocument({
@@ -443,7 +464,9 @@ function CreateDocumentModal({
></h1>
</div>
<Textarea
placeholder="This Privacy Document outlines how NovaSoft collects, uses, and protects personal information provided by users of its services. By accessing or using our platform, you agree to the collection and use of information in accordance with this document..."
placeholder="
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur euismod ligula pretium elit rhoncus, ut tincidunt ligula luctus. Sed pulvinar porta blandit. Praesent odio ligula, tristique a rutrum non, imperdiet ut urna. Aenean at metus vitae diam lacinia auctor. Nullam fermentum volutpat magna. Curabitur tincidunt mauris sit amet velit lacinia..."
className="min-h-[300px] border-none resize-none p-0 focus-visible:ring-0 focus-visible:ring-offset-0"
value={content}
onChange={(e) => setContent(e.target.value)}
@@ -454,14 +477,28 @@ function CreateDocumentModal({
<div className="flex flex-col gap-4">
<div className="flex justify-between items-center py-2 border-t border-[rgba(2,42,2,0.08)]">
<span className="text-sm font-medium text-tertiary">
Status
</span>
<span className="text-sm font-medium text-tertiary">Status</span>
<div className="bg-[rgba(0,39,0,0.05)] py-1.5 px-2 rounded-lg">
<span className="text-sm font-medium">Draft</span>
</div>
</div>
<div className="flex justify-between items-center py-2 border-t border-[rgba(2,42,2,0.08)]">
<span className="text-sm font-medium text-tertiary">Document Type</span>
<div className="relative">
<Select value={documentType} onValueChange={(value: "OTHER" | "ISMS" | "POLICY") => setDocumentType(value)}>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Select type" />
</SelectTrigger>
<SelectContent>
<SelectItem value="POLICY">Policy</SelectItem>
<SelectItem value="ISMS">ISMS</SelectItem>
<SelectItem value="OTHER">Other</SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div className="flex justify-between items-center py-2 border-t border-[rgba(2,42,2,0.08)]">
<span className="text-sm font-medium text-tertiary">Owner</span>
<div className="relative">
@@ -604,6 +641,12 @@ function DocumentListViewContent({
<ChevronDown className="h-3 w-3 text-quaternary" />
</div>
</th>
<th className="py-3 px-6 text-xs font-medium text-tertiary border-b border-low-b">
<div className="flex items-center gap-1">
Type
<ChevronDown className="h-3 w-3 text-quaternary" />
</div>
</th>
<th className="py-3 px-6 text-xs font-medium text-tertiary border-b border-low-b">
<div className="flex items-center gap-1">
Owner

View File

@@ -16,6 +16,7 @@ import {
MoreHorizontal,
X,
FileSignature,
User,
} from "lucide-react";
import { Button } from "@/components/ui/button";
import { useToast } from "@/hooks/use-toast";
@@ -23,6 +24,9 @@ import { PageTemplate } from "@/components/PageTemplate";
import type { ShowDocumentViewQuery } from "./__generated__/ShowDocumentViewQuery.graphql";
import { ShowDocumentViewPublishMutation } from "./__generated__/ShowDocumentViewPublishMutation.graphql";
import { ShowDocumentViewCreateDraftMutation } from "./__generated__/ShowDocumentViewCreateDraftMutation.graphql";
import { ShowDocumentViewUpdateDocumentMutation } from "./__generated__/ShowDocumentViewUpdateDocumentMutation.graphql";
import { ShowDocumentViewUpdateDocumentTypeMutation } from "./__generated__/ShowDocumentViewUpdateDocumentTypeMutation.graphql";
import type { DocumentType } from "./__generated__/DocumentListViewCreateMutation.graphql";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import { ShowDocumentViewSkeleton } from "./ShowDocumentPage";
@@ -47,12 +51,15 @@ import rehypeRaw from "rehype-raw";
import { createRoot } from "react-dom/client";
import { documentVersionsFragment } from "./SignaturesModal";
import type { SignaturesModal_documentVersions$key } from "./__generated__/SignaturesModal_documentVersions.graphql";
import PeopleSelector from "@/components/PeopleSelector";
import { Label } from "@/components/ui/label";
const documentViewQuery = graphql`
query ShowDocumentViewQuery($documentId: ID!, $organizationId: ID!) {
organization: node(id: $organizationId) {
... on Organization {
name
...PeopleSelector_organization
}
}
@@ -64,6 +71,7 @@ const documentViewQuery = graphql`
createdAt
updatedAt
currentPublishedVersion
documentType
owner {
id
fullName
@@ -130,6 +138,22 @@ const createDraftDocumentVersionMutation = graphql`
}
`;
const updateDocumentMutation = graphql`
mutation ShowDocumentViewUpdateDocumentMutation($input: UpdateDocumentInput!) {
updateDocument(input: $input) {
document {
id
documentType
owner {
id
fullName
primaryEmailAddress
}
}
}
}
`;
function ShowDocumentContent({
queryRef,
}: {
@@ -150,6 +174,8 @@ function ShowDocumentContent({
const [isDeleting, setIsDeleting] = useState(false);
const [isVersionHistoryOpen, setIsVersionHistoryOpen] = useState(false);
const [isSignaturesModalOpen, setIsSignaturesModalOpen] = useState(false);
const [isEditingOwner, setIsEditingOwner] = useState(false);
const [isEditingType, setIsEditingType] = useState(false);
const printContentRef = useRef<HTMLDivElement>(null);
const [publishDraft, isPublishInFlight] =
@@ -158,12 +184,96 @@ function ShowDocumentContent({
useMutation<ShowDocumentViewCreateDraftMutation>(
createDraftDocumentVersionMutation,
);
const [updateDocument, isUpdatingDocument] =
useMutation<ShowDocumentViewUpdateDocumentMutation>(updateDocumentMutation);
const latestVersionEdge = documentValue.latestVersion?.edges[0];
const latestVersionNode = latestVersionEdge?.node;
const isDraft = latestVersionNode?.status === "DRAFT";
// Handle owner update
const handleOwnerUpdate = useCallback((newOwnerId: string) => {
if (!documentValue.id) return;
updateDocument({
variables: {
input: {
id: documentValue.id,
title: documentValue.title,
content: documentValue.latestVersion?.edges[0]?.node?.content || '',
ownerId: newOwnerId,
},
},
onCompleted: (_, errors) => {
if (errors) {
toast({
title: "Error updating owner",
description: errors[0]?.message || "An unknown error occurred",
variant: "destructive",
});
return;
}
toast({
title: "Success",
description: "Document owner updated successfully",
});
setIsEditingOwner(false);
// Reload the query to refresh the data
loadQuery({ documentId: documentValue.id, organizationId: organizationId! });
},
onError: (error) => {
toast({
title: "Error updating owner",
description: error.message || "An unknown error occurred",
variant: "destructive",
});
},
});
}, [documentValue.id, updateDocument, toast, loadQuery, organizationId]);
// Handle document type update
const handleTypeUpdate = useCallback((newType: DocumentType) => {
if (!documentValue.id) return;
updateDocument({
variables: {
input: {
id: documentValue.id,
documentType: newType,
},
},
onCompleted: (_, errors) => {
if (errors) {
toast({
title: "Error updating document type",
description: errors[0]?.message || "An unknown error occurred",
variant: "destructive",
});
return;
}
toast({
title: "Success",
description: "Document type updated successfully",
});
setIsEditingType(false);
// Reload the query to refresh the data
loadQuery({ documentId: documentValue.id, organizationId: organizationId! });
},
onError: (error) => {
toast({
title: "Error updating document type",
description: error.message || "An unknown error occurred",
variant: "destructive",
});
},
});
}, [documentValue.id, updateDocument, toast, loadQuery, organizationId]);
useEffect(() => {
// No need to update selectedVersion state since we're using the VersionHistoryModal component
}, []);
@@ -560,7 +670,77 @@ function ShowDocumentContent({
<span className="font-medium">Published Date:</span> {latestVersionNode.status === "PUBLISHED" ? formatDate(latestVersionNode.publishedAt || "") : "Not yet published"}
</div>
<div>
<span className="font-medium">Owner:</span> {documentValue.owner?.fullName || "Unknown"}
<div className="flex items-center gap-2">
<span className="font-medium">Owner:</span>
{isEditingOwner ? (
<div className="flex items-center gap-2">
<div className="w-[350px]">
<PeopleSelector
organizationRef={data.organization}
selectedPersonId={documentValue.owner?.id || ""}
onSelect={handleOwnerUpdate}
placeholder="Select document owner"
required={true}
/>
</div>
<Button
variant="outline"
size="sm"
onClick={() => setIsEditingOwner(false)}
disabled={isUpdatingDocument}
>
Cancel
</Button>
</div>
) : (
<div className="flex items-center gap-2">
<span>{documentValue.owner?.fullName || "Unknown"}</span>
<Button
variant="outline"
size="sm"
onClick={() => setIsEditingOwner(true)}
>
Change
</Button>
</div>
)}
</div>
</div>
<div>
<div className="flex items-center gap-2">
<span className="font-medium">Document Type:</span>
{isEditingType ? (
<div className="flex items-center gap-2">
<select
className="h-9 w-[200px] rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors"
value={ documentValue.documentType }
onChange={(e) => handleTypeUpdate(e.target.value as DocumentType)}
>
<option value="POLICY">Policy</option>
<option value="ISMS">ISMS</option>
<option value="OTHER">Other</option>
</select>
<Button
variant="outline"
size="sm"
onClick={() => setIsEditingType(false)}
>
Cancel
</Button>
</div>
) : (
<div className="flex items-center gap-2">
<span>{ documentValue.documentType === "ISMS" ? "ISMS" : documentValue.documentType === "POLICY" ? "Policy" : "Other" }</span>
<Button
variant="outline"
size="sm"
onClick={() => setIsEditingType(true)}
>
Change
</Button>
</div>
)}
</div>
</div>
<div>
<span className="font-medium">Last Modified:</span> {formatDate(latestVersionNode.updatedAt)}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<095491df1cce828cc3ec9ba9f2ad4183>>
* @generated SignedSource<<83ccc4aaa1b2380bfc185c4a6dd8806a>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,8 +9,10 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type CreateDocumentInput = {
content: string;
documentType: DocumentType;
organizationId: string;
ownerId: string;
title: string;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<4ae1fa075cd3c3fd2ae9d63e3ec0ae02>>
* @generated SignedSource<<2a0020cb72b5e7296b156bfd4d10cd35>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,6 +11,7 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
export type DocumentListViewQuery$variables = {
organizationId: string;
@@ -23,6 +24,7 @@ export type DocumentListViewQuery$data = {
readonly createdAt: string;
readonly currentPublishedVersion: number | null | undefined;
readonly description: string;
readonly documentType: DocumentType;
readonly id: string;
readonly owner: {
readonly fullName: string;
@@ -195,6 +197,13 @@ v11 = [
"name": "description",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -519,7 +528,7 @@ return {
]
},
"params": {
"cacheID": "6b91a4a77bedb9f66abeaeec8c1c5535",
"cacheID": "fae30dd5b946e2e95ddc19c2956cdf3f",
"id": null,
"metadata": {
"connection": [
@@ -536,11 +545,11 @@ return {
},
"name": "DocumentListViewQuery",
"operationKind": "query",
"text": "query DocumentListViewQuery(\n $organizationId: ID!\n) {\n viewer {\n user {\n id\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...PeopleSelector_organization\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n title\n description\n currentPublishedVersion\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
"text": "query DocumentListViewQuery(\n $organizationId: ID!\n) {\n viewer {\n user {\n id\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n ...PeopleSelector_organization\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n title\n description\n documentType\n currentPublishedVersion\n createdAt\n updatedAt\n owner {\n id\n fullName\n }\n versions(first: 1) {\n edges {\n node {\n id\n status\n updatedAt\n signatures(first: 100) {\n edges {\n node {\n id\n state\n }\n }\n }\n }\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
(node as any).hash = "df33668bcdfe69a122a8846bb1d66df1";
(node as any).hash = "4ed6ed2633b4c113bc88e19ac1db96b5";
export default node;

View File

@@ -0,0 +1,114 @@
/**
* @generated SignedSource<<6501e136d1171aaca8238084a7606a9e>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type UpdateDocumentVersionInput = {
content: string;
documentVersionId: string;
};
export type EditDocumentViewVersionMutation$variables = {
input: UpdateDocumentVersionInput;
};
export type EditDocumentViewVersionMutation$data = {
readonly updateDocumentVersion: {
readonly documentVersion: {
readonly content: string;
readonly id: string;
};
};
};
export type EditDocumentViewVersionMutation = {
response: EditDocumentViewVersionMutation$data;
variables: EditDocumentViewVersionMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
}
],
v1 = [
{
"alias": null,
"args": [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
],
"concreteType": "UpdateDocumentVersionPayload",
"kind": "LinkedField",
"name": "updateDocumentVersion",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "DocumentVersion",
"kind": "LinkedField",
"name": "documentVersion",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "content",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "EditDocumentViewVersionMutation",
"selections": (v1/*: any*/),
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "EditDocumentViewVersionMutation",
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "aa2a1c45efb2771987bf777971585e92",
"id": null,
"metadata": {},
"name": "EditDocumentViewVersionMutation",
"operationKind": "mutation",
"text": "mutation EditDocumentViewVersionMutation(\n $input: UpdateDocumentVersionInput!\n) {\n updateDocumentVersion(input: $input) {\n documentVersion {\n id\n content\n }\n }\n}\n"
}
};
})();
(node as any).hash = "656a8d74e00bb9e15e42987775bb1d14";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f7c8f2df8a102d1bd15cb053d146a8b1>>
* @generated SignedSource<<bf950636055ed83dd68cd6e513a4d83e>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,6 +11,7 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type ShowDocumentViewQuery$variables = {
documentId: string;
organizationId: string;
@@ -20,6 +21,7 @@ export type ShowDocumentViewQuery$data = {
readonly createdAt?: string;
readonly currentPublishedVersion?: number | null | undefined;
readonly description?: string;
readonly documentType?: DocumentType;
readonly id: string;
readonly latestVersion?: {
readonly edges: ReadonlyArray<{
@@ -49,6 +51,7 @@ export type ShowDocumentViewQuery$data = {
};
readonly organization: {
readonly name?: string;
readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">;
};
};
export type ShowDocumentViewQuery = {
@@ -77,18 +80,11 @@ v1 = [
}
],
v2 = {
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
}
],
"type": "Organization",
"abstractKey": null
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
v3 = [
{
@@ -143,10 +139,24 @@ v10 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"name": "documentType",
"storageKey": null
},
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"concreteType": "People",
@@ -155,86 +165,124 @@ v11 = {
"plural": false,
"selections": [
(v4/*: any*/),
(v10/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
}
(v11/*: any*/),
(v12/*: any*/)
],
"storageKey": null
},
v12 = [
v14 = [
{
"kind": "Literal",
"name": "first",
"value": 1
}
],
v13 = {
v15 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "version",
"storageKey": null
},
v14 = {
v16 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "status",
"storageKey": null
},
v15 = {
v17 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "content",
"storageKey": null
},
v16 = {
v18 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "changelog",
"storageKey": null
},
v17 = {
v19 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "publishedAt",
"storageKey": null
},
v18 = {
v20 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v19 = [
(v10/*: any*/),
v21 = {
"kind": "Literal",
"name": "first",
"value": 100
},
v22 = [
(v21/*: any*/),
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "ASC",
"field": "FULL_NAME"
}
}
],
v23 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v24 = {
"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
},
v25 = [
(v11/*: any*/),
(v4/*: any*/)
],
v20 = {
v26 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "publishedBy",
"plural": false,
"selections": (v19/*: any*/),
"selections": (v25/*: any*/),
"storageKey": null
},
v21 = [
{
"kind": "Literal",
"name": "first",
"value": 100
}
v27 = [
(v21/*: any*/)
];
return {
"fragment": {
@@ -251,7 +299,19 @@ return {
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/)
{
"kind": "InlineFragment",
"selections": [
(v2/*: any*/),
{
"args": null,
"kind": "FragmentSpread",
"name": "PeopleSelector_organization"
}
],
"type": "Organization",
"abstractKey": null
}
],
"storageKey": null
},
@@ -272,7 +332,8 @@ return {
(v7/*: any*/),
(v8/*: any*/),
(v9/*: any*/),
(v11/*: any*/),
(v10/*: any*/),
(v13/*: any*/),
{
"args": null,
"kind": "FragmentSpread",
@@ -285,7 +346,7 @@ return {
},
{
"alias": "latestVersion",
"args": (v12/*: any*/),
"args": (v14/*: any*/),
"concreteType": "DocumentVersionConnection",
"kind": "LinkedField",
"name": "versions",
@@ -308,11 +369,11 @@ return {
"plural": false,
"selections": [
(v4/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
{
"alias": null,
"args": null,
@@ -321,7 +382,7 @@ return {
"name": "publishedBy",
"plural": false,
"selections": [
(v10/*: any*/)
(v11/*: any*/)
],
"storageKey": null
},
@@ -361,9 +422,66 @@ return {
"name": "node",
"plural": false,
"selections": [
(v18/*: any*/),
(v2/*: any*/),
(v4/*: any*/)
(v20/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
"selections": [
(v2/*: any*/),
{
"alias": null,
"args": (v22/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "PeopleEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v4/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v20/*: any*/)
],
"storageKey": null
},
(v23/*: any*/)
],
"storageKey": null
},
(v24/*: any*/)
],
"storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
},
{
"alias": null,
"args": (v22/*: any*/),
"filters": [
"orderBy"
],
"handle": "connection",
"key": "PeopleSelector_organization_peoples",
"kind": "LinkedHandle",
"name": "peoples"
}
],
"type": "Organization",
"abstractKey": null
}
],
"storageKey": null
},
@@ -375,7 +493,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v18/*: any*/),
(v20/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
@@ -385,7 +503,8 @@ return {
(v7/*: any*/),
(v8/*: any*/),
(v9/*: any*/),
(v11/*: any*/),
(v10/*: any*/),
(v13/*: any*/),
{
"alias": "documentVersions",
"args": [
@@ -417,14 +536,14 @@ return {
"plural": false,
"selections": [
(v4/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v17/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v19/*: any*/),
(v8/*: any*/),
(v20/*: any*/),
(v26/*: any*/),
{
"alias": null,
"args": (v21/*: any*/),
"args": (v27/*: any*/),
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField",
"name": "signatures",
@@ -475,7 +594,7 @@ return {
"kind": "LinkedField",
"name": "signedBy",
"plural": false,
"selections": (v19/*: any*/),
"selections": (v25/*: any*/),
"storageKey": null
},
{
@@ -485,54 +604,24 @@ return {
"kind": "LinkedField",
"name": "requestedBy",
"plural": false,
"selections": (v19/*: any*/),
"selections": (v25/*: any*/),
"storageKey": null
},
(v18/*: any*/)
(v20/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
(v23/*: any*/)
],
"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
}
(v24/*: any*/)
],
"storageKey": "signatures(first:100)"
},
{
"alias": null,
"args": (v21/*: any*/),
"args": (v27/*: any*/),
"filters": null,
"handle": "connection",
"key": "SignaturesModal_documentVersions_signatures",
@@ -579,13 +668,13 @@ return {
"plural": false,
"selections": [
(v4/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
(v8/*: any*/),
(v20/*: any*/)
(v26/*: any*/)
],
"storageKey": null
}
@@ -597,7 +686,7 @@ return {
},
{
"alias": "latestVersion",
"args": (v12/*: any*/),
"args": (v14/*: any*/),
"concreteType": "DocumentVersionConnection",
"kind": "LinkedField",
"name": "versions",
@@ -620,12 +709,12 @@ return {
"plural": false,
"selections": [
(v4/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/),
(v20/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
(v26/*: any*/),
(v7/*: any*/),
(v8/*: any*/)
],
@@ -647,16 +736,16 @@ return {
]
},
"params": {
"cacheID": "16dd0ba75fa5a1339b59fa3e6bb9a6be",
"cacheID": "a1b25325fb4a764d130253f86435efcb",
"id": null,
"metadata": {},
"name": "ShowDocumentViewQuery",
"operationKind": "query",
"text": "query ShowDocumentViewQuery(\n $documentId: ID!\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n name\n }\n id\n }\n node(id: $documentId) {\n __typename\n id\n ... on Document {\n title\n description\n createdAt\n updatedAt\n currentPublishedVersion\n owner {\n id\n fullName\n primaryEmailAddress\n }\n ...SignaturesModal_documentVersions\n ...VersionHistoryModal_documentVersions\n latestVersion: versions(first: 1) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n publishedBy {\n fullName\n id\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n}\n\nfragment SignaturesModal_documentVersions on Document {\n title\n documentVersions: versions(first: 10) {\n edges {\n node {\n id\n version\n status\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n id\n }\n requestedBy {\n fullName\n id\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n }\n}\n\nfragment VersionHistoryModal_documentVersions on Document {\n title\n owner {\n fullName\n id\n }\n versionHistory: versions(first: 20) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n }\n }\n }\n}\n"
"text": "query ShowDocumentViewQuery(\n $documentId: ID!\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n name\n ...PeopleSelector_organization\n }\n id\n }\n node(id: $documentId) {\n __typename\n id\n ... on Document {\n title\n description\n createdAt\n updatedAt\n currentPublishedVersion\n documentType\n owner {\n id\n fullName\n primaryEmailAddress\n }\n ...SignaturesModal_documentVersions\n ...VersionHistoryModal_documentVersions\n latestVersion: versions(first: 1) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n publishedBy {\n fullName\n id\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n\nfragment SignaturesModal_documentVersions on Document {\n title\n documentVersions: versions(first: 10) {\n edges {\n node {\n id\n version\n status\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n signatures(first: 100) {\n edges {\n node {\n id\n state\n signedAt\n requestedAt\n signedBy {\n fullName\n id\n }\n requestedBy {\n fullName\n id\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n }\n}\n\nfragment VersionHistoryModal_documentVersions on Document {\n title\n owner {\n fullName\n id\n }\n versionHistory: versions(first: 20) {\n edges {\n node {\n id\n version\n status\n content\n changelog\n publishedAt\n updatedAt\n publishedBy {\n fullName\n id\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "df52189b2fac349ac8588c518a4fce55";
(node as any).hash = "96c84ddc6ada95da2302068bae68f825";
export default node;

View File

@@ -0,0 +1,151 @@
/**
* @generated SignedSource<<f884c800d6c27056d14eec073a481151>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type UpdateDocumentInput = {
content?: string | null | undefined;
createdBy?: string | null | undefined;
documentType?: DocumentType | null | undefined;
id: string;
ownerId?: string | null | undefined;
title?: string | null | undefined;
};
export type ShowDocumentViewUpdateDocumentMutation$variables = {
input: UpdateDocumentInput;
};
export type ShowDocumentViewUpdateDocumentMutation$data = {
readonly updateDocument: {
readonly document: {
readonly documentType: DocumentType;
readonly id: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
readonly primaryEmailAddress: string;
};
};
};
};
export type ShowDocumentViewUpdateDocumentMutation = {
response: ShowDocumentViewUpdateDocumentMutation$data;
variables: ShowDocumentViewUpdateDocumentMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
}
],
v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v2 = [
{
"alias": null,
"args": [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
],
"concreteType": "UpdateDocumentPayload",
"kind": "LinkedField",
"name": "updateDocument",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "Document",
"kind": "LinkedField",
"name": "document",
"plural": false,
"selections": [
(v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "ShowDocumentViewUpdateDocumentMutation",
"selections": (v2/*: any*/),
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "ShowDocumentViewUpdateDocumentMutation",
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "62cd235bd1903d80012364fbc3358054",
"id": null,
"metadata": {},
"name": "ShowDocumentViewUpdateDocumentMutation",
"operationKind": "mutation",
"text": "mutation ShowDocumentViewUpdateDocumentMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n owner {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "094ff9193be9f023152588380f5114b5";
export default node;

View File

@@ -0,0 +1,151 @@
/**
* @generated SignedSource<<9752f2c7d1c495c0c21482fb6d881c9e>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
export type UpdateDocumentInput = {
content?: string | null | undefined;
createdBy?: string | null | undefined;
documentType?: DocumentType | null | undefined;
id: string;
ownerId?: string | null | undefined;
title?: string | null | undefined;
};
export type ShowDocumentViewUpdateDocumentTypeMutation$variables = {
input: UpdateDocumentInput;
};
export type ShowDocumentViewUpdateDocumentTypeMutation$data = {
readonly updateDocument: {
readonly document: {
readonly documentType: DocumentType;
readonly id: string;
readonly owner: {
readonly fullName: string;
readonly id: string;
readonly primaryEmailAddress: string;
};
};
};
};
export type ShowDocumentViewUpdateDocumentTypeMutation = {
response: ShowDocumentViewUpdateDocumentTypeMutation$data;
variables: ShowDocumentViewUpdateDocumentTypeMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
}
],
v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v2 = [
{
"alias": null,
"args": [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
],
"concreteType": "UpdateDocumentPayload",
"kind": "LinkedField",
"name": "updateDocument",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "Document",
"kind": "LinkedField",
"name": "document",
"plural": false,
"selections": [
(v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": [
(v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "fullName",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "ShowDocumentViewUpdateDocumentTypeMutation",
"selections": (v2/*: any*/),
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "ShowDocumentViewUpdateDocumentTypeMutation",
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "4904ae0647cf1c01126766096adf2b4b",
"id": null,
"metadata": {},
"name": "ShowDocumentViewUpdateDocumentTypeMutation",
"operationKind": "mutation",
"text": "mutation ShowDocumentViewUpdateDocumentTypeMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n owner {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "5d04382a57a6020b7e8c80e615e1b32a";
export default node;