Refactor DocumentSignaturesTab to DocumentSignaturesPage + fix count bug
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<b80ec4401c50c0af90c48812a73b76b5>>
|
||||
* @generated SignedSource<<190e32d0bc7808055f7390730de5efd4>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentActionsDropdownFragment$data = {
|
||||
export type DocumentActionsDropdown_documentFragment$data = {
|
||||
readonly canDelete: boolean;
|
||||
readonly canUpdate: boolean;
|
||||
readonly id: string;
|
||||
@@ -20,18 +20,18 @@ export type DocumentActionsDropdownFragment$data = {
|
||||
readonly totalCount: number;
|
||||
};
|
||||
readonly " $fragmentSpreads": FragmentRefs<"UpdateVersionDialogFragment">;
|
||||
readonly " $fragmentType": "DocumentActionsDropdownFragment";
|
||||
readonly " $fragmentType": "DocumentActionsDropdown_documentFragment";
|
||||
};
|
||||
export type DocumentActionsDropdownFragment$key = {
|
||||
readonly " $data"?: DocumentActionsDropdownFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentActionsDropdownFragment">;
|
||||
export type DocumentActionsDropdown_documentFragment$key = {
|
||||
readonly " $data"?: DocumentActionsDropdown_documentFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentActionsDropdown_documentFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentActionsDropdownFragment",
|
||||
"name": "DocumentActionsDropdown_documentFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -119,6 +119,6 @@ const node: ReaderFragment = {
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "bc3632812ef26d793478c01bd41e7dbe";
|
||||
(node as any).hash = "0e6d41c74914e28aea353ddef6bf7385";
|
||||
|
||||
export default node;
|
||||
73
apps/console/src/__generated__/core/DocumentActionsDropdown_versionFragment.graphql.ts
generated
Normal file
73
apps/console/src/__generated__/core/DocumentActionsDropdown_versionFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @generated SignedSource<<ab58ae3e6f4142422681638a391a5dc4>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentActionsDropdown_versionFragment$data = {
|
||||
readonly canDeleteDraft: boolean;
|
||||
readonly id: string;
|
||||
readonly status: DocumentStatus;
|
||||
readonly version: number;
|
||||
readonly " $fragmentType": "DocumentActionsDropdown_versionFragment";
|
||||
};
|
||||
export type DocumentActionsDropdown_versionFragment$key = {
|
||||
readonly " $data"?: DocumentActionsDropdown_versionFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentActionsDropdown_versionFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentActionsDropdown_versionFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "version",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canDeleteDraft",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:delete-draft"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:delete-draft\")"
|
||||
}
|
||||
],
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "00619a8709984275b2e18c2c44dd4e36";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<927b958ffdaa974f5a5054be4638b60d>>
|
||||
* @generated SignedSource<<f22c42dfa1b8b70ebed9f29c56d42069>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -11,22 +11,22 @@
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentLayoutDrawerFragment$data = {
|
||||
export type DocumentLayoutDrawer_documentFragment$data = {
|
||||
readonly canUpdate: boolean;
|
||||
readonly documentType: DocumentType;
|
||||
readonly id: string;
|
||||
readonly " $fragmentType": "DocumentLayoutDrawerFragment";
|
||||
readonly " $fragmentType": "DocumentLayoutDrawer_documentFragment";
|
||||
};
|
||||
export type DocumentLayoutDrawerFragment$key = {
|
||||
readonly " $data"?: DocumentLayoutDrawerFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentLayoutDrawerFragment">;
|
||||
export type DocumentLayoutDrawer_documentFragment$key = {
|
||||
readonly " $data"?: DocumentLayoutDrawer_documentFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentLayoutDrawer_documentFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentLayoutDrawerFragment",
|
||||
"name": "DocumentLayoutDrawer_documentFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -60,6 +60,6 @@ const node: ReaderFragment = {
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "a8f55efdb2682fb35a7bc68f3ef1808a";
|
||||
(node as any).hash = "0f2e539cf30c4e116fe81392605b1481";
|
||||
|
||||
export default node;
|
||||
110
apps/console/src/__generated__/core/DocumentLayoutDrawer_versionFragment.graphql.ts
generated
Normal file
110
apps/console/src/__generated__/core/DocumentLayoutDrawer_versionFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* @generated SignedSource<<e86ed1b94b49ab62d46e4394739f1e70>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
|
||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentLayoutDrawer_versionFragment$data = {
|
||||
readonly classification: DocumentClassification;
|
||||
readonly id: string;
|
||||
readonly owner: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly publishedAt: string | null | undefined;
|
||||
readonly status: DocumentStatus;
|
||||
readonly updatedAt: string;
|
||||
readonly version: number;
|
||||
readonly " $fragmentType": "DocumentLayoutDrawer_versionFragment";
|
||||
};
|
||||
export type DocumentLayoutDrawer_versionFragment$key = {
|
||||
readonly " $data"?: DocumentLayoutDrawer_versionFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentLayoutDrawer_versionFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentLayoutDrawer_versionFragment",
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "classification",
|
||||
"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
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "version",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "publishedAt",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "f5e9183b163586bab18475a19843b186";
|
||||
|
||||
export default node;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<b5228fc83f8259e864b7af631cc1a0c2>>
|
||||
* @generated SignedSource<<cc067af7afb25c6ce54e3915100c371e>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -11,28 +11,27 @@
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturesTab_signature$data = {
|
||||
export type DocumentSignatureListItemFragment$data = {
|
||||
readonly canCancel: boolean;
|
||||
readonly id: string;
|
||||
readonly requestedAt: string;
|
||||
readonly signedAt: string | null | undefined;
|
||||
readonly signedBy: {
|
||||
readonly fullName: string;
|
||||
readonly primaryEmailAddress: string;
|
||||
};
|
||||
readonly state: DocumentVersionSignatureState;
|
||||
readonly " $fragmentType": "DocumentSignaturesTab_signature";
|
||||
readonly " $fragmentType": "DocumentSignatureListItemFragment";
|
||||
};
|
||||
export type DocumentSignaturesTab_signature$key = {
|
||||
readonly " $data"?: DocumentSignaturesTab_signature$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesTab_signature">;
|
||||
export type DocumentSignatureListItemFragment$key = {
|
||||
readonly " $data"?: DocumentSignatureListItemFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureListItemFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturesTab_signature",
|
||||
"name": "DocumentSignatureListItemFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -41,6 +40,24 @@ const node: ReaderFragment = {
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -62,49 +79,24 @@ const node: ReaderFragment = {
|
||||
"name": "requestedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canCancel",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
"value": "core:document-version-signature:cancel"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
"storageKey": "permission(action:\"core:document-version-signature:cancel\")"
|
||||
}
|
||||
],
|
||||
"type": "DocumentVersionSignature",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "bbfdd78015e97032862da41aad6beeae";
|
||||
(node as any).hash = "59bdf4434147c77415ed636a9b78e154";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<0a17c03011fe74b75a90dbeae02ab2ef>>
|
||||
* @generated SignedSource<<f1ba7d8550a4585118c8b9ed260607c4>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -12,18 +12,18 @@ import { ConcreteRequest } from 'relay-runtime';
|
||||
export type CancelSignatureRequestInput = {
|
||||
documentVersionSignatureId: string;
|
||||
};
|
||||
export type DocumentSignaturesTab_cancelSignatureMutation$variables = {
|
||||
export type DocumentSignatureListItem_cancelSignatureMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: CancelSignatureRequestInput;
|
||||
};
|
||||
export type DocumentSignaturesTab_cancelSignatureMutation$data = {
|
||||
export type DocumentSignatureListItem_cancelSignatureMutation$data = {
|
||||
readonly cancelSignatureRequest: {
|
||||
readonly deletedDocumentVersionSignatureId: string;
|
||||
};
|
||||
};
|
||||
export type DocumentSignaturesTab_cancelSignatureMutation = {
|
||||
response: DocumentSignaturesTab_cancelSignatureMutation$data;
|
||||
variables: DocumentSignaturesTab_cancelSignatureMutation$variables;
|
||||
export type DocumentSignatureListItem_cancelSignatureMutation = {
|
||||
response: DocumentSignatureListItem_cancelSignatureMutation$data;
|
||||
variables: DocumentSignatureListItem_cancelSignatureMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
@@ -59,7 +59,7 @@ return {
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturesTab_cancelSignatureMutation",
|
||||
"name": "DocumentSignatureListItem_cancelSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -84,7 +84,7 @@ return {
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "DocumentSignaturesTab_cancelSignatureMutation",
|
||||
"name": "DocumentSignatureListItem_cancelSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -117,16 +117,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "c57722e2b57faca64eea4950864e034d",
|
||||
"cacheID": "494afd972f44f534cf6f728196717a82",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentSignaturesTab_cancelSignatureMutation",
|
||||
"name": "DocumentSignatureListItem_cancelSignatureMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation DocumentSignaturesTab_cancelSignatureMutation(\n $input: CancelSignatureRequestInput!\n) {\n cancelSignatureRequest(input: $input) {\n deletedDocumentVersionSignatureId\n }\n}\n"
|
||||
"text": "mutation DocumentSignatureListItem_cancelSignatureMutation(\n $input: CancelSignatureRequestInput!\n) {\n cancelSignatureRequest(input: $input) {\n deletedDocumentVersionSignatureId\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9f5d3ff869ec6f91285140285248e824";
|
||||
(node as any).hash = "1a98d7aee9dc6758f186e915e1abe073";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<568018897f0db254b4d8c43c05abb7c6>>
|
||||
* @generated SignedSource<<bb1622f78ea11c986acbd844bfc5c463>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -12,22 +12,23 @@ import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
|
||||
export type DocumentVersionSignatureFilter = {
|
||||
activeContract?: boolean | null | undefined;
|
||||
states?: ReadonlyArray<DocumentVersionSignatureState> | null | undefined;
|
||||
};
|
||||
export type DocumentSignaturesTabRefetchQuery$variables = {
|
||||
export type DocumentSignatureListQuery$variables = {
|
||||
count?: number | null | undefined;
|
||||
cursor?: string | null | undefined;
|
||||
id: string;
|
||||
signatureFilter?: DocumentVersionSignatureFilter | null | undefined;
|
||||
};
|
||||
export type DocumentSignaturesTabRefetchQuery$data = {
|
||||
export type DocumentSignatureListQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesTab_version">;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_versionFragment">;
|
||||
};
|
||||
};
|
||||
export type DocumentSignaturesTabRefetchQuery = {
|
||||
response: DocumentSignaturesTabRefetchQuery$data;
|
||||
variables: DocumentSignaturesTabRefetchQuery$variables;
|
||||
export type DocumentSignatureListQuery = {
|
||||
response: DocumentSignatureListQuery$data;
|
||||
variables: DocumentSignatureListQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
@@ -73,13 +74,6 @@ v6 = {
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
}
|
||||
],
|
||||
v8 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "after",
|
||||
@@ -106,7 +100,7 @@ return {
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturesTabRefetchQuery",
|
||||
"name": "DocumentSignatureListQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -135,7 +129,7 @@ return {
|
||||
}
|
||||
],
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturesTab_version"
|
||||
"name": "DocumentSignatureList_versionFragment"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -153,7 +147,7 @@ return {
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "DocumentSignaturesTabRefetchQuery",
|
||||
"name": "DocumentSignatureListQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
@@ -175,16 +169,9 @@ return {
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canRequestSignature",
|
||||
"args": (v7/*: any*/),
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v8/*: any*/),
|
||||
"args": (v7/*: any*/),
|
||||
"concreteType": "DocumentVersionSignatureConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "signatures",
|
||||
@@ -207,13 +194,6 @@ return {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v6/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -229,17 +209,17 @@ return {
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -256,10 +236,16 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": "canCancel",
|
||||
"args": (v7/*: any*/),
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version-signature:cancel"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
"storageKey": "permission(action:\"core:document-version-signature:cancel\")"
|
||||
},
|
||||
(v5/*: any*/)
|
||||
],
|
||||
@@ -317,7 +303,7 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v8/*: any*/),
|
||||
"args": (v7/*: any*/),
|
||||
"filters": [
|
||||
"filter"
|
||||
],
|
||||
@@ -336,16 +322,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "5f4d3d9043d744d2e35c7c5b3e209a37",
|
||||
"cacheID": "25f679c343e22278c8a3d5e2db9bb3d0",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentSignaturesTabRefetchQuery",
|
||||
"name": "DocumentSignatureListQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query DocumentSignaturesTabRefetchQuery(\n $count: Int = 1000\n $cursor: CursorKey\n $signatureFilter: DocumentVersionSignatureFilter\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentSignaturesTab_version_1vp7QE\n id\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 canCancel: permission(action: \"core:document-version:request-signature\")\n}\n\nfragment DocumentSignaturesTab_version_1vp7QE on DocumentVersion {\n id\n status\n canRequestSignature: permission(action: \"core:document-version:request-signature\")\n signatures(first: $count, after: $cursor, filter: $signatureFilter) {\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"
|
||||
"text": "query DocumentSignatureListQuery(\n $count: Int = 1000\n $cursor: CursorKey\n $signatureFilter: DocumentVersionSignatureFilter\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentSignatureList_versionFragment_1vp7QE\n id\n }\n}\n\nfragment DocumentSignatureListItemFragment on DocumentVersionSignature {\n id\n signedBy {\n fullName\n id\n }\n state\n signedAt\n requestedAt\n canCancel: permission(action: \"core:document-version-signature:cancel\")\n}\n\nfragment DocumentSignatureList_versionFragment_1vp7QE on DocumentVersion {\n ...DocumentSignaturePlaceholder_versionFragment\n signatures(first: $count, after: $cursor, filter: $signatureFilter) {\n edges {\n node {\n id\n signedBy {\n id\n }\n ...DocumentSignatureListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n id\n}\n\nfragment DocumentSignaturePlaceholder_versionFragment on DocumentVersion {\n id\n status\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9282fd9e9a1aa10a36535863b896283c";
|
||||
(node as any).hash = "cc402c3b46eacfb04db1186bbd744f67";
|
||||
|
||||
export default node;
|
||||
118
apps/console/src/__generated__/core/DocumentSignatureList_peopleFragment.graphql.ts
generated
Normal file
118
apps/console/src/__generated__/core/DocumentSignatureList_peopleFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @generated SignedSource<<3b60ebae6765024147f97c157f6251fe>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignatureList_peopleFragment$data = {
|
||||
readonly people: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_personFragment">;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_organizationFragment">;
|
||||
readonly " $fragmentType": "DocumentSignatureList_peopleFragment";
|
||||
};
|
||||
export type DocumentSignatureList_peopleFragment$key = {
|
||||
readonly " $data"?: DocumentSignatureList_peopleFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_peopleFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "filter"
|
||||
}
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignatureList_peopleFragment",
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturePlaceholder_organizationFragment"
|
||||
},
|
||||
{
|
||||
"alias": "people",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "filter",
|
||||
"variableName": "filter"
|
||||
},
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 1000
|
||||
},
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "FULL_NAME"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturePlaceholder_personFragment"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "6c0a2b965d1440c2e0fd8ec9ce3c5e85";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<51a0ef23951497b2d074fafbda0ea04b>>
|
||||
* @generated SignedSource<<be6672740e1e23819b1d248d7e05d7ad>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -9,11 +9,8 @@
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturesTab_version$data = {
|
||||
readonly canRequestSignature: boolean;
|
||||
export type DocumentSignatureList_versionFragment$data = {
|
||||
readonly id: string;
|
||||
readonly signatures: {
|
||||
readonly __id: string;
|
||||
@@ -21,24 +18,21 @@ export type DocumentSignaturesTab_version$data = {
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly signedBy: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
readonly primaryEmailAddress: string;
|
||||
};
|
||||
readonly state: DocumentVersionSignatureState;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesTab_signature">;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureListItemFragment">;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly status: DocumentStatus;
|
||||
readonly " $fragmentType": "DocumentSignaturesTab_version";
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_versionFragment">;
|
||||
readonly " $fragmentType": "DocumentSignatureList_versionFragment";
|
||||
};
|
||||
export type DocumentSignaturesTab_version$key = {
|
||||
readonly " $data"?: DocumentSignaturesTab_version$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesTab_version">;
|
||||
export type DocumentSignatureList_versionFragment$key = {
|
||||
readonly " $data"?: DocumentSignatureList_versionFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_versionFragment">;
|
||||
};
|
||||
|
||||
import DocumentSignaturesTabRefetchQuery_graphql from './DocumentSignaturesTabRefetchQuery.graphql';
|
||||
import DocumentSignatureListQuery_graphql from './DocumentSignatureListQuery.graphql';
|
||||
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = [
|
||||
@@ -91,35 +85,19 @@ return {
|
||||
"fragmentPathInResult": [
|
||||
"node"
|
||||
],
|
||||
"operation": DocumentSignaturesTabRefetchQuery_graphql,
|
||||
"operation": DocumentSignatureListQuery_graphql,
|
||||
"identifierInfo": {
|
||||
"identifierField": "id",
|
||||
"identifierQueryVariableName": "id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"name": "DocumentSignaturesTab_version",
|
||||
"name": "DocumentSignatureList_versionFragment",
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canRequestSignature",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturePlaceholder_versionFragment"
|
||||
},
|
||||
{
|
||||
"alias": "signatures",
|
||||
@@ -152,13 +130,6 @@ return {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -167,28 +138,14 @@ return {
|
||||
"name": "signedBy",
|
||||
"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
|
||||
}
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturesTab_signature"
|
||||
"name": "DocumentSignatureListItemFragment"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
@@ -249,13 +206,14 @@ return {
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
},
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9282fd9e9a1aa10a36535863b896283c";
|
||||
(node as any).hash = "cc402c3b46eacfb04db1186bbd744f67";
|
||||
|
||||
export default node;
|
||||
48
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_organizationFragment.graphql.ts
generated
Normal file
48
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_organizationFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @generated SignedSource<<d2c766afc66acdd05219397c4bfd1b44>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturePlaceholder_organizationFragment$data = {
|
||||
readonly canRequestSignature: boolean;
|
||||
readonly " $fragmentType": "DocumentSignaturePlaceholder_organizationFragment";
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_organizationFragment$key = {
|
||||
readonly " $data"?: DocumentSignaturePlaceholder_organizationFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_organizationFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturePlaceholder_organizationFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "canRequestSignature",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "4bb0c71b4b90f335c9938b0283639f36";
|
||||
|
||||
export default node;
|
||||
58
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_personFragment.graphql.ts
generated
Normal file
58
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_personFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @generated SignedSource<<5a43f6367b3b03e57c58a1ab616e867b>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturePlaceholder_personFragment$data = {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
readonly primaryEmailAddress: string;
|
||||
readonly " $fragmentType": "DocumentSignaturePlaceholder_personFragment";
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_personFragment$key = {
|
||||
readonly " $data"?: DocumentSignaturePlaceholder_personFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_personFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturePlaceholder_personFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "People",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "4b77b54fc11c37a0e1c50f4d482b0f18";
|
||||
|
||||
export default node;
|
||||
184
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_requestSignatureMutation.graphql.ts
generated
Normal file
184
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_requestSignatureMutation.graphql.ts
generated
Normal file
@@ -0,0 +1,184 @@
|
||||
/**
|
||||
* @generated SignedSource<<eaadcea075dca4e0fbc3b2e12b9a1579>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
|
||||
export type RequestSignatureInput = {
|
||||
documentVersionId: string;
|
||||
signatoryId: string;
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_requestSignatureMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: RequestSignatureInput;
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_requestSignatureMutation$data = {
|
||||
readonly requestSignature: {
|
||||
readonly documentVersionSignatureEdge: {
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly signedBy: {
|
||||
readonly id: string;
|
||||
};
|
||||
readonly state: DocumentVersionSignatureState;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_requestSignatureMutation = {
|
||||
response: DocumentSignaturePlaceholder_requestSignatureMutation$data;
|
||||
variables: DocumentSignaturePlaceholder_requestSignatureMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignatureEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "documentVersionSignatureEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignature",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturePlaceholder_requestSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "RequestSignaturePayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "requestSignature",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "DocumentSignaturePlaceholder_requestSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "RequestSignaturePayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "requestSignature",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "prependEdge",
|
||||
"key": "",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "documentVersionSignatureEdge",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "e1c767d2441f84b783ed4d3824e2f0e8",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentSignaturePlaceholder_requestSignatureMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation DocumentSignaturePlaceholder_requestSignatureMutation(\n $input: RequestSignatureInput!\n) {\n requestSignature(input: $input) {\n documentVersionSignatureEdge {\n node {\n id\n state\n signedBy {\n id\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "9a5d20aef93c6bf4b83f88851a13b9c9";
|
||||
|
||||
export default node;
|
||||
51
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_versionFragment.graphql.ts
generated
Normal file
51
apps/console/src/__generated__/core/DocumentSignaturePlaceholder_versionFragment.graphql.ts
generated
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @generated SignedSource<<34ec1be8ec1087ce5163f0642009d71a>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturePlaceholder_versionFragment$data = {
|
||||
readonly id: string;
|
||||
readonly status: DocumentStatus;
|
||||
readonly " $fragmentType": "DocumentSignaturePlaceholder_versionFragment";
|
||||
};
|
||||
export type DocumentSignaturePlaceholder_versionFragment$key = {
|
||||
readonly " $data"?: DocumentSignaturePlaceholder_versionFragment$data;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturePlaceholder_versionFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturePlaceholder_versionFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
};
|
||||
|
||||
(node as any).hash = "935a86ea9eb392eedff1c0d0558f4aac";
|
||||
|
||||
export default node;
|
||||
603
apps/console/src/__generated__/core/DocumentSignaturesPageQuery.graphql.ts
generated
Normal file
603
apps/console/src/__generated__/core/DocumentSignaturesPageQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,603 @@
|
||||
/**
|
||||
* @generated SignedSource<<f83e7d173f4c2d46a2a6b193e458dee0>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentSignaturesPageQuery$variables = {
|
||||
documentId: string;
|
||||
organizationId: string;
|
||||
versionId: string;
|
||||
versionSpecified: boolean;
|
||||
};
|
||||
export type DocumentSignaturesPageQuery$data = {
|
||||
readonly document?: {
|
||||
readonly __typename: "Document";
|
||||
readonly lastVersion: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_versionFragment">;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
} | {
|
||||
// This will never be '%other', but we need some
|
||||
// value in case none of the concrete values match.
|
||||
readonly __typename: "%other";
|
||||
};
|
||||
readonly organization: {
|
||||
readonly __typename: string;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_peopleFragment">;
|
||||
};
|
||||
readonly version?: {
|
||||
readonly __typename: string;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignatureList_versionFragment">;
|
||||
};
|
||||
};
|
||||
export type DocumentSignaturesPageQuery = {
|
||||
response: DocumentSignaturesPageQuery$data;
|
||||
variables: DocumentSignaturesPageQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "documentId"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "organizationId"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "versionId"
|
||||
},
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "versionSpecified"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "organizationId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"kind": "Literal",
|
||||
"name": "filter",
|
||||
"value": {
|
||||
"excludeContractEnded": true
|
||||
}
|
||||
},
|
||||
v4 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "documentId"
|
||||
}
|
||||
],
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 1
|
||||
},
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "DESC",
|
||||
"field": "CREATED_AT"
|
||||
}
|
||||
}
|
||||
],
|
||||
v6 = {
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignatureList_versionFragment"
|
||||
},
|
||||
v7 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "versionId"
|
||||
}
|
||||
],
|
||||
v8 = {
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 1000
|
||||
},
|
||||
v9 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
v11 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
v12 = [
|
||||
(v8/*: any*/)
|
||||
],
|
||||
v13 = {
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"concreteType": "DocumentVersionSignatureConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "signatures",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignatureEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignature",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "signedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "requestedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canCancel",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version-signature:cancel"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version-signature:cancel\")"
|
||||
},
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "cursor",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "PageInfo",
|
||||
"kind": "LinkedField",
|
||||
"name": "pageInfo",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "endCursor",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "hasNextPage",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"kind": "ClientExtension",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__id",
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "signatures(first:1000)"
|
||||
},
|
||||
v14 = {
|
||||
"alias": null,
|
||||
"args": (v12/*: any*/),
|
||||
"filters": [
|
||||
"filter"
|
||||
],
|
||||
"handle": "connection",
|
||||
"key": "DocumentSignaturesTab_signatures",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "signatures"
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturesPageQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"args": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignatureList_peopleFragment"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"condition": "versionSpecified",
|
||||
"kind": "Condition",
|
||||
"passingValue": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": "document",
|
||||
"args": (v4/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": "DocumentVersionConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "versions",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersion",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v6/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
|
||||
}
|
||||
],
|
||||
"type": "Document",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "versionSpecified",
|
||||
"kind": "Condition",
|
||||
"passingValue": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": "version",
|
||||
"args": (v7/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v6/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "DocumentSignaturesPageQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "organization",
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "canRequestSignature",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
},
|
||||
{
|
||||
"alias": "people",
|
||||
"args": [
|
||||
(v3/*: any*/),
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "FULL_NAME"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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": [
|
||||
(v9/*: any*/),
|
||||
(v10/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "peoples(filter:{\"excludeContractEnded\":true},first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})"
|
||||
}
|
||||
],
|
||||
"type": "Organization",
|
||||
"abstractKey": null
|
||||
},
|
||||
(v9/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"condition": "versionSpecified",
|
||||
"kind": "Condition",
|
||||
"passingValue": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": "document",
|
||||
"args": (v4/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": "DocumentVersionConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "versions",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersion",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v9/*: any*/),
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
|
||||
}
|
||||
],
|
||||
"type": "Document",
|
||||
"abstractKey": null
|
||||
},
|
||||
(v9/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"condition": "versionSpecified",
|
||||
"kind": "Condition",
|
||||
"passingValue": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": "version",
|
||||
"args": (v7/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v9/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v11/*: any*/),
|
||||
(v13/*: any*/),
|
||||
(v14/*: any*/)
|
||||
],
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "a14fdbc42e1aa20bbe0dc24680404388",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentSignaturesPageQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query DocumentSignaturesPageQuery(\n $documentId: ID!\n $organizationId: ID!\n $versionId: ID!\n $versionSpecified: Boolean!\n) {\n organization: node(id: $organizationId) {\n __typename\n ...DocumentSignatureList_peopleFragment_4oWXMW\n id\n }\n document: node(id: $documentId) @skip(if: $versionSpecified) {\n __typename\n ... on Document {\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n ...DocumentSignatureList_versionFragment\n id\n }\n }\n }\n }\n id\n }\n version: node(id: $versionId) @include(if: $versionSpecified) {\n __typename\n ...DocumentSignatureList_versionFragment\n id\n }\n}\n\nfragment DocumentSignatureListItemFragment on DocumentVersionSignature {\n id\n signedBy {\n fullName\n id\n }\n state\n signedAt\n requestedAt\n canCancel: permission(action: \"core:document-version-signature:cancel\")\n}\n\nfragment DocumentSignatureList_peopleFragment_4oWXMW on Organization {\n ...DocumentSignaturePlaceholder_organizationFragment\n people: peoples(first: 1000, orderBy: {direction: ASC, field: FULL_NAME}, filter: {excludeContractEnded: true}) {\n edges {\n node {\n id\n ...DocumentSignaturePlaceholder_personFragment\n }\n }\n }\n}\n\nfragment DocumentSignatureList_versionFragment on DocumentVersion {\n ...DocumentSignaturePlaceholder_versionFragment\n signatures(first: 1000) {\n edges {\n node {\n id\n signedBy {\n id\n }\n ...DocumentSignatureListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n id\n}\n\nfragment DocumentSignaturePlaceholder_organizationFragment on Organization {\n canRequestSignature: permission(action: \"core:document-version:request-signature\")\n}\n\nfragment DocumentSignaturePlaceholder_personFragment on People {\n id\n fullName\n primaryEmailAddress\n}\n\nfragment DocumentSignaturePlaceholder_versionFragment on DocumentVersion {\n id\n status\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "2468bd3b1b46b19f6f7a35e9b69beab6";
|
||||
|
||||
export default node;
|
||||
@@ -1,267 +0,0 @@
|
||||
/**
|
||||
* @generated SignedSource<<2988f1319b1ad6110c328a00f644f26d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
|
||||
export type RequestSignatureInput = {
|
||||
documentVersionId: string;
|
||||
signatoryId: string;
|
||||
};
|
||||
export type DocumentSignaturesTab_requestSignatureMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
input: RequestSignatureInput;
|
||||
};
|
||||
export type DocumentSignaturesTab_requestSignatureMutation$data = {
|
||||
readonly requestSignature: {
|
||||
readonly documentVersionSignatureEdge: {
|
||||
readonly node: {
|
||||
readonly id: string;
|
||||
readonly signedBy: {
|
||||
readonly id: string;
|
||||
};
|
||||
readonly state: DocumentVersionSignatureState;
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentSignaturesTab_signature">;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export type DocumentSignaturesTab_requestSignatureMutation = {
|
||||
response: DocumentSignaturesTab_requestSignatureMutation$data;
|
||||
variables: DocumentSignaturesTab_requestSignatureMutation$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "connections"
|
||||
},
|
||||
v1 = {
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "input"
|
||||
},
|
||||
v2 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "input",
|
||||
"variableName": "input"
|
||||
}
|
||||
],
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "state",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": [
|
||||
(v0/*: any*/),
|
||||
(v1/*: any*/)
|
||||
],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentSignaturesTab_requestSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "RequestSignaturePayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "requestSignature",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignatureEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "documentVersionSignatureEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignature",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "DocumentSignaturesTab_signature"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Mutation",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": [
|
||||
(v1/*: any*/),
|
||||
(v0/*: any*/)
|
||||
],
|
||||
"kind": "Operation",
|
||||
"name": "DocumentSignaturesTab_requestSignatureMutation",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v2/*: any*/),
|
||||
"concreteType": "RequestSignaturePayload",
|
||||
"kind": "LinkedField",
|
||||
"name": "requestSignature",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignatureEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "documentVersionSignatureEdge",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "DocumentVersionSignature",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "People",
|
||||
"kind": "LinkedField",
|
||||
"name": "signedBy",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "primaryEmailAddress",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "signedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "requestedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": "canCancel",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:document-version:request-signature"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document-version:request-signature\")"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"filters": null,
|
||||
"handle": "prependEdge",
|
||||
"key": "",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "documentVersionSignatureEdge",
|
||||
"handleArgs": [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "connections",
|
||||
"variableName": "connections"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "5a9c28a2a8a3234f953f7a609da7d02e",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentSignaturesTab_requestSignatureMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation DocumentSignaturesTab_requestSignatureMutation(\n $input: RequestSignatureInput!\n) {\n requestSignature(input: $input) {\n documentVersionSignatureEdge {\n node {\n id\n state\n signedBy {\n id\n }\n ...DocumentSignaturesTab_signature\n }\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 canCancel: permission(action: \"core:document-version:request-signature\")\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "f0b9fc6ff9db455e9079bf7e45fcd603";
|
||||
|
||||
export default node;
|
||||
@@ -14,57 +14,52 @@ import { DocumentTitleForm } from "./_components/DocumentTitleForm";
|
||||
import { DocumentVersionsDropdown } from "./_components/DocumentVersionsDropdown";
|
||||
|
||||
export const documentLayoutQuery = graphql`
|
||||
query DocumentLayoutQuery($documentId: ID!) {
|
||||
query DocumentLayoutQuery($documentId: ID! $versionId: ID! $versionSpecified: Boolean!) {
|
||||
# We use this on /documents/:documentId/versions/:versionId
|
||||
version: node(id: $versionId) @include(if: $versionSpecified) {
|
||||
__typename
|
||||
... on DocumentVersion {
|
||||
id
|
||||
status
|
||||
content # TODO: remove, is used on description tab
|
||||
...DocumentActionsDropdown_versionFragment
|
||||
...DocumentLayoutDrawer_versionFragment
|
||||
signatures(first: 0 filter: { activeContract: true }) {
|
||||
totalCount
|
||||
}
|
||||
signedSignatures: signatures(first: 0 filter: { states: [SIGNED], activeContract: true }) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
document: node(id: $documentId) {
|
||||
__typename
|
||||
... on Document {
|
||||
id
|
||||
title
|
||||
classification
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
canPublish: permission(action: "core:document-version:publish")
|
||||
controlInfo: controls(first: 0) {
|
||||
totalCount
|
||||
}
|
||||
...DocumentTitleFormFragment
|
||||
...DocumentActionsDropdownFragment
|
||||
...DocumentLayoutDrawerFragment
|
||||
...DocumentActionsDropdown_documentFragment
|
||||
...DocumentLayoutDrawer_documentFragment
|
||||
# TDOO: remove
|
||||
...DocumentControlsTabFragment
|
||||
versions(first: 20) @connection(key: "DocumentLayout_versions") {
|
||||
__id
|
||||
# We use this on /documents/:documentId
|
||||
lastVersion: versions(first: 1 orderBy: { field: CREATED_AT, direction: DESC }) @skip(if: $versionSpecified) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
content
|
||||
status
|
||||
publishedAt
|
||||
version
|
||||
updatedAt
|
||||
classification
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
content # TODO: remove, is used on description tab
|
||||
...DocumentActionsDropdown_versionFragment
|
||||
...DocumentLayoutDrawer_versionFragment
|
||||
signatures(first: 0 filter: { activeContract: true }) {
|
||||
totalCount
|
||||
}
|
||||
canDeleteDraft: permission(
|
||||
action: "core:document-version:delete-draft"
|
||||
)
|
||||
...DocumentSignaturesTab_version
|
||||
signatures(first: 1000)
|
||||
@connection(key: "DocumentDetailPage_signatures", filters: []) {
|
||||
__id
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
state
|
||||
signedBy {
|
||||
id
|
||||
}
|
||||
...DocumentSignaturesTab_signature
|
||||
}
|
||||
}
|
||||
signedSignatures: signatures(first: 0 filter: { states: [SIGNED], activeContract: true }) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,17 +89,19 @@ export function DocumentLayout(props: { queryRef: PreloadedQuery<DocumentLayoutQ
|
||||
|
||||
const { __ } = useTranslate();
|
||||
|
||||
const { document } = usePreloadedQuery<DocumentLayoutQuery>(documentLayoutQuery, queryRef);
|
||||
if (document.__typename !== "Document") {
|
||||
const { document, version } = usePreloadedQuery<DocumentLayoutQuery>(documentLayoutQuery, queryRef);
|
||||
if (document.__typename !== "Document" || (version && version.__typename !== "DocumentVersion")) {
|
||||
throw new Error("invalid node type");
|
||||
}
|
||||
const lastVersion = document.lastVersion?.edges[0].node;
|
||||
|
||||
const currentVersion
|
||||
= document.versions.edges.find(v => v.node.id === versionId)?.node
|
||||
?? document.versions.edges[0].node;
|
||||
if (!version && !lastVersion) {
|
||||
throw new Error("current version not specified");
|
||||
}
|
||||
|
||||
// It is ok to cas as NonNullable here since we know we have either version or lastVersion
|
||||
const currentVersion = version ?? lastVersion as NonNullable<typeof version | typeof lastVersion>;
|
||||
const isDraft = currentVersion.status === "DRAFT";
|
||||
const signatures = currentVersion.signatures?.edges?.map(s => s.node) ?? [];
|
||||
const signedSignatures = signatures.filter(s => s.state === "SIGNED");
|
||||
|
||||
const [publishDocumentVersion, isPublishing] = useMutationWithToasts(
|
||||
publishDocumentVersionMutation,
|
||||
@@ -153,7 +150,7 @@ export function DocumentLayout(props: { queryRef: PreloadedQuery<DocumentLayoutQ
|
||||
</Button>
|
||||
)}
|
||||
<DocumentVersionsDropdown currentVersionId={currentVersion.id} />
|
||||
<DocumentActionsDropdownn isDraft={isDraft} fKey={document} currentVersion={currentVersion} />
|
||||
<DocumentActionsDropdownn documentFragmentRef={document} versionFragmentRef={currentVersion} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -171,18 +168,19 @@ export function DocumentLayout(props: { queryRef: PreloadedQuery<DocumentLayoutQ
|
||||
<TabLink to={`${urlPrefix}/signatures`}>
|
||||
{__("Signatures")}
|
||||
<TabBadge>
|
||||
{signedSignatures.length}
|
||||
{currentVersion.signedSignatures.totalCount}
|
||||
/
|
||||
{signatures.length}
|
||||
{currentVersion.signatures.totalCount}
|
||||
</TabBadge>
|
||||
</TabLink>
|
||||
)}
|
||||
</Tabs>
|
||||
|
||||
{/* TODO: remove context once control tab is using its own query */}
|
||||
<Outlet context={{ document, version: currentVersion }} />
|
||||
</div>
|
||||
|
||||
<DocumentLayoutDrawer fKey={document} currentVersion={currentVersion} isDraft={isDraft} />
|
||||
<DocumentLayoutDrawer documentFragmentRef={document} versionFragmentRef={currentVersion} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { CoreRelayProvider } from "#/providers/CoreRelayProvider";
|
||||
import { DocumentLayout, documentLayoutQuery } from "./DocumentLayout";
|
||||
|
||||
function DocumentLayoutQueryLoader() {
|
||||
const { documentId } = useParams();
|
||||
const { documentId, versionId } = useParams();
|
||||
if (!documentId) {
|
||||
throw new Error(":documentId missing in route params");
|
||||
}
|
||||
@@ -17,7 +17,11 @@ function DocumentLayoutQueryLoader() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!queryRef) {
|
||||
loadQuery({ documentId });
|
||||
loadQuery({
|
||||
documentId,
|
||||
versionId: versionId ?? "",
|
||||
versionSpecified: !!versionId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -6,23 +6,22 @@ import { loadQuery, useFragment } from "react-relay";
|
||||
import { useNavigate } from "react-router";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentActionsDropdownFragment$key } from "#/__generated__/core/DocumentActionsDropdownFragment.graphql";
|
||||
import type { DocumentActionsDropdown_documentFragment$key } from "#/__generated__/core/DocumentActionsDropdown_documentFragment.graphql";
|
||||
import type { DocumentActionsDropdown_versionFragment$key } from "#/__generated__/core/DocumentActionsDropdown_versionFragment.graphql";
|
||||
import type { DocumentActionsDropdownn_exportVersionMutation } from "#/__generated__/core/DocumentActionsDropdownn_exportVersionMutation.graphql";
|
||||
import type { DocumentLayoutQuery$data } from "#/__generated__/core/DocumentLayoutQuery.graphql";
|
||||
import { PdfDownloadDialog, type PdfDownloadDialogRef } from "#/components/documents/PdfDownloadDialog";
|
||||
import { coreEnvironment } from "#/environments";
|
||||
import { useDeleteDocumentMutation, useDeleteDraftDocumentVersionMutation } from "#/hooks/graph/DocumentGraph";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
import { CurrentUser } from "#/providers/CurrentUser";
|
||||
import type { NodeOf } from "#/types";
|
||||
|
||||
import { documentLayoutQuery } from "../DocumentLayout";
|
||||
|
||||
import UpdateVersionDialog from "./UpdateVersionDialog";
|
||||
|
||||
const fragment = graphql`
|
||||
fragment DocumentActionsDropdownFragment on Document {
|
||||
const documentFragment = graphql`
|
||||
fragment DocumentActionsDropdown_documentFragment on Document {
|
||||
id
|
||||
title
|
||||
canUpdate: permission(action: "core:document:update")
|
||||
@@ -35,6 +34,15 @@ const fragment = graphql`
|
||||
}
|
||||
`;
|
||||
|
||||
const versionFragment = graphql`
|
||||
fragment DocumentActionsDropdown_versionFragment on DocumentVersion {
|
||||
id
|
||||
version
|
||||
status
|
||||
canDeleteDraft: permission(action: "core:document-version:delete-draft")
|
||||
}
|
||||
`;
|
||||
|
||||
const exportDocumentVersionMutation = graphql`
|
||||
mutation DocumentActionsDropdownn_exportVersionMutation(
|
||||
$input: ExportDocumentVersionPDFInput!
|
||||
@@ -46,11 +54,10 @@ const exportDocumentVersionMutation = graphql`
|
||||
`;
|
||||
|
||||
export function DocumentActionsDropdownn(props: {
|
||||
currentVersion: NodeOf<Extract<DocumentLayoutQuery$data["document"], { __typename: "Document" }>["versions"]>;
|
||||
fKey: DocumentActionsDropdownFragment$key;
|
||||
isDraft: boolean;
|
||||
documentFragmentRef: DocumentActionsDropdown_documentFragment$key;
|
||||
versionFragmentRef: DocumentActionsDropdown_versionFragment$key;
|
||||
}) {
|
||||
const { currentVersion, fKey, isDraft } = props;
|
||||
const { documentFragmentRef, versionFragmentRef } = props;
|
||||
|
||||
const organizationId = useOrganizationId();
|
||||
const navigate = useNavigate();
|
||||
@@ -60,7 +67,11 @@ export function DocumentActionsDropdownn(props: {
|
||||
const pdfDownloadDialogRef = useRef<PdfDownloadDialogRef>(null);
|
||||
const confirm = useConfirm();
|
||||
|
||||
const document = useFragment<DocumentActionsDropdownFragment$key>(fragment, fKey);
|
||||
const document = useFragment<DocumentActionsDropdown_documentFragment$key>(documentFragment, documentFragmentRef);
|
||||
const version = useFragment<DocumentActionsDropdown_versionFragment$key>(versionFragment, versionFragmentRef);
|
||||
|
||||
const isDraft = version.status === "DRAFT";
|
||||
|
||||
const [deleteDocument, isDeleting] = useDeleteDocumentMutation();
|
||||
const [deleteDraftDocumentVersion, isDeletingDraft]
|
||||
= useDeleteDraftDocumentVersionMutation();
|
||||
@@ -105,7 +116,7 @@ export function DocumentActionsDropdownn(props: {
|
||||
new Promise<void>((resolve) => {
|
||||
void deleteDraftDocumentVersion({
|
||||
variables: {
|
||||
input: { documentVersionId: currentVersion.id },
|
||||
input: { documentVersionId: version.id },
|
||||
connections: [document.versions.__id],
|
||||
},
|
||||
onSuccess() {
|
||||
@@ -126,7 +137,7 @@ export function DocumentActionsDropdownn(props: {
|
||||
__(
|
||||
"This will permanently delete the draft version %s of \"%s\". This action cannot be undone.",
|
||||
),
|
||||
currentVersion.version,
|
||||
version.version,
|
||||
document.title,
|
||||
),
|
||||
},
|
||||
@@ -139,7 +150,7 @@ export function DocumentActionsDropdownn(props: {
|
||||
watermarkEmail?: string;
|
||||
}) => {
|
||||
const input = {
|
||||
documentVersionId: currentVersion.id,
|
||||
documentVersionId: version.id,
|
||||
withWatermark: options.withWatermark,
|
||||
withSignatures: options.withSignatures,
|
||||
...(options.withWatermark
|
||||
@@ -156,7 +167,7 @@ export function DocumentActionsDropdownn(props: {
|
||||
if (data.exportDocumentVersionPDF) {
|
||||
const link = window.document.createElement("a");
|
||||
link.href = data.exportDocumentVersionPDF.data;
|
||||
link.download = `${document.title}-v${currentVersion.version}.pdf`;
|
||||
link.download = `${document.title}-v${version.version}.pdf`;
|
||||
window.document.body.appendChild(link);
|
||||
link.click();
|
||||
window.document.body.removeChild(link);
|
||||
@@ -188,7 +199,7 @@ export function DocumentActionsDropdownn(props: {
|
||||
)}
|
||||
{isDraft
|
||||
&& document.versions.totalCount > 1
|
||||
&& currentVersion.canDeleteDraft && (
|
||||
&& version.canDeleteDraft && (
|
||||
<DropdownItem
|
||||
onClick={handleDeleteDraft}
|
||||
icon={IconTrashCan}
|
||||
|
||||
@@ -6,9 +6,9 @@ import { loadQuery, useFragment } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
import { z } from "zod";
|
||||
|
||||
import type { DocumentLayoutDrawerFragment$key } from "#/__generated__/core/DocumentLayoutDrawerFragment.graphql";
|
||||
import type { DocumentLayoutDrawer_documentFragment$key } from "#/__generated__/core/DocumentLayoutDrawer_documentFragment.graphql";
|
||||
import type { DocumentLayoutDrawer_versionFragment$key } from "#/__generated__/core/DocumentLayoutDrawer_versionFragment.graphql";
|
||||
import type { DocumentLayoutDrawerMutation } from "#/__generated__/core/DocumentLayoutDrawerMutation.graphql";
|
||||
import type { DocumentLayoutQuery$data } from "#/__generated__/core/DocumentLayoutQuery.graphql";
|
||||
import { ControlledField } from "#/components/form/ControlledField";
|
||||
import { DocumentClassificationOptions } from "#/components/form/DocumentClassificationOptions";
|
||||
import { DocumentTypeOptions } from "#/components/form/DocumentTypeOptions";
|
||||
@@ -17,18 +17,32 @@ import { coreEnvironment } from "#/environments";
|
||||
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
import type { NodeOf } from "#/types";
|
||||
|
||||
import { documentLayoutQuery } from "../DocumentLayout";
|
||||
|
||||
const fragment = graphql`
|
||||
fragment DocumentLayoutDrawerFragment on Document {
|
||||
const documentFragment = graphql`
|
||||
fragment DocumentLayoutDrawer_documentFragment on Document {
|
||||
id
|
||||
documentType
|
||||
canUpdate: permission(action: "core:document:update")
|
||||
}
|
||||
`;
|
||||
|
||||
const versionFragment = graphql`
|
||||
fragment DocumentLayoutDrawer_versionFragment on DocumentVersion {
|
||||
id
|
||||
classification
|
||||
owner {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
version
|
||||
status
|
||||
updatedAt
|
||||
publishedAt
|
||||
}
|
||||
`;
|
||||
|
||||
const updateDocumentMutation = graphql`
|
||||
mutation DocumentLayoutDrawerMutation($input: UpdateDocumentInput!) {
|
||||
updateDocument(input: $input) {
|
||||
@@ -52,11 +66,10 @@ const schema = z.object({
|
||||
});
|
||||
|
||||
export function DocumentLayoutDrawer(props: {
|
||||
currentVersion: NodeOf<Extract<DocumentLayoutQuery$data["document"], { __typename: "Document" }>["versions"]>;
|
||||
fKey: DocumentLayoutDrawerFragment$key;
|
||||
isDraft: boolean;
|
||||
documentFragmentRef: DocumentLayoutDrawer_documentFragment$key;
|
||||
versionFragmentRef: DocumentLayoutDrawer_versionFragment$key;
|
||||
}) {
|
||||
const { currentVersion, fKey, isDraft } = props;
|
||||
const { documentFragmentRef, versionFragmentRef } = props;
|
||||
|
||||
const organizationId = useOrganizationId();
|
||||
const { __ } = useTranslate();
|
||||
@@ -65,15 +78,18 @@ export function DocumentLayoutDrawer(props: {
|
||||
const [isEditingType, setIsEditingType] = useState(false);
|
||||
const [isEditingClassification, setIsEditingClassification] = useState(false);
|
||||
|
||||
const document = useFragment<DocumentLayoutDrawerFragment$key>(fragment, fKey);
|
||||
const document = useFragment<DocumentLayoutDrawer_documentFragment$key>(documentFragment, documentFragmentRef);
|
||||
const version = useFragment<DocumentLayoutDrawer_versionFragment$key>(versionFragment, versionFragmentRef);
|
||||
|
||||
const isDraft = version.status === "DRAFT";
|
||||
|
||||
const { control, handleSubmit, reset } = useFormWithSchema(
|
||||
schema,
|
||||
{
|
||||
defaultValues: {
|
||||
ownerId: currentVersion.owner?.id || "",
|
||||
ownerId: version.owner.id,
|
||||
documentType: document.documentType,
|
||||
classification: currentVersion.classification,
|
||||
classification: version.classification,
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -174,8 +190,8 @@ export function DocumentLayoutDrawer(props: {
|
||||
canEdit={document.canUpdate}
|
||||
>
|
||||
<Badge variant="highlight" size="md" className="gap-2">
|
||||
<Avatar name={currentVersion.owner?.fullName ?? ""} />
|
||||
{currentVersion.owner?.fullName}
|
||||
<Avatar name={version.owner.fullName} />
|
||||
{version.owner.fullName}
|
||||
</Badge>
|
||||
</ReadOnlyPropertyContent>
|
||||
)}
|
||||
@@ -239,7 +255,7 @@ export function DocumentLayoutDrawer(props: {
|
||||
<div className="text-sm text-txt-secondary">
|
||||
{getDocumentClassificationLabel(
|
||||
__,
|
||||
currentVersion.classification,
|
||||
version.classification,
|
||||
)}
|
||||
</div>
|
||||
</ReadOnlyPropertyContent>
|
||||
@@ -256,18 +272,18 @@ export function DocumentLayoutDrawer(props: {
|
||||
</PropertyRow>
|
||||
<PropertyRow label={__("Version")}>
|
||||
<div className="text-sm text-txt-secondary">
|
||||
{currentVersion.version}
|
||||
{version.version}
|
||||
</div>
|
||||
</PropertyRow>
|
||||
<PropertyRow label={__("Last modified")}>
|
||||
<div className="text-sm text-txt-secondary">
|
||||
{formatDate(currentVersion.updatedAt)}
|
||||
{formatDate(version.updatedAt)}
|
||||
</div>
|
||||
</PropertyRow>
|
||||
{currentVersion.publishedAt && (
|
||||
{version.publishedAt && (
|
||||
<PropertyRow label={__("Published Date")}>
|
||||
<div className="text-sm text-txt-secondary">
|
||||
{formatDate(currentVersion.publishedAt)}
|
||||
{formatDate(version.publishedAt)}
|
||||
</div>
|
||||
</PropertyRow>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Button, Dropdown, IconChevronDown, IconClock } from "@probo/ui";
|
||||
import { Suspense } from "react";
|
||||
import { useQueryLoader } from "react-relay";
|
||||
import { useParams } from "react-router";
|
||||
|
||||
@@ -30,8 +31,10 @@ export function DocumentVersionsDropdown(props: {
|
||||
</Button>
|
||||
)}
|
||||
>
|
||||
{queryRef
|
||||
&& <DocumentVersionsDropdownMenu currentVersionId={currentVersionId} queryRef={queryRef} />}
|
||||
<Suspense>
|
||||
{queryRef
|
||||
&& <DocumentVersionsDropdownMenu currentVersionId={currentVersionId} queryRef={queryRef} />}
|
||||
</Suspense>
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Badge } from "@probo/ui";
|
||||
import { Badge, DropdownItem } from "@probo/ui";
|
||||
import { clsx } from "clsx";
|
||||
import { useFragment } from "react-relay";
|
||||
import { Link, useLocation, useParams } from "react-router";
|
||||
@@ -21,10 +21,10 @@ const fragment = graphql`
|
||||
`;
|
||||
|
||||
export function DocumentVersionsDropdownItem(props: {
|
||||
fKey: DocumentVersionsDropdownItemFragment$key;
|
||||
fragmentRef: DocumentVersionsDropdownItemFragment$key;
|
||||
active?: boolean;
|
||||
}) {
|
||||
const { fKey, active } = props;
|
||||
const { fragmentRef, active } = props;
|
||||
|
||||
const { dateTimeFormat, __ } = useTranslate();
|
||||
const organizationId = useOrganizationId();
|
||||
@@ -33,40 +33,41 @@ export function DocumentVersionsDropdownItem(props: {
|
||||
throw new Error(":documentId route param missing");
|
||||
}
|
||||
|
||||
const version = useFragment<DocumentVersionsDropdownItemFragment$key>(fragment, fKey);
|
||||
const version = useFragment<DocumentVersionsDropdownItemFragment$key>(fragment, fragmentRef);
|
||||
|
||||
const suffix = useLocation().pathname.split("/").at(-1);
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={`/organizations/${organizationId}/documents/${documentId}/versions/${version.id}/${suffix}`}
|
||||
className="flex items-center gap-2 py-2 px-[10px] w-full hover:bg-tertiary-hover cursor-pointer rounded"
|
||||
{...props}
|
||||
>
|
||||
<div className="flex gap-3 w-full overflow-hidden">
|
||||
<div
|
||||
className={clsx(
|
||||
"shrink-0 flex items-center justify-center size-10",
|
||||
active && "bg-active rounded",
|
||||
)}
|
||||
>
|
||||
<div className="text-base text-txt-primary whitespace-nowrap font-bold text-center">
|
||||
{version.version}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1 space-y-[2px] overflow-hidden">
|
||||
<div className="flex items-center gap-2 overflow-hidden">
|
||||
{version.status === "DRAFT" && (
|
||||
<Badge variant="neutral" size="sm">
|
||||
{__("Draft")}
|
||||
</Badge>
|
||||
<DropdownItem asChild>
|
||||
<Link
|
||||
to={`/organizations/${organizationId}/documents/${documentId}/versions/${version.id}/${suffix}`}
|
||||
className="flex items-center gap-2 py-2 px-[10px] w-full hover:bg-tertiary-hover cursor-pointer rounded"
|
||||
>
|
||||
<div className="flex gap-3 w-full overflow-hidden">
|
||||
<div
|
||||
className={clsx(
|
||||
"shrink-0 flex items-center justify-center size-10",
|
||||
active && "bg-active rounded",
|
||||
)}
|
||||
>
|
||||
<div className="text-base text-txt-primary whitespace-nowrap font-bold text-center">
|
||||
{version.version}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{dateTimeFormat(version.publishedAt ?? version.updatedAt)}
|
||||
<div className="flex-1 space-y-[2px] overflow-hidden">
|
||||
<div className="flex items-center gap-2 overflow-hidden">
|
||||
{version.status === "DRAFT" && (
|
||||
<Badge variant="neutral" size="sm">
|
||||
{__("Draft")}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary whitespace-nowrap overflow-hidden text-ellipsis">
|
||||
{dateTimeFormat(version.publishedAt ?? version.updatedAt)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</Link>
|
||||
</DropdownItem>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { DropdownItem } from "@probo/ui";
|
||||
import { type PreloadedQuery, usePreloadedQuery } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
@@ -41,12 +40,11 @@ export function DocumentVersionsDropdownMenu(props: {
|
||||
return (
|
||||
<>
|
||||
{document.versions.edges.map(({ node: version }) => (
|
||||
<DropdownItem asChild key={version.id}>
|
||||
<DocumentVersionsDropdownItem
|
||||
fKey={version}
|
||||
active={version.id === currentVersionId}
|
||||
/>
|
||||
</DropdownItem>
|
||||
<DocumentVersionsDropdownItem
|
||||
key={version.id}
|
||||
fragmentRef={version}
|
||||
active={version.id === currentVersionId}
|
||||
/>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Checkbox, Spinner } from "@probo/ui";
|
||||
import { Suspense, useState } from "react";
|
||||
import { type PreloadedQuery, usePreloadedQuery } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentSignatureList_versionFragment$key } from "#/__generated__/core/DocumentSignatureList_versionFragment.graphql";
|
||||
import type { DocumentSignaturesPageQuery } from "#/__generated__/core/DocumentSignaturesPageQuery.graphql";
|
||||
|
||||
import { DocumentSignatureList } from "./_components/DocumentSignatureList";
|
||||
|
||||
export const documentSignaturesPageQuery = graphql`
|
||||
query DocumentSignaturesPageQuery($documentId: ID! $organizationId: ID! $versionId: ID! $versionSpecified: Boolean!) {
|
||||
organization: node(id: $organizationId) {
|
||||
__typename
|
||||
...DocumentSignatureList_peopleFragment @arguments(filter: { excludeContractEnded: true })
|
||||
}
|
||||
# We use this on /documents/:documentId
|
||||
document: node(id: $documentId) @skip(if: $versionSpecified) {
|
||||
__typename
|
||||
... on Document {
|
||||
lastVersion: versions(
|
||||
first: 1
|
||||
orderBy: { field: CREATED_AT, direction: DESC }
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
...DocumentSignatureList_versionFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# We use this on /documents/:documentId/versions/:versionId
|
||||
version: node(id: $versionId) @include(if: $versionSpecified) {
|
||||
__typename
|
||||
...DocumentSignatureList_versionFragment
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
type SignatureState = "REQUESTED" | "SIGNED";
|
||||
|
||||
export function DocumentSignaturesPage(props: { queryRef: PreloadedQuery<DocumentSignaturesPageQuery> }) {
|
||||
const { queryRef } = props;
|
||||
|
||||
const { __ } = useTranslate();
|
||||
|
||||
const {
|
||||
organization,
|
||||
document,
|
||||
version,
|
||||
} = usePreloadedQuery<DocumentSignaturesPageQuery>(documentSignaturesPageQuery, queryRef);
|
||||
if (organization.__typename != "Organization" || (version && version.__typename != "DocumentVersion") || (document && document.__typename !== "Document")) {
|
||||
throw new Error("invalid type for node");
|
||||
}
|
||||
if (!document && !version) {
|
||||
throw new Error("no document or version sepcified");
|
||||
}
|
||||
|
||||
const [selectedStates, setSelectedStates] = useState<SignatureState[]>([]);
|
||||
const handleSelectState = (state: SignatureState) => {
|
||||
setSelectedStates(prev =>
|
||||
prev.includes(state) ? prev.filter(s => s !== state) : [...prev, state],
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-4 pb-2 border-b border-border-solid">
|
||||
<span className="text-sm text-txt-secondary">
|
||||
{__("Filter by state:")}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedStates.includes("REQUESTED")}
|
||||
onChange={() => handleSelectState("REQUESTED")}
|
||||
/>
|
||||
<span
|
||||
className="text-sm text-txt-secondary cursor-pointer select-none"
|
||||
onClick={() => handleSelectState("REQUESTED")}
|
||||
>
|
||||
{__("Requested")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedStates.includes("SIGNED")}
|
||||
onChange={() => handleSelectState("SIGNED")}
|
||||
/>
|
||||
<span
|
||||
className="text-sm text-txt-secondary cursor-pointer select-none"
|
||||
onClick={() => handleSelectState("SIGNED")}
|
||||
>
|
||||
{__("Signed")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Suspense fallback={<Spinner centered />}>
|
||||
<DocumentSignatureList
|
||||
peopleFragmentRef={organization}
|
||||
versionFragmentRef={
|
||||
(version ?? document?.lastVersion.edges[0].node) as DocumentSignatureList_versionFragment$key
|
||||
}
|
||||
selectedStates={selectedStates}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { Suspense, useEffect } from "react";
|
||||
import { useQueryLoader } from "react-relay";
|
||||
import { useParams } from "react-router";
|
||||
|
||||
import type { DocumentSignaturesPageQuery } from "#/__generated__/core/DocumentSignaturesPageQuery.graphql";
|
||||
import { LinkCardSkeleton } from "#/components/skeletons/LinkCardSkeleton";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
import { CoreRelayProvider } from "#/providers/CoreRelayProvider";
|
||||
|
||||
import { DocumentSignaturesPage, documentSignaturesPageQuery } from "./DocumentSignaturesPage";
|
||||
|
||||
function DocumentSignaturesPageQueryLoader() {
|
||||
const organizationId = useOrganizationId();
|
||||
const { documentId, versionId } = useParams();
|
||||
if (!documentId) {
|
||||
throw new Error(":documentId missing in route params");
|
||||
}
|
||||
|
||||
const [queryRef, loadQuery] = useQueryLoader<DocumentSignaturesPageQuery>(documentSignaturesPageQuery);
|
||||
|
||||
useEffect(() => {
|
||||
if (!queryRef) {
|
||||
loadQuery({
|
||||
organizationId,
|
||||
documentId: documentId,
|
||||
versionId: versionId ?? "",
|
||||
versionSpecified: !!versionId,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (!queryRef) {
|
||||
return <LinkCardSkeleton />;
|
||||
}
|
||||
|
||||
return <DocumentSignaturesPage queryRef={queryRef} />;
|
||||
}
|
||||
|
||||
export default function DocumentSignaturesPageLoader() {
|
||||
return (
|
||||
<CoreRelayProvider>
|
||||
<Suspense fallback={<LinkCardSkeleton />}>
|
||||
<DocumentSignaturesPageQueryLoader />
|
||||
</Suspense>
|
||||
</CoreRelayProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useFragment, useRefetchableFragment } from "react-relay";
|
||||
import { graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentSignatureList_peopleFragment$key } from "#/__generated__/core/DocumentSignatureList_peopleFragment.graphql";
|
||||
import type { DocumentSignatureList_versionFragment$key } from "#/__generated__/core/DocumentSignatureList_versionFragment.graphql";
|
||||
import type { DocumentSignatureListQuery } from "#/__generated__/core/DocumentSignatureListQuery.graphql";
|
||||
|
||||
import { DocumentSignatureListItem } from "./DocumentSignatureListItem";
|
||||
import { DocumentSignaturePlaceholder } from "./DocumentSignaturePlaceholder";
|
||||
|
||||
const versionFragment = graphql`
|
||||
fragment DocumentSignatureList_versionFragment on DocumentVersion
|
||||
@refetchable(queryName: "DocumentSignatureListQuery")
|
||||
@argumentDefinitions(
|
||||
count: { type: "Int", defaultValue: 1000 }
|
||||
cursor: { type: "CursorKey" }
|
||||
signatureFilter: { type: "DocumentVersionSignatureFilter" }
|
||||
) {
|
||||
...DocumentSignaturePlaceholder_versionFragment
|
||||
signatures(first: $count, after: $cursor, filter: $signatureFilter)
|
||||
@connection(
|
||||
key: "DocumentSignaturesTab_signatures"
|
||||
filters: ["filter"]
|
||||
) {
|
||||
__id
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
signedBy {
|
||||
id
|
||||
}
|
||||
...DocumentSignatureListItemFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
const peopleFragment = graphql`
|
||||
fragment DocumentSignatureList_peopleFragment on Organization @argumentDefinitions(
|
||||
filter: { type: "PeopleFilter" }
|
||||
) {
|
||||
...DocumentSignaturePlaceholder_organizationFragment
|
||||
people: peoples(
|
||||
first: 1000
|
||||
orderBy: { direction: ASC, field: FULL_NAME }
|
||||
filter: $filter
|
||||
) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
...DocumentSignaturePlaceholder_personFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
type SignatureState = "REQUESTED" | "SIGNED";
|
||||
|
||||
export function DocumentSignatureList(props: {
|
||||
peopleFragmentRef: DocumentSignatureList_peopleFragment$key;
|
||||
versionFragmentRef: DocumentSignatureList_versionFragment$key;
|
||||
selectedStates: SignatureState[];
|
||||
}) {
|
||||
const { peopleFragmentRef, selectedStates, versionFragmentRef } = props;
|
||||
|
||||
const { people, ...organization } = useFragment<DocumentSignatureList_peopleFragment$key>(
|
||||
peopleFragment,
|
||||
peopleFragmentRef,
|
||||
);
|
||||
const [version, refetch] = useRefetchableFragment<
|
||||
DocumentSignatureListQuery,
|
||||
DocumentSignatureList_versionFragment$key
|
||||
>(
|
||||
versionFragment,
|
||||
versionFragmentRef,
|
||||
);
|
||||
const signatureMap = new Map(version.signatures.edges.map(({ node }) => [node.signedBy.id, node]));
|
||||
|
||||
const isFirstRender = useRef(true);
|
||||
|
||||
// Refetch when filter changes (skip initial render)
|
||||
useEffect(() => {
|
||||
if (isFirstRender.current) {
|
||||
isFirstRender.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const filter
|
||||
= selectedStates.length > 0 ? { states: selectedStates } : null;
|
||||
|
||||
refetch({ signatureFilter: filter });
|
||||
}, [selectedStates, refetch]);
|
||||
|
||||
const filteredPeople
|
||||
= selectedStates.length > 0
|
||||
? people.edges.filter(({ node }) => signatureMap.has(node.id))
|
||||
: people.edges;
|
||||
|
||||
return (
|
||||
<div className="space-y-2 divide-y divide-border-solid">
|
||||
{filteredPeople.map(({ node: p }) => {
|
||||
const signature = signatureMap.get(p.id);
|
||||
return (
|
||||
signature
|
||||
? (
|
||||
<DocumentSignatureListItem
|
||||
key={signature.id}
|
||||
fragmentRef={signature}
|
||||
connectionId={version.signatures.__id}
|
||||
/>
|
||||
)
|
||||
: (
|
||||
<DocumentSignaturePlaceholder
|
||||
connectionId={version.signatures.__id}
|
||||
key={p.id}
|
||||
personFragmentRef={p}
|
||||
organizationFragmentRef={organization}
|
||||
versionFragmentRef={version}
|
||||
/>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import { sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Avatar, Badge, Button, IconCircleCheck, IconClock } from "@probo/ui";
|
||||
import { useFragment } from "react-relay";
|
||||
import { type DataID, graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentSignatureListItemFragment$key } from "#/__generated__/core/DocumentSignatureListItemFragment.graphql";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
|
||||
const fragment = graphql`
|
||||
fragment DocumentSignatureListItemFragment on DocumentVersionSignature {
|
||||
id
|
||||
signedBy {
|
||||
fullName
|
||||
}
|
||||
state
|
||||
signedAt
|
||||
requestedAt
|
||||
canCancel: permission(action: "core:document-version-signature:cancel")
|
||||
}
|
||||
`;
|
||||
|
||||
const cancelSignatureMutation = graphql`
|
||||
mutation DocumentSignatureListItem_cancelSignatureMutation(
|
||||
$input: CancelSignatureRequestInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
cancelSignatureRequest(input: $input) {
|
||||
deletedDocumentVersionSignatureId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function DocumentSignatureListItem(props: {
|
||||
fragmentRef: DocumentSignatureListItemFragment$key;
|
||||
connectionId: DataID;
|
||||
}) {
|
||||
const { connectionId, fragmentRef } = props;
|
||||
|
||||
const { __, dateTimeFormat } = useTranslate();
|
||||
const signature = useFragment<DocumentSignatureListItemFragment$key>(fragment, fragmentRef);
|
||||
|
||||
const isSigned = signature.state === "SIGNED";
|
||||
const label = isSigned ? __("Signed on %s") : __("Requested on %s");
|
||||
|
||||
const [cancelSignature, isCancellingSignature] = useMutationWithToasts(
|
||||
cancelSignatureMutation,
|
||||
{
|
||||
successMessage: __("Request cancelled successfully"),
|
||||
errorMessage: __("Failed to cancel signature request"),
|
||||
},
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex gap-3 items-center py-3">
|
||||
<Avatar size="l" name={signature.signedBy.fullName} />
|
||||
<div className="space-y-1">
|
||||
<div className="text-sm text-txt-primary font-medium">
|
||||
{signature.signedBy.fullName}
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary flex items-center gap-1">
|
||||
{isSigned
|
||||
? (
|
||||
<IconCircleCheck size={16} className="text-txt-accent" />
|
||||
)
|
||||
: (
|
||||
<IconClock size={16} />
|
||||
)}
|
||||
<span>
|
||||
{sprintf(
|
||||
label,
|
||||
dateTimeFormat(
|
||||
isSigned ? signature.signedAt : signature.requestedAt,
|
||||
),
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{isSigned
|
||||
? (
|
||||
<Badge variant="success" className="ml-auto">
|
||||
{__("Signed")}
|
||||
</Badge>
|
||||
)
|
||||
: (
|
||||
signature.canCancel && (
|
||||
<Button
|
||||
variant="danger"
|
||||
className="ml-auto"
|
||||
disabled={isCancellingSignature}
|
||||
onClick={() => {
|
||||
void cancelSignature({
|
||||
variables: {
|
||||
input: {
|
||||
documentVersionSignatureId: signature.id,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Cancel request")}
|
||||
</Button>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Avatar, Button } from "@probo/ui";
|
||||
import { useFragment } from "react-relay";
|
||||
import { type DataID, graphql } from "relay-runtime";
|
||||
|
||||
import type { DocumentSignaturePlaceholder_organizationFragment$key } from "#/__generated__/core/DocumentSignaturePlaceholder_organizationFragment.graphql";
|
||||
import type { DocumentSignaturePlaceholder_personFragment$key } from "#/__generated__/core/DocumentSignaturePlaceholder_personFragment.graphql";
|
||||
import type { DocumentSignaturePlaceholder_versionFragment$key } from "#/__generated__/core/DocumentSignaturePlaceholder_versionFragment.graphql";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
|
||||
const organizationFragment = graphql`
|
||||
fragment DocumentSignaturePlaceholder_organizationFragment on Organization {
|
||||
canRequestSignature: permission(
|
||||
action: "core:document-version:request-signature"
|
||||
)
|
||||
}
|
||||
`;
|
||||
|
||||
const personFragment = graphql`
|
||||
fragment DocumentSignaturePlaceholder_personFragment on People {
|
||||
id
|
||||
fullName
|
||||
primaryEmailAddress
|
||||
}
|
||||
`;
|
||||
|
||||
const versionFragment = graphql`
|
||||
fragment DocumentSignaturePlaceholder_versionFragment on DocumentVersion {
|
||||
id
|
||||
status
|
||||
}
|
||||
`;
|
||||
|
||||
const requestSignatureMutation = graphql`
|
||||
mutation DocumentSignaturePlaceholder_requestSignatureMutation(
|
||||
$input: RequestSignatureInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
requestSignature(input: $input) {
|
||||
documentVersionSignatureEdge @prependEdge(connections: $connections) {
|
||||
node {
|
||||
id
|
||||
state
|
||||
signedBy {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export function DocumentSignaturePlaceholder(props: {
|
||||
connectionId: DataID;
|
||||
organizationFragmentRef: DocumentSignaturePlaceholder_organizationFragment$key;
|
||||
personFragmentRef: DocumentSignaturePlaceholder_personFragment$key;
|
||||
versionFragmentRef: DocumentSignaturePlaceholder_versionFragment$key;
|
||||
}) {
|
||||
const { connectionId, organizationFragmentRef, personFragmentRef, versionFragmentRef } = props;
|
||||
|
||||
const { __ } = useTranslate();
|
||||
|
||||
const { canRequestSignature } = useFragment<DocumentSignaturePlaceholder_organizationFragment$key>(
|
||||
organizationFragment,
|
||||
organizationFragmentRef,
|
||||
);
|
||||
const person = useFragment<DocumentSignaturePlaceholder_personFragment$key>(personFragment, personFragmentRef);
|
||||
const version = useFragment<DocumentSignaturePlaceholder_versionFragment$key>(versionFragment, versionFragmentRef);
|
||||
|
||||
const [requestSignature, isSendingRequest] = useMutationWithToasts(
|
||||
requestSignatureMutation,
|
||||
{
|
||||
successMessage: __("Signature request sent successfully"),
|
||||
errorMessage: __("Failed to send signature request"),
|
||||
},
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="flex gap-3 items-center py-3">
|
||||
<Avatar size="l" name={person.fullName} />
|
||||
<div className="space-y-1">
|
||||
<div className="text-sm text-txt-primary font-medium">
|
||||
{person.fullName}
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary">
|
||||
{person.primaryEmailAddress}
|
||||
</div>
|
||||
</div>
|
||||
{version.status === "PUBLISHED" && canRequestSignature && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="ml-auto"
|
||||
disabled={isSendingRequest}
|
||||
onClick={() => {
|
||||
void requestSignature({
|
||||
variables: {
|
||||
input: {
|
||||
documentVersionId: version.id,
|
||||
signatoryId: person.id,
|
||||
},
|
||||
connections: [connectionId],
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Request signature")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import type { NodeOf } from "#/types";
|
||||
|
||||
export default function DocumentDescriptionTab() {
|
||||
const { version } = useOutletContext<{
|
||||
version: NodeOf<Extract<DocumentLayoutQuery$data["document"], { __typename: "Document" }>["versions"]>;
|
||||
version: NodeOf<
|
||||
Extract<DocumentLayoutQuery$data["document"], { __typename: "Document" }>["lastVersion"]
|
||||
> | Extract<DocumentLayoutQuery$data["version"], { __typename: "DocumentVersion" }>;
|
||||
}>();
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
import { sprintf } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Button,
|
||||
Checkbox,
|
||||
IconCircleCheck,
|
||||
IconClock,
|
||||
Spinner,
|
||||
} from "@probo/ui";
|
||||
import { Suspense, useEffect, useRef, useState } from "react";
|
||||
import { graphql, useFragment, useRefetchableFragment } from "react-relay";
|
||||
import { useOutletContext } from "react-router";
|
||||
|
||||
import type { DocumentLayoutQuery$data } from "#/__generated__/core/DocumentLayoutQuery.graphql";
|
||||
import type { DocumentSignaturesTab_signature$key } from "#/__generated__/core/DocumentSignaturesTab_signature.graphql";
|
||||
import type { DocumentSignaturesTab_version$key } from "#/__generated__/core/DocumentSignaturesTab_version.graphql";
|
||||
import type { DocumentSignaturesTabRefetchQuery } from "#/__generated__/core/DocumentSignaturesTabRefetchQuery.graphql";
|
||||
import { usePeople } from "#/hooks/graph/PeopleGraph";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
import type { ItemOf, NodeOf } from "#/types";
|
||||
|
||||
type Version = NodeOf<Extract<DocumentLayoutQuery$data["document"], { __typename: "Document" }>["versions"]>;
|
||||
|
||||
const versionFragment = graphql`
|
||||
fragment DocumentSignaturesTab_version on DocumentVersion
|
||||
@refetchable(queryName: "DocumentSignaturesTabRefetchQuery")
|
||||
@argumentDefinitions(
|
||||
count: { type: "Int", defaultValue: 1000 }
|
||||
cursor: { type: "CursorKey" }
|
||||
signatureFilter: { type: "DocumentVersionSignatureFilter" }
|
||||
) {
|
||||
id
|
||||
status
|
||||
canRequestSignature: permission(
|
||||
action: "core:document-version:request-signature"
|
||||
)
|
||||
signatures(first: $count, after: $cursor, filter: $signatureFilter)
|
||||
@connection(
|
||||
key: "DocumentSignaturesTab_signatures"
|
||||
filters: ["filter"]
|
||||
) {
|
||||
__id
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
state
|
||||
signedBy {
|
||||
id
|
||||
fullName
|
||||
primaryEmailAddress
|
||||
}
|
||||
...DocumentSignaturesTab_signature
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
type SignatureState = "REQUESTED" | "SIGNED";
|
||||
|
||||
export default function DocumentSignaturesTab() {
|
||||
const { version: versionFromContext } = useOutletContext<{
|
||||
version: Version;
|
||||
}>();
|
||||
const [selectedStates, setSelectedStates] = useState<SignatureState[]>([]);
|
||||
const { __ } = useTranslate();
|
||||
|
||||
if (!versionFromContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const toggleState = (state: SignatureState) => {
|
||||
setSelectedStates(prev =>
|
||||
prev.includes(state) ? prev.filter(s => s !== state) : [...prev, state],
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-4 pb-2 border-b border-border-solid">
|
||||
<span className="text-sm text-txt-secondary">
|
||||
{__("Filter by state:")}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedStates.includes("REQUESTED")}
|
||||
onChange={() => toggleState("REQUESTED")}
|
||||
/>
|
||||
<span
|
||||
className="text-sm text-txt-secondary cursor-pointer select-none"
|
||||
onClick={() => toggleState("REQUESTED")}
|
||||
>
|
||||
{__("Requested")}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedStates.includes("SIGNED")}
|
||||
onChange={() => toggleState("SIGNED")}
|
||||
/>
|
||||
<span
|
||||
className="text-sm text-txt-secondary cursor-pointer select-none"
|
||||
onClick={() => toggleState("SIGNED")}
|
||||
>
|
||||
{__("Signed")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<Suspense fallback={<Spinner centered />}>
|
||||
<SignatureList
|
||||
version={versionFromContext}
|
||||
selectedStates={selectedStates}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SignatureList(props: {
|
||||
version: Version;
|
||||
selectedStates: SignatureState[];
|
||||
}) {
|
||||
const { version: propVersion, selectedStates } = props;
|
||||
const [version, refetch] = useRefetchableFragment<
|
||||
DocumentSignaturesTabRefetchQuery,
|
||||
DocumentSignaturesTab_version$key
|
||||
>(versionFragment, propVersion);
|
||||
const signatures = version.signatures?.edges?.map(edge => edge.node) ?? [];
|
||||
const { __ } = useTranslate();
|
||||
const signatureMap = new Map(signatures.map(s => [s.signedBy.id, s]));
|
||||
const organizationId = useOrganizationId();
|
||||
const people = usePeople(organizationId, { excludeContractEnded: true });
|
||||
const signable = version.status === "PUBLISHED";
|
||||
const isFirstRender = useRef(true);
|
||||
|
||||
// Refetch when filter changes (skip initial render)
|
||||
useEffect(() => {
|
||||
if (isFirstRender.current) {
|
||||
isFirstRender.current = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const filter
|
||||
= selectedStates.length > 0 ? { states: selectedStates } : null;
|
||||
|
||||
refetch({ signatureFilter: filter });
|
||||
}, [selectedStates, refetch]);
|
||||
|
||||
if (!version.signatures) {
|
||||
return (
|
||||
<div className="text-center text-sm text-txt-tertiary py-3">
|
||||
{__("Loading signatures...")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (people.length === 0) {
|
||||
return (
|
||||
<div className="text-center text-sm text-txt-tertiary py-3">
|
||||
{__("No people available to request signatures from")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// When a filter is active, only show people who have signatures in the filtered results
|
||||
const filteredPeople
|
||||
= selectedStates.length > 0
|
||||
? people.filter(p => signatureMap.has(p.id))
|
||||
: people;
|
||||
|
||||
if (filteredPeople.length === 0 && selectedStates.length > 0) {
|
||||
return (
|
||||
<div className="text-center text-sm text-txt-tertiary py-3">
|
||||
{__("No signatures match the selected filters")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-2 divide-y divide-border-solid">
|
||||
{filteredPeople.map(p => (
|
||||
<SignatureItem
|
||||
key={p.id}
|
||||
versionId={version.id}
|
||||
signature={signatureMap.get(p.id)}
|
||||
people={p}
|
||||
connectionId={version.signatures.__id}
|
||||
signable={signable}
|
||||
canRequestSignature={version.canRequestSignature}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const signatureFragment = graphql`
|
||||
fragment DocumentSignaturesTab_signature on DocumentVersionSignature {
|
||||
id
|
||||
state
|
||||
signedAt
|
||||
requestedAt
|
||||
signedBy {
|
||||
fullName
|
||||
primaryEmailAddress
|
||||
}
|
||||
canCancel: permission(action: "core:document-version:request-signature")
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* Mutations
|
||||
*/
|
||||
const requestSignatureMutation = graphql`
|
||||
mutation DocumentSignaturesTab_requestSignatureMutation(
|
||||
$input: RequestSignatureInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
requestSignature(input: $input) {
|
||||
documentVersionSignatureEdge @prependEdge(connections: $connections) {
|
||||
node {
|
||||
id
|
||||
state
|
||||
signedBy {
|
||||
id
|
||||
}
|
||||
...DocumentSignaturesTab_signature
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
const cancelSignatureMutation = graphql`
|
||||
mutation DocumentSignaturesTab_cancelSignatureMutation(
|
||||
$input: CancelSignatureRequestInput!
|
||||
$connections: [ID!]!
|
||||
) {
|
||||
cancelSignatureRequest(input: $input) {
|
||||
deletedDocumentVersionSignatureId @deleteEdge(connections: $connections)
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
function SignatureItem(props: {
|
||||
versionId: string;
|
||||
signature?: DocumentSignaturesTab_signature$key;
|
||||
people: ItemOf<ReturnType<typeof usePeople>>;
|
||||
connectionId: string;
|
||||
signable: boolean;
|
||||
canRequestSignature: boolean;
|
||||
}) {
|
||||
const signature = useFragment(signatureFragment, props.signature);
|
||||
const { __, dateTimeFormat } = useTranslate();
|
||||
const [requestSignature, isSendingRequest] = useMutationWithToasts(
|
||||
requestSignatureMutation,
|
||||
{
|
||||
successMessage: __("Signature request sent successfully"),
|
||||
errorMessage: __("Failed to send signature request"),
|
||||
},
|
||||
);
|
||||
const [cancelSignature, isCancellingSignature] = useMutationWithToasts(
|
||||
cancelSignatureMutation,
|
||||
{
|
||||
successMessage: __("Request cancelled successfully"),
|
||||
errorMessage: __("Failed to cancel signature request"),
|
||||
},
|
||||
);
|
||||
|
||||
// No signature request for this user
|
||||
if (!signature) {
|
||||
return (
|
||||
<div className="flex gap-3 items-center py-3">
|
||||
<Avatar size="l" name={props.people.fullName} />
|
||||
<div className="space-y-1">
|
||||
<div className="text-sm text-txt-primary font-medium">
|
||||
{props.people.fullName}
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary">
|
||||
{props.people.primaryEmailAddress}
|
||||
</div>
|
||||
</div>
|
||||
{props.signable && props.canRequestSignature && (
|
||||
<Button
|
||||
variant="secondary"
|
||||
className="ml-auto"
|
||||
disabled={isSendingRequest}
|
||||
onClick={() => {
|
||||
void requestSignature({
|
||||
variables: {
|
||||
input: {
|
||||
documentVersionId: props.versionId,
|
||||
signatoryId: props.people.id,
|
||||
},
|
||||
connections: [props.connectionId],
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Request signature")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const isSigned = signature.state === "SIGNED";
|
||||
const label = isSigned ? __("Signed on %s") : __("Requested on %s");
|
||||
|
||||
return (
|
||||
<div className="flex gap-3 items-center py-3">
|
||||
<Avatar size="l" name={signature.signedBy.fullName} />
|
||||
<div className="space-y-1">
|
||||
<div className="text-sm text-txt-primary font-medium">
|
||||
{signature.signedBy.fullName}
|
||||
</div>
|
||||
<div className="text-xs text-txt-secondary flex items-center gap-1">
|
||||
{isSigned
|
||||
? (
|
||||
<IconCircleCheck size={16} className="text-txt-accent" />
|
||||
)
|
||||
: (
|
||||
<IconClock size={16} />
|
||||
)}
|
||||
<span>
|
||||
{sprintf(
|
||||
label,
|
||||
dateTimeFormat(
|
||||
isSigned ? signature.signedAt : signature.requestedAt,
|
||||
),
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{isSigned
|
||||
? (
|
||||
<Badge variant="success" className="ml-auto">
|
||||
{__("Signed")}
|
||||
</Badge>
|
||||
)
|
||||
: (
|
||||
signature.canCancel && (
|
||||
<Button
|
||||
variant="danger"
|
||||
className="ml-auto"
|
||||
disabled={isCancellingSignature}
|
||||
onClick={() => {
|
||||
void cancelSignature({
|
||||
variables: {
|
||||
input: {
|
||||
documentVersionSignatureId: signature.id,
|
||||
},
|
||||
connections: [props.connectionId],
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{__("Cancel request")}
|
||||
</Button>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ const documentTabs = (prefix: string) => {
|
||||
Fallback: LinkCardSkeleton,
|
||||
Component: lazy(
|
||||
() =>
|
||||
import("../pages/organizations/documents/tabs/DocumentSignaturesTab"),
|
||||
import("#/pages/organizations/documents/signatures/DocumentSignaturesPageLoader"),
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user