Change document version

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-06-03 14:55:54 -07:00
parent 21e7891f9b
commit b54cb6d3fc
22 changed files with 1247 additions and 146 deletions

View File

@@ -25,7 +25,7 @@ import type { ShowDocumentViewQuery } from "./__generated__/ShowDocumentViewQuer
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 { ShowDocumentViewGenerateChangelogMutation } from "./__generated__/ShowDocumentViewGenerateChangelogMutation.graphql";
import type { DocumentType } from "./__generated__/DocumentListViewCreateMutation.graphql";
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
@@ -90,6 +90,10 @@ const documentViewQuery = graphql`
content
changelog
publishedAt
title
owner {
fullName
}
publishedBy {
fullName
}
@@ -114,6 +118,7 @@ const publishDocumentVersionMutation = graphql`
id
status
publishedAt
changelog
publishedBy {
fullName
}
@@ -144,6 +149,7 @@ const updateDocumentMutation = graphql`
document {
id
documentType
title
owner {
id
fullName
@@ -154,6 +160,14 @@ const updateDocumentMutation = graphql`
}
`;
const generateChangelogMutation = graphql`
mutation ShowDocumentViewGenerateChangelogMutation($input: GenerateDocumentChangelogInput!) {
generateDocumentChangelog(input: $input) {
changelog
}
}
`;
function ShowDocumentContent({
queryRef,
}: {
@@ -176,8 +190,18 @@ function ShowDocumentContent({
const [isSignaturesModalOpen, setIsSignaturesModalOpen] = useState(false);
const [isEditingOwner, setIsEditingOwner] = useState(false);
const [isEditingType, setIsEditingType] = useState(false);
const [isEditingTitle, setIsEditingTitle] = useState(false);
const [editedTitle, setEditedTitle] = useState(documentValue.title || '');
const [isPublishDialogOpen, setIsPublishDialogOpen] = useState(false);
const [publishChangelog, setPublishChangelog] = useState('');
const [isGeneratingChangelog, setIsGeneratingChangelog] = useState(false);
const printContentRef = useRef<HTMLDivElement>(null);
// Keep editedTitle in sync with documentValue.title
useEffect(() => {
setEditedTitle(documentValue.title || '');
}, [documentValue.title]);
const [publishDraft, isPublishInFlight] =
useMutation<ShowDocumentViewPublishMutation>(publishDocumentVersionMutation);
const [createDraft, isCreateDraftInFlight] =
@@ -186,6 +210,7 @@ function ShowDocumentContent({
);
const [updateDocument, isUpdatingDocument] =
useMutation<ShowDocumentViewUpdateDocumentMutation>(updateDocumentMutation);
const [generateChangelog] = useMutation<ShowDocumentViewGenerateChangelogMutation>(generateChangelogMutation);
const latestVersionEdge = documentValue.latestVersion?.edges[0];
const latestVersionNode = latestVersionEdge?.node;
@@ -300,12 +325,57 @@ function ShowDocumentContent({
// Navigate to publish flow
const handlePublish = useCallback(() => {
setIsPublishDialogOpen(true);
setPublishChangelog("");
// Generate changelog
setIsGeneratingChangelog(true);
generateChangelog({
variables: {
input: {
documentId: documentValue.id,
},
},
onCompleted: (response, errors) => {
setIsGeneratingChangelog(false);
if (errors) {
toast({
title: "Error",
description: errors[0]?.message || "An unknown error occurred",
variant: "destructive",
});
return;
}
const generatedChangelog = response.generateDocumentChangelog.changelog;
setPublishChangelog(prev => {
if (prev.trim()) {
return `${prev}\n${generatedChangelog}`;
}
return generatedChangelog;
});
},
onError: (error) => {
setIsGeneratingChangelog(false);
toast({
title: "Error",
description: error.message || "An unknown error occurred",
variant: "destructive",
});
},
});
}, [documentValue.id, generateChangelog, toast]);
// Confirm publish
const confirmPublish = useCallback(() => {
if (!documentValue.id) return;
publishDraft({
variables: {
input: {
documentId: documentValue.id,
changelog: publishChangelog,
},
},
onCompleted: (_, errors) => {
@@ -323,6 +393,7 @@ function ShowDocumentContent({
description: `The document has been published successfully`,
});
setIsPublishDialogOpen(false);
// Reload the query to refresh the data
loadQuery({ documentId: documentValue.id, organizationId: organizationId! });
},
@@ -334,7 +405,7 @@ function ShowDocumentContent({
});
},
});
}, [documentValue.id, publishDraft, toast, loadQuery]);
}, [documentValue.id, publishDraft, toast, loadQuery, publishChangelog, organizationId]);
// Open version history modal
const handleVersionHistoryClick = useCallback(() => {
@@ -658,7 +729,84 @@ function ShowDocumentContent({
<div className="bg-gray-50 rounded-lg border border-solid-b shadow-sm p-6 mb-4">
<div className="grid grid-cols-2 gap-y-3">
<div>
<span className="font-medium">Document Title:</span> {documentValue.title}
<div className="flex items-center gap-2">
<span className="font-medium">Document Title:</span>
{isEditingTitle ? (
<div className="flex items-center gap-2">
<input
type="text"
className="h-9 w-[250px] rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors"
value={editedTitle}
onChange={(e) => setEditedTitle(e.target.value)}
placeholder="Enter document title"
/>
<Button
variant="outline"
size="sm"
onClick={() => {
if (editedTitle.trim()) {
updateDocument({
variables: {
input: {
id: documentValue.id,
title: editedTitle.trim(),
},
},
onCompleted: (_, errors) => {
if (errors) {
toast({
title: "Error updating title",
description: errors[0]?.message || "An unknown error occurred",
variant: "destructive",
});
return;
}
toast({
title: "Success",
description: "Document title updated successfully",
});
setIsEditingTitle(false);
loadQuery({ documentId: documentValue.id, organizationId: organizationId! });
},
onError: (error) => {
toast({
title: "Error updating title",
description: error.message || "An unknown error occurred",
variant: "destructive",
});
},
});
}
}}
disabled={!editedTitle.trim() || isUpdatingDocument}
>
Save
</Button>
<Button
variant="outline"
size="sm"
onClick={() => {
setIsEditingTitle(false);
setEditedTitle(documentValue.title || '');
}}
disabled={isUpdatingDocument}
>
Cancel
</Button>
</div>
) : (
<div className="flex items-center gap-2">
<span>{documentValue.title}</span>
<Button
variant="outline"
size="sm"
onClick={() => setIsEditingTitle(true)}
>
Change
</Button>
</div>
)}
</div>
</div>
<div>
<span className="font-medium">Version:</span> {latestVersionNode.version || "N/A"}
@@ -826,6 +974,50 @@ function ShowDocumentContent({
</DialogFooter>
</DialogContent>
</Dialog>
{/* Publish Confirmation Dialog */}
<Dialog open={isPublishDialogOpen} onOpenChange={setIsPublishDialogOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Publish Document</DialogTitle>
<DialogDescription>
Please review and edit the changelog before publishing the document.
</DialogDescription>
</DialogHeader>
<div className="py-4">
<Label htmlFor="changelog">Changelog</Label>
<textarea
id="changelog"
className="flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
value={publishChangelog}
onChange={(e) => setPublishChangelog(e.target.value)}
placeholder="Enter changelog message"
/>
{isGeneratingChangelog && (
<div className="mt-2 flex items-center gap-2 text-sm text-muted-foreground">
<div className="h-4 w-4 animate-spin rounded-full border-2 border-primary border-t-transparent"></div>
<span>Generating changelog...</span>
</div>
)}
</div>
<DialogFooter>
<Button
variant="outline"
onClick={() => setIsPublishDialogOpen(false)}
disabled={isPublishInFlight}
>
Cancel
</Button>
<Button
variant="default"
onClick={confirmPublish}
disabled={isPublishInFlight || !publishChangelog.trim()}
>
{isPublishInFlight ? "Publishing..." : "Publish"}
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</PageTemplate>
);
}
@@ -834,10 +1026,26 @@ export default function ShowDocumentView() {
const [queryRef, loadQuery] =
useQueryLoader<ShowDocumentViewQuery>(documentViewQuery);
const { documentId, organizationId } = useParams();
const { toast } = useToast();
const navigate = useNavigate();
useEffect(() => {
loadQuery({ documentId: documentId!, organizationId: organizationId! });
}, [loadQuery, documentId, organizationId]);
if (!organizationId || !documentId) {
toast({
title: "Error",
description: "Invalid document or organization ID",
variant: "destructive",
});
navigate("/");
return;
}
loadQuery({ documentId, organizationId });
}, [loadQuery, documentId, organizationId, toast, navigate]);
if (!organizationId || !documentId) {
return null;
}
if (!queryRef) {
return <ShowDocumentViewSkeleton />;

View File

@@ -22,9 +22,13 @@ export const documentVersionsFragment = graphql`
version
status
content
title
changelog
publishedAt
updatedAt
owner {
fullName
}
publishedBy {
fullName
}
@@ -122,6 +126,14 @@ export function VersionHistoryModal({
•{" "}
{formatDateTime(version.publishedAt || version.updatedAt)}
</div>
{version.changelog && (
<div className="text-xs text-tertiary mt-1">
Changelog: {version.changelog}
</div>
)}
<div className="text-xs text-tertiary mt-1">
Owner: {version.owner?.fullName || "Unknown"}
</div>
</div>
</div>
))}
@@ -130,8 +142,12 @@ export function VersionHistoryModal({
{/* Content Area */}
<div className="flex-1 p-6 relative overflow-y-auto">
<h2 className="text-2xl font-semibold mb-6">{data.title}</h2>
{selectedVersion && (
<h2 className="text-2xl font-semibold mb-6">
{versions.find((v) => v.version === selectedVersion)
?.title || data.title}
</h2>
)}
<div className="prose prose-olive max-w-none">
{selectedVersion && (
<ReactMarkdown remarkPlugins={[remarkGfm]} rehypePlugins={[rehypeRaw]}>

View File

@@ -0,0 +1,92 @@
/**
* @generated SignedSource<<7743b633410bdb28ce017cc0799f2df4>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type GenerateDocumentChangelogInput = {
documentId: string;
};
export type ShowDocumentViewGenerateChangelogMutation$variables = {
input: GenerateDocumentChangelogInput;
};
export type ShowDocumentViewGenerateChangelogMutation$data = {
readonly generateDocumentChangelog: {
readonly changelog: string;
};
};
export type ShowDocumentViewGenerateChangelogMutation = {
response: ShowDocumentViewGenerateChangelogMutation$data;
variables: ShowDocumentViewGenerateChangelogMutation$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "input"
}
],
v1 = [
{
"alias": null,
"args": [
{
"kind": "Variable",
"name": "input",
"variableName": "input"
}
],
"concreteType": "GenerateDocumentChangelogPayload",
"kind": "LinkedField",
"name": "generateDocumentChangelog",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "changelog",
"storageKey": null
}
],
"storageKey": null
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "ShowDocumentViewGenerateChangelogMutation",
"selections": (v1/*: any*/),
"type": "Mutation",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "ShowDocumentViewGenerateChangelogMutation",
"selections": (v1/*: any*/)
},
"params": {
"cacheID": "8051b5412b1d2d73a7fe686890e86f41",
"id": null,
"metadata": {},
"name": "ShowDocumentViewGenerateChangelogMutation",
"operationKind": "mutation",
"text": "mutation ShowDocumentViewGenerateChangelogMutation(\n $input: GenerateDocumentChangelogInput!\n) {\n generateDocumentChangelog(input: $input) {\n changelog\n }\n}\n"
}
};
})();
(node as any).hash = "60be598c9c528b2173be7be580057ea7";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<91076d34daad785f7fce9f5a2cbc4018>>
* @generated SignedSource<<f67241da996f7e38c84c64b99084ed97>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -11,6 +11,7 @@
import { ConcreteRequest } from 'relay-runtime';
export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type PublishDocumentVersionInput = {
changelog?: string | null | undefined;
documentId: string;
};
export type ShowDocumentViewPublishMutation$variables = {
@@ -23,6 +24,7 @@ export type ShowDocumentViewPublishMutation$data = {
readonly id: string;
};
readonly documentVersion: {
readonly changelog: string;
readonly id: string;
readonly publishedAt: string | null | undefined;
readonly publishedBy: {
@@ -93,6 +95,13 @@ v5 = {
"storageKey": null
},
v6 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "changelog",
"storageKey": null
},
v7 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -126,6 +135,7 @@ return {
(v2/*: any*/),
(v4/*: any*/),
(v5/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": null,
@@ -134,7 +144,7 @@ return {
"name": "publishedBy",
"plural": false,
"selections": [
(v6/*: any*/)
(v7/*: any*/)
],
"storageKey": null
}
@@ -174,6 +184,7 @@ return {
(v2/*: any*/),
(v4/*: any*/),
(v5/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": null,
@@ -182,7 +193,7 @@ return {
"name": "publishedBy",
"plural": false,
"selections": [
(v6/*: any*/),
(v7/*: any*/),
(v2/*: any*/)
],
"storageKey": null
@@ -196,16 +207,16 @@ return {
]
},
"params": {
"cacheID": "794539aab3ddce5d004e72d10b980ca4",
"cacheID": "9e097de4f6f61bd4762e57b4863c573b",
"id": null,
"metadata": {},
"name": "ShowDocumentViewPublishMutation",
"operationKind": "mutation",
"text": "mutation ShowDocumentViewPublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n currentPublishedVersion\n }\n documentVersion {\n id\n status\n publishedAt\n publishedBy {\n fullName\n id\n }\n }\n }\n}\n"
"text": "mutation ShowDocumentViewPublishMutation(\n $input: PublishDocumentVersionInput!\n) {\n publishDocumentVersion(input: $input) {\n document {\n id\n currentPublishedVersion\n }\n documentVersion {\n id\n status\n publishedAt\n changelog\n publishedBy {\n fullName\n id\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "66e590251b58966c2ac09625759332f7";
(node as any).hash = "9b2033c7f39d178fb9a25828ade6af3c";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<bf950636055ed83dd68cd6e513a4d83e>>
* @generated SignedSource<<edd3d7d537e2ed956853a8be083189fa>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -30,11 +30,15 @@ export type ShowDocumentViewQuery$data = {
readonly content: string;
readonly createdAt: string;
readonly id: string;
readonly owner: {
readonly fullName: string;
};
readonly publishedAt: string | null | undefined;
readonly publishedBy: {
readonly fullName: string;
} | null | undefined;
readonly status: DocumentStatus;
readonly title: string;
readonly updatedAt: string;
readonly version: number;
};
@@ -212,20 +216,23 @@ v19 = {
"name": "publishedAt",
"storageKey": null
},
v20 = {
v20 = [
(v11/*: any*/)
],
v21 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v21 = {
v22 = {
"kind": "Literal",
"name": "first",
"value": 100
},
v22 = [
(v21/*: any*/),
v23 = [
(v22/*: any*/),
{
"kind": "Literal",
"name": "orderBy",
@@ -235,14 +242,14 @@ v22 = [
}
}
],
v23 = {
v24 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
},
v24 = {
v25 = {
"alias": null,
"args": null,
"concreteType": "PageInfo",
@@ -267,23 +274,33 @@ v24 = {
],
"storageKey": null
},
v25 = [
v26 = [
(v11/*: any*/),
(v4/*: any*/)
],
v26 = {
v27 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "publishedBy",
"plural": false,
"selections": (v25/*: any*/),
"selections": (v26/*: any*/),
"storageKey": null
},
v27 = [
(v21/*: any*/)
];
v28 = [
(v22/*: any*/)
],
v29 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": (v26/*: any*/),
"storageKey": null
};
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
@@ -374,6 +391,17 @@ return {
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
(v5/*: any*/),
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": (v20/*: any*/),
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -381,9 +409,7 @@ return {
"kind": "LinkedField",
"name": "publishedBy",
"plural": false,
"selections": [
(v11/*: any*/)
],
"selections": (v20/*: any*/),
"storageKey": null
},
(v7/*: any*/),
@@ -422,7 +448,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v20/*: any*/),
(v21/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
@@ -430,7 +456,7 @@ return {
(v2/*: any*/),
{
"alias": null,
"args": (v22/*: any*/),
"args": (v23/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -455,21 +481,21 @@ return {
(v4/*: any*/),
(v11/*: any*/),
(v12/*: any*/),
(v20/*: any*/)
(v21/*: any*/)
],
"storageKey": null
},
(v23/*: any*/)
(v24/*: any*/)
],
"storageKey": null
},
(v24/*: any*/)
(v25/*: any*/)
],
"storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
},
{
"alias": null,
"args": (v22/*: any*/),
"args": (v23/*: any*/),
"filters": [
"orderBy"
],
@@ -493,7 +519,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v20/*: any*/),
(v21/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
@@ -540,10 +566,10 @@ return {
(v16/*: any*/),
(v19/*: any*/),
(v8/*: any*/),
(v26/*: any*/),
(v27/*: any*/),
{
"alias": null,
"args": (v27/*: any*/),
"args": (v28/*: any*/),
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField",
"name": "signatures",
@@ -594,7 +620,7 @@ return {
"kind": "LinkedField",
"name": "signedBy",
"plural": false,
"selections": (v25/*: any*/),
"selections": (v26/*: any*/),
"storageKey": null
},
{
@@ -604,24 +630,24 @@ return {
"kind": "LinkedField",
"name": "requestedBy",
"plural": false,
"selections": (v25/*: any*/),
"selections": (v26/*: any*/),
"storageKey": null
},
(v20/*: any*/)
(v21/*: any*/)
],
"storageKey": null
},
(v23/*: any*/)
(v24/*: any*/)
],
"storageKey": null
},
(v24/*: any*/)
(v25/*: any*/)
],
"storageKey": "signatures(first:100)"
},
{
"alias": null,
"args": (v27/*: any*/),
"args": (v28/*: any*/),
"filters": null,
"handle": "connection",
"key": "SignaturesModal_documentVersions_signatures",
@@ -671,10 +697,12 @@ return {
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/),
(v5/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
(v8/*: any*/),
(v26/*: any*/)
(v29/*: any*/),
(v27/*: any*/)
],
"storageKey": null
}
@@ -714,7 +742,9 @@ return {
(v17/*: any*/),
(v18/*: any*/),
(v19/*: any*/),
(v26/*: any*/),
(v5/*: any*/),
(v29/*: any*/),
(v27/*: any*/),
(v7/*: any*/),
(v8/*: any*/)
],
@@ -736,16 +766,16 @@ return {
]
},
"params": {
"cacheID": "a1b25325fb4a764d130253f86435efcb",
"cacheID": "7e1dfac8673eeb68f1d3821db3ca95c2",
"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 ...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"
"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 title\n owner {\n fullName\n id\n }\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 title\n changelog\n publishedAt\n updatedAt\n owner {\n fullName\n id\n }\n publishedBy {\n fullName\n id\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "96c84ddc6ada95da2302068bae68f825";
(node as any).hash = "41461d6b97a3672ae58a36fbb5615489";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f884c800d6c27056d14eec073a481151>>
* @generated SignedSource<<5cf1d2c84b94cf4c7d35965f67b36191>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -31,6 +31,7 @@ export type ShowDocumentViewUpdateDocumentMutation$data = {
readonly id: string;
readonly primaryEmailAddress: string;
};
readonly title: string;
};
};
};
@@ -85,6 +86,13 @@ v2 = [
"name": "documentType",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -136,16 +144,16 @@ return {
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "62cd235bd1903d80012364fbc3358054",
"cacheID": "81d866e2f2de8bc1d7d440bfb2c66144",
"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"
"text": "mutation ShowDocumentViewUpdateDocumentMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n title\n owner {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "094ff9193be9f023152588380f5114b5";
(node as any).hash = "acaf0d38623ccc096f19c9d6c3e05c69";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<a88582302d627481e4214530f287e233>>
* @generated SignedSource<<00c4778ab72567e2c573d98bdbbc4c5f>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -22,11 +22,15 @@ export type VersionHistoryModal_documentVersions$data = {
readonly changelog: string;
readonly content: string;
readonly id: string;
readonly owner: {
readonly fullName: string;
};
readonly publishedAt: string | null | undefined;
readonly publishedBy: {
readonly fullName: string;
} | null | undefined;
readonly status: DocumentStatus;
readonly title: string;
readonly updatedAt: string;
readonly version: number;
};
@@ -40,7 +44,14 @@ export type VersionHistoryModal_documentVersions$key = {
};
const node: ReaderFragment = (function(){
var v0 = [
var v0 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "title",
"storageKey": null
},
v1 = [
{
"alias": null,
"args": null,
@@ -48,30 +59,25 @@ var v0 = [
"name": "fullName",
"storageKey": null
}
];
],
v2 = {
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": (v1/*: any*/),
"storageKey": null
};
return {
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "VersionHistoryModal_documentVersions",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "title",
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "People",
"kind": "LinkedField",
"name": "owner",
"plural": false,
"selections": (v0/*: any*/),
"storageKey": null
},
(v0/*: any*/),
(v2/*: any*/),
{
"alias": "versionHistory",
"args": [
@@ -130,6 +136,7 @@ return {
"name": "content",
"storageKey": null
},
(v0/*: any*/),
{
"alias": null,
"args": null,
@@ -151,6 +158,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v2/*: any*/),
{
"alias": null,
"args": null,
@@ -158,7 +166,7 @@ return {
"kind": "LinkedField",
"name": "publishedBy",
"plural": false,
"selections": (v0/*: any*/),
"selections": (v1/*: any*/),
"storageKey": null
}
],
@@ -176,6 +184,6 @@ return {
};
})();
(node as any).hash = "ffcba061a60a144c663de41a48e784d1";
(node as any).hash = "344e822be4a3eb20d147ecd1c3ea7ced";
export default node;