@@ -72,6 +72,7 @@ const controlOverviewPageQuery = graphql`
|
|||||||
name
|
name
|
||||||
description
|
description
|
||||||
state
|
state
|
||||||
|
version
|
||||||
evidences(first: 50)
|
evidences(first: 50)
|
||||||
@connection(key: "ControlOverviewPage_evidences") {
|
@connection(key: "ControlOverviewPage_evidences") {
|
||||||
__id
|
__id
|
||||||
@@ -96,12 +97,13 @@ const controlOverviewPageQuery = graphql`
|
|||||||
|
|
||||||
const updateTaskStateMutation = graphql`
|
const updateTaskStateMutation = graphql`
|
||||||
mutation ControlOverviewPageUpdateTaskStateMutation(
|
mutation ControlOverviewPageUpdateTaskStateMutation(
|
||||||
$input: UpdateTaskStateInput!
|
$input: UpdateTaskInput!
|
||||||
) {
|
) {
|
||||||
updateTaskState(input: $input) {
|
updateTask(input: $input) {
|
||||||
task {
|
task {
|
||||||
id
|
id
|
||||||
state
|
state
|
||||||
|
version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +194,7 @@ function ControlOverviewPageContent({
|
|||||||
const { organizationId, frameworkId, controlId } = useParams();
|
const { organizationId, frameworkId, controlId } = useParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const environment = useRelayEnvironment();
|
const environment = useRelayEnvironment();
|
||||||
const [updateTaskState] =
|
const [updateTask] =
|
||||||
useMutation<ControlOverviewPageUpdateTaskStateMutationType>(
|
useMutation<ControlOverviewPageUpdateTaskStateMutationType>(
|
||||||
updateTaskStateMutation
|
updateTaskStateMutation
|
||||||
);
|
);
|
||||||
@@ -306,22 +308,19 @@ function ControlOverviewPageContent({
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleTaskClick = (taskId: string, currentState: string) => {
|
const handleTaskClick = (
|
||||||
|
taskId: string,
|
||||||
|
currentState: string,
|
||||||
|
version: number
|
||||||
|
) => {
|
||||||
const newState = currentState === "DONE" ? "TODO" : "DONE";
|
const newState = currentState === "DONE" ? "TODO" : "DONE";
|
||||||
|
|
||||||
updateTaskState({
|
updateTask({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
taskId,
|
taskId,
|
||||||
state: newState,
|
state: newState,
|
||||||
},
|
expectedVersion: version,
|
||||||
},
|
|
||||||
optimisticResponse: {
|
|
||||||
updateTaskState: {
|
|
||||||
task: {
|
|
||||||
id: taskId,
|
|
||||||
state: newState,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onCompleted: () => {
|
onCompleted: () => {
|
||||||
@@ -842,7 +841,7 @@ function ControlOverviewPageContent({
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
task?.id &&
|
task?.id &&
|
||||||
task?.state &&
|
task?.state &&
|
||||||
handleTaskClick(task.id, task.state)
|
handleTaskClick(task.id, task.state, task.version)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{task?.state === "DONE" && (
|
{task?.state === "DONE" && (
|
||||||
@@ -856,7 +855,7 @@ function ControlOverviewPageContent({
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
task?.id &&
|
task?.id &&
|
||||||
task?.state &&
|
task?.state &&
|
||||||
handleTaskClick(task.id, task.state)
|
handleTaskClick(task.id, task.state, task.version)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<e1f21afb2bf00563c8343f3700c08c6e>>
|
* @generated SignedSource<<b26c1748d5c4ae346ebbe98ea97b7459>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -43,6 +43,7 @@ export type ControlOverviewPageQuery$data = {
|
|||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly state: TaskState;
|
readonly state: TaskState;
|
||||||
|
readonly version: number;
|
||||||
};
|
};
|
||||||
}>;
|
}>;
|
||||||
};
|
};
|
||||||
@@ -107,17 +108,24 @@ v7 = {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "__typename",
|
"name": "version",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v8 = {
|
v8 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "cursor",
|
"name": "__typename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v9 = {
|
v9 = {
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "cursor",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
v10 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"concreteType": "PageInfo",
|
"concreteType": "PageInfo",
|
||||||
@@ -142,7 +150,7 @@ v9 = {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v10 = {
|
v11 = {
|
||||||
"kind": "ClientExtension",
|
"kind": "ClientExtension",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
@@ -154,7 +162,7 @@ v10 = {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
v11 = [
|
v12 = [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -201,25 +209,25 @@ v11 = [
|
|||||||
"name": "createdAt",
|
"name": "createdAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v7/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v8/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v9/*: any*/),
|
(v9/*: any*/)
|
||||||
(v10/*: any*/)
|
|
||||||
],
|
],
|
||||||
v12 = [
|
"storageKey": null
|
||||||
|
},
|
||||||
|
(v10/*: any*/),
|
||||||
|
(v11/*: any*/)
|
||||||
|
],
|
||||||
|
v13 = [
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
"value": 100
|
"value": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v13 = [
|
v14 = [
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
@@ -277,6 +285,7 @@ return {
|
|||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
|
(v7/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": "evidences",
|
"alias": "evidences",
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -284,19 +293,19 @@ return {
|
|||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "__ControlOverviewPage_evidences_connection",
|
"name": "__ControlOverviewPage_evidences_connection",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": (v11/*: any*/),
|
"selections": (v12/*: any*/),
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v7/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v8/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v9/*: any*/),
|
(v9/*: any*/)
|
||||||
(v10/*: any*/)
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
(v10/*: any*/),
|
||||||
|
(v11/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -325,7 +334,7 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v7/*: any*/),
|
(v8/*: any*/),
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
@@ -336,7 +345,7 @@ return {
|
|||||||
(v6/*: any*/),
|
(v6/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v12/*: any*/),
|
"args": (v13/*: any*/),
|
||||||
"concreteType": "TaskConnection",
|
"concreteType": "TaskConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "tasks",
|
"name": "tasks",
|
||||||
@@ -362,41 +371,42 @@ return {
|
|||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
|
(v7/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v13/*: any*/),
|
"args": (v14/*: any*/),
|
||||||
"concreteType": "EvidenceConnection",
|
"concreteType": "EvidenceConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "evidences",
|
"name": "evidences",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": (v11/*: any*/),
|
"selections": (v12/*: any*/),
|
||||||
"storageKey": "evidences(first:50)"
|
"storageKey": "evidences(first:50)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v13/*: any*/),
|
"args": (v14/*: any*/),
|
||||||
"filters": null,
|
"filters": null,
|
||||||
"handle": "connection",
|
"handle": "connection",
|
||||||
"key": "ControlOverviewPage_evidences",
|
"key": "ControlOverviewPage_evidences",
|
||||||
"kind": "LinkedHandle",
|
"kind": "LinkedHandle",
|
||||||
"name": "evidences"
|
"name": "evidences"
|
||||||
},
|
},
|
||||||
(v7/*: any*/)
|
|
||||||
],
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
(v8/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v9/*: any*/),
|
(v9/*: any*/)
|
||||||
(v10/*: any*/)
|
],
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
|
(v10/*: any*/),
|
||||||
|
(v11/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": "tasks(first:100)"
|
"storageKey": "tasks(first:100)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v12/*: any*/),
|
"args": (v13/*: any*/),
|
||||||
"filters": null,
|
"filters": null,
|
||||||
"handle": "connection",
|
"handle": "connection",
|
||||||
"key": "ControlOverviewPage_tasks",
|
"key": "ControlOverviewPage_tasks",
|
||||||
@@ -413,7 +423,7 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "4364cf9b985fb746dde62c1e94063390",
|
"cacheID": "c8fb4975f792904f5106fb8518406063",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"connection": [
|
"connection": [
|
||||||
@@ -436,11 +446,11 @@ return {
|
|||||||
},
|
},
|
||||||
"name": "ControlOverviewPageQuery",
|
"name": "ControlOverviewPageQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query ControlOverviewPageQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n name\n description\n state\n category\n tasks(first: 100) {\n edges {\n node {\n id\n name\n description\n state\n evidences(first: 50) {\n edges {\n node {\n id\n mimeType\n filename\n size\n state\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
|
"text": "query ControlOverviewPageQuery(\n $controlId: ID!\n) {\n control: node(id: $controlId) {\n __typename\n id\n ... on Control {\n name\n description\n state\n category\n tasks(first: 100) {\n edges {\n node {\n id\n name\n description\n state\n version\n evidences(first: 50) {\n edges {\n node {\n id\n mimeType\n filename\n size\n state\n createdAt\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "b91e90b278ccedc6b44d3a3c53593e73";
|
(node as any).hash = "bd552dffe1a33e64e693a9170074989f";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<168d543d518d84054b1f194ee13feeaa>>
|
* @generated SignedSource<<c6eaf570ef3d4e5a289ab266f6662546>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -10,18 +10,22 @@
|
|||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type TaskState = "DONE" | "TODO";
|
export type TaskState = "DONE" | "TODO";
|
||||||
export type UpdateTaskStateInput = {
|
export type UpdateTaskInput = {
|
||||||
state: TaskState;
|
description?: string | null | undefined;
|
||||||
|
expectedVersion: number;
|
||||||
|
name?: string | null | undefined;
|
||||||
|
state?: TaskState | null | undefined;
|
||||||
taskId: string;
|
taskId: string;
|
||||||
};
|
};
|
||||||
export type ControlOverviewPageUpdateTaskStateMutation$variables = {
|
export type ControlOverviewPageUpdateTaskStateMutation$variables = {
|
||||||
input: UpdateTaskStateInput;
|
input: UpdateTaskInput;
|
||||||
};
|
};
|
||||||
export type ControlOverviewPageUpdateTaskStateMutation$data = {
|
export type ControlOverviewPageUpdateTaskStateMutation$data = {
|
||||||
readonly updateTaskState: {
|
readonly updateTask: {
|
||||||
readonly task: {
|
readonly task: {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly state: TaskState;
|
readonly state: TaskState;
|
||||||
|
readonly version: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -48,9 +52,9 @@ v1 = [
|
|||||||
"variableName": "input"
|
"variableName": "input"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"concreteType": "UpdateTaskStatePayload",
|
"concreteType": "UpdateTaskPayload",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "updateTaskState",
|
"name": "updateTask",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
@@ -74,6 +78,13 @@ v1 = [
|
|||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "state",
|
"name": "state",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "version",
|
||||||
|
"storageKey": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -100,16 +111,16 @@ return {
|
|||||||
"selections": (v1/*: any*/)
|
"selections": (v1/*: any*/)
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "7099089b96d6ca450d88f0a3597b2203",
|
"cacheID": "4ebc7b830cc1c2129ec26429ab681c44",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "ControlOverviewPageUpdateTaskStateMutation",
|
"name": "ControlOverviewPageUpdateTaskStateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation ControlOverviewPageUpdateTaskStateMutation(\n $input: UpdateTaskStateInput!\n) {\n updateTaskState(input: $input) {\n task {\n id\n state\n }\n }\n}\n"
|
"text": "mutation ControlOverviewPageUpdateTaskStateMutation(\n $input: UpdateTaskInput!\n) {\n updateTask(input: $input) {\n task {\n id\n state\n version\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "a81e1f58fa9931a70b85633b6ad0bd7a";
|
(node as any).hash = "9a076b4306fee5793009ea3082e5cde2";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
Reference in New Issue
Block a user