diff --git a/apps/console/src/__generated__/core/MeasureTasksTabQuery.graphql.ts b/apps/console/src/__generated__/core/MeasureTasksTabQuery.graphql.ts index b9a3b8034..6533250e9 100644 --- a/apps/console/src/__generated__/core/MeasureTasksTabQuery.graphql.ts +++ b/apps/console/src/__generated__/core/MeasureTasksTabQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<1ee2176710f8c100a3d16e65be7a5f74>> * @lightSyntaxTransform * @nogrep */ @@ -16,25 +16,22 @@ export type MeasureTasksTabQuery$variables = { }; export type MeasureTasksTabQuery$data = { readonly node: { - readonly id?: string; - readonly tasks?: { + readonly __typename: "Measure"; + readonly id: string; + readonly tasks: { readonly __id: string; readonly edges: ReadonlyArray<{ readonly node: { - readonly assignedTo: { - readonly fullName: string; - readonly id: string; - } | null | undefined; - readonly deadline: any | null | undefined; - readonly description: string | null | undefined; readonly id: string; - readonly name: string; readonly state: TaskState; - readonly timeEstimate: any | null | undefined; - readonly " $fragmentSpreads": FragmentRefs<"TaskFormDialogFragment">; + readonly " $fragmentSpreads": FragmentRefs<"TaskFormDialogFragment" | "TasksCard_TaskRowFragment">; }; }>; }; + } | { + // This will never be '%other', but we need some + // value in case none of the concrete values match. + readonly __typename: "%other"; }; }; export type MeasureTasksTabQuery = { @@ -61,14 +58,14 @@ v2 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "id", + "name": "__typename", "storageKey": null }, v3 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "name", + "name": "id", "storageKey": null }, v4 = { @@ -79,60 +76,13 @@ v4 = { "storageKey": null }, v5 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null -}, -v6 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "timeEstimate", - "storageKey": null -}, -v7 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "deadline", - "storageKey": null -}, -v8 = { - "alias": null, - "args": null, - "concreteType": "People", - "kind": "LinkedField", - "name": "assignedTo", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fullName", - "storageKey": null - } - ], - "storageKey": null -}, -v9 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v10 = { "alias": null, "args": null, "kind": "ScalarField", "name": "cursor", "storageKey": null }, -v11 = { +v6 = { "alias": null, "args": null, "concreteType": "PageInfo", @@ -157,7 +107,7 @@ v11 = { ], "storageKey": null }, -v12 = { +v7 = { "kind": "ClientExtension", "selections": [ { @@ -169,13 +119,20 @@ v12 = { } ] }, -v13 = [ +v8 = [ { "kind": "Literal", "name": "first", "value": 100 } -]; +], +v9 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; return { "fragment": { "argumentDefinitions": (v0/*: any*/), @@ -184,72 +141,85 @@ return { "name": "MeasureTasksTabQuery", "selections": [ { - "alias": null, - "args": (v1/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "kind": "InlineFragment", - "selections": [ - (v2/*: any*/), - { - "alias": "tasks", - "args": null, - "concreteType": "TaskConnection", - "kind": "LinkedField", - "name": "__Measure__tasks_connection", - "plural": false, - "selections": [ - { - "alias": null, + "kind": "RequiredField", + "field": { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + (v3/*: any*/), + { + "kind": "RequiredField", + "field": { + "alias": "tasks", "args": null, - "concreteType": "TaskEdge", + "concreteType": "TaskConnection", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "__Measure__tasks_connection", + "plural": false, "selections": [ { - "alias": null, - "args": null, - "concreteType": "Task", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - (v5/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - { - "args": null, - "kind": "FragmentSpread", - "name": "TaskFormDialogFragment" - }, - (v8/*: any*/), - (v9/*: any*/) - ], - "storageKey": null + "kind": "RequiredField", + "field": { + "alias": null, + "args": null, + "concreteType": "TaskEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Task", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + (v4/*: any*/), + { + "args": null, + "kind": "FragmentSpread", + "name": "TaskFormDialogFragment" + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "TasksCard_TaskRowFragment" + }, + (v2/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + }, + "action": "THROW" }, - (v10/*: any*/) + (v6/*: any*/), + (v7/*: any*/) ], "storageKey": null }, - (v11/*: any*/), - (v12/*: any*/) - ], - "storageKey": null - } - ], - "type": "Measure", - "abstractKey": null - } - ], - "storageKey": null + "action": "THROW" + } + ], + "type": "Measure", + "abstractKey": null + } + ], + "storageKey": null + }, + "action": "THROW" } ], "type": "Query", @@ -269,14 +239,14 @@ return { "name": "node", "plural": false, "selections": [ - (v9/*: any*/), (v2/*: any*/), + (v3/*: any*/), { "kind": "InlineFragment", "selections": [ { "alias": null, - "args": (v13/*: any*/), + "args": (v8/*: any*/), "concreteType": "TaskConnection", "kind": "LinkedField", "name": "tasks", @@ -298,13 +268,49 @@ return { "name": "node", "plural": false, "selections": [ - (v2/*: any*/), (v3/*: any*/), (v4/*: any*/), - (v5/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - (v8/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + }, + (v9/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "timeEstimate", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "deadline", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "assignedTo", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, { "alias": null, "args": null, @@ -313,26 +319,53 @@ return { "name": "measure", "plural": false, "selections": [ - (v2/*: any*/) + (v3/*: any*/), + (v9/*: any*/) ], "storageKey": null }, - (v9/*: any*/) + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:delete\")" + }, + (v2/*: any*/) ], "storageKey": null }, - (v10/*: any*/) + (v5/*: any*/) ], "storageKey": null }, - (v11/*: any*/), - (v12/*: any*/) + (v6/*: any*/), + (v7/*: any*/) ], "storageKey": "tasks(first:100)" }, { "alias": null, - "args": (v13/*: any*/), + "args": (v8/*: any*/), "filters": null, "handle": "connection", "key": "Measure__tasks", @@ -349,7 +382,7 @@ return { ] }, "params": { - "cacheID": "7988e2a18d5929fe99d9cef8de244627", + "cacheID": "81a89b0ac44d316e2e580dd536be2812", "id": null, "metadata": { "connection": [ @@ -366,11 +399,11 @@ return { }, "name": "MeasureTasksTabQuery", "operationKind": "query", - "text": "query MeasureTasksTabQuery(\n $measureId: ID!\n) {\n node(id: $measureId) {\n __typename\n ... on Measure {\n id\n tasks(first: 100) {\n edges {\n node {\n id\n name\n state\n description\n timeEstimate\n deadline\n ...TaskFormDialogFragment\n assignedTo {\n id\n fullName\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n" + "text": "query MeasureTasksTabQuery(\n $measureId: ID!\n) {\n node(id: $measureId) {\n __typename\n ... on Measure {\n id\n tasks(first: 100) {\n edges {\n node {\n id\n state\n ...TaskFormDialogFragment\n ...TasksCard_TaskRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n\nfragment TasksCard_TaskRowFragment on Task {\n id\n name\n state\n description\n timeEstimate\n deadline\n canUpdate: permission(action: \"core:task:update\")\n canDelete: permission(action: \"core:task:delete\")\n assignedTo {\n id\n fullName\n }\n measure {\n id\n name\n }\n}\n" } }; })(); -(node as any).hash = "358a07bb3e13ea9828d0703541caf894"; +(node as any).hash = "0e886bdfa0bcba6ec98758098e1ec0b5"; export default node; diff --git a/apps/console/src/__generated__/core/TaskGraphQuery.graphql.ts b/apps/console/src/__generated__/core/TaskGraphQuery.graphql.ts index f31f2d99a..3a9a0e872 100644 --- a/apps/console/src/__generated__/core/TaskGraphQuery.graphql.ts +++ b/apps/console/src/__generated__/core/TaskGraphQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<40ebf241dc89f4b4b1705e4a2fabb935>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -121,6 +121,19 @@ return { { "kind": "InlineFragment", "selections": [ + { + "alias": "canCreateTask", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:create\")" + }, { "alias": null, "args": (v4/*: any*/), @@ -146,7 +159,6 @@ return { "plural": false, "selections": [ (v2/*: any*/), - (v5/*: any*/), { "alias": null, "args": null, @@ -161,6 +173,7 @@ return { "name": "description", "storageKey": null }, + (v5/*: any*/), { "alias": null, "args": null, @@ -207,6 +220,32 @@ return { ], "storageKey": null }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:delete\")" + }, (v3/*: any*/) ], "storageKey": null @@ -296,12 +335,12 @@ return { ] }, "params": { - "cacheID": "72cbeaa7667c477f85e5c3ecb09b7bf4", + "cacheID": "9932d2887bfde054e02b14404a5ec7f8", "id": null, "metadata": {}, "name": "TaskGraphQuery", "operationKind": "query", - "text": "query TaskGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...TasksPageFragment\n }\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n\nfragment TasksPageFragment on Organization {\n tasks(first: 500) {\n edges {\n node {\n id\n name\n state\n description\n timeEstimate\n deadline\n ...TaskFormDialogFragment\n measure {\n id\n name\n }\n assignedTo {\n id\n fullName\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query TaskGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...TasksPageFragment\n }\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n\nfragment TasksCard_TaskRowFragment on Task {\n id\n name\n state\n description\n timeEstimate\n deadline\n canUpdate: permission(action: \"core:task:update\")\n canDelete: permission(action: \"core:task:delete\")\n assignedTo {\n id\n fullName\n }\n measure {\n id\n name\n }\n}\n\nfragment TasksPageFragment on Organization {\n canCreateTask: permission(action: \"core:task:create\")\n tasks(first: 500) {\n edges {\n node {\n id\n state\n ...TaskFormDialogFragment\n ...TasksCard_TaskRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); diff --git a/apps/console/src/__generated__/core/TasksCard_TaskRowFragment.graphql.ts b/apps/console/src/__generated__/core/TasksCard_TaskRowFragment.graphql.ts new file mode 100644 index 000000000..1cad7f55a --- /dev/null +++ b/apps/console/src/__generated__/core/TasksCard_TaskRowFragment.graphql.ts @@ -0,0 +1,155 @@ +/** + * @generated SignedSource<<8baf10554098b6b6a3084311dda31fb3>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment } from 'relay-runtime'; +export type TaskState = "DONE" | "TODO"; +import { FragmentRefs } from "relay-runtime"; +export type TasksCard_TaskRowFragment$data = { + readonly assignedTo: { + readonly fullName: string; + readonly id: string; + } | null | undefined; + readonly canDelete: boolean; + readonly canUpdate: boolean; + readonly deadline: any | null | undefined; + readonly description: string | null | undefined; + readonly id: string; + readonly measure: { + readonly id: string; + readonly name: string; + } | null | undefined; + readonly name: string; + readonly state: TaskState; + readonly timeEstimate: any | null | undefined; + readonly " $fragmentType": "TasksCard_TaskRowFragment"; +}; +export type TasksCard_TaskRowFragment$key = { + readonly " $data"?: TasksCard_TaskRowFragment$data; + readonly " $fragmentSpreads": FragmentRefs<"TasksCard_TaskRowFragment">; +}; + +const node: ReaderFragment = (function(){ +var v0 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "argumentDefinitions": [], + "kind": "Fragment", + "metadata": null, + "name": "TasksCard_TaskRowFragment", + "selections": [ + (v0/*: any*/), + (v1/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "state", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "timeEstimate", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "deadline", + "storageKey": null + }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:delete\")" + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "assignedTo", + "plural": false, + "selections": [ + (v0/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Measure", + "kind": "LinkedField", + "name": "measure", + "plural": false, + "selections": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "storageKey": null + } + ], + "type": "Task", + "abstractKey": null +}; +})(); + +(node as any).hash = "34df57ab7cc88c1fbf84f42b4024d50b"; + +export default node; diff --git a/apps/console/src/__generated__/core/TasksPageFragment.graphql.ts b/apps/console/src/__generated__/core/TasksPageFragment.graphql.ts index c4c50b055..8d2421ffd 100644 --- a/apps/console/src/__generated__/core/TasksPageFragment.graphql.ts +++ b/apps/console/src/__generated__/core/TasksPageFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<08f448295bd6530904bfbcfc19b1764d>> * @lightSyntaxTransform * @nogrep */ @@ -12,26 +12,15 @@ import { ReaderFragment } from 'relay-runtime'; export type TaskState = "DONE" | "TODO"; import { FragmentRefs } from "relay-runtime"; export type TasksPageFragment$data = { + readonly canCreateTask: boolean; readonly id: string; readonly tasks: { readonly __id: string; readonly edges: ReadonlyArray<{ readonly node: { - readonly assignedTo: { - readonly fullName: string; - readonly id: string; - } | null | undefined; - readonly deadline: any | null | undefined; - readonly description: string | null | undefined; readonly id: string; - readonly measure: { - readonly id: string; - readonly name: string; - } | null | undefined; - readonly name: string; readonly state: TaskState; - readonly timeEstimate: any | null | undefined; - readonly " $fragmentSpreads": FragmentRefs<"TaskFormDialogFragment">; + readonly " $fragmentSpreads": FragmentRefs<"TaskFormDialogFragment" | "TasksCard_TaskRowFragment">; }; }>; }; @@ -54,13 +43,6 @@ v1 = { "kind": "ScalarField", "name": "id", "storageKey": null -}, -v2 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null }; return { "argumentDefinitions": [ @@ -125,89 +107,50 @@ return { "name": "TasksPageFragment", "selections": [ { - "alias": "tasks", + "alias": "canCreateTask", "args": [ { - "kind": "Variable", - "name": "orderBy", - "variableName": "order" + "kind": "Literal", + "name": "action", + "value": "core:task:create" } ], - "concreteType": "TaskConnection", - "kind": "LinkedField", - "name": "__TasksPageFragment_tasks_connection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TaskEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:create\")" + }, + { + "kind": "RequiredField", + "field": { + "alias": "tasks", + "args": [ + { + "kind": "Variable", + "name": "orderBy", + "variableName": "order" + } + ], + "concreteType": "TaskConnection", + "kind": "LinkedField", + "name": "__TasksPageFragment_tasks_connection", + "plural": false, + "selections": [ + { + "kind": "RequiredField", + "field": { "alias": null, "args": null, - "concreteType": "Task", + "concreteType": "TaskEdge", "kind": "LinkedField", - "name": "node", - "plural": false, + "name": "edges", + "plural": true, "selections": [ - (v1/*: any*/), - (v2/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "timeEstimate", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "deadline", - "storageKey": null - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "TaskFormDialogFragment" - }, - { - "alias": null, - "args": null, - "concreteType": "Measure", + "concreteType": "Task", "kind": "LinkedField", - "name": "measure", - "plural": false, - "selections": [ - (v1/*: any*/), - (v2/*: any*/) - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "People", - "kind": "LinkedField", - "name": "assignedTo", + "name": "node", "plural": false, "selections": [ (v1/*: any*/), @@ -215,7 +158,24 @@ return { "alias": null, "args": null, "kind": "ScalarField", - "name": "fullName", + "name": "state", + "storageKey": null + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "TaskFormDialogFragment" + }, + { + "args": null, + "kind": "FragmentSpread", + "name": "TasksCard_TaskRowFragment" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", "storageKey": null } ], @@ -225,75 +185,69 @@ return { "alias": null, "args": null, "kind": "ScalarField", - "name": "__typename", + "name": "cursor", "storageKey": null } ], "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 - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "kind": "ClientExtension", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__id", - "storageKey": null - } - ] - } - ], - "storageKey": null + "action": "THROW" + }, + { + "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 + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + "action": "THROW" }, (v1/*: any*/) ], @@ -302,6 +256,6 @@ return { }; })(); -(node as any).hash = "466d3b82119334991a0714bb0b7cd6d0"; +(node as any).hash = "6c9522af3e0782b9f919b76572ba6225"; export default node; diff --git a/apps/console/src/__generated__/core/TasksPageFragment_query.graphql.ts b/apps/console/src/__generated__/core/TasksPageFragment_query.graphql.ts index 2b0e070b8..940fb536b 100644 --- a/apps/console/src/__generated__/core/TasksPageFragment_query.graphql.ts +++ b/apps/console/src/__generated__/core/TasksPageFragment_query.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<9c51ce30a6a5b894c53064c5e9248fd9>> * @lightSyntaxTransform * @nogrep */ @@ -194,6 +194,19 @@ return { { "kind": "InlineFragment", "selections": [ + { + "alias": "canCreateTask", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:create" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:create\")" + }, { "alias": null, "args": (v13/*: any*/), @@ -219,7 +232,6 @@ return { "plural": false, "selections": [ (v12/*: any*/), - (v14/*: any*/), { "alias": null, "args": null, @@ -234,6 +246,7 @@ return { "name": "description", "storageKey": null }, + (v14/*: any*/), { "alias": null, "args": null, @@ -280,6 +293,32 @@ return { ], "storageKey": null }, + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:update\")" + }, + { + "alias": "canDelete", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:task:delete" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:task:delete\")" + }, (v11/*: any*/) ], "storageKey": null @@ -369,16 +408,16 @@ return { ] }, "params": { - "cacheID": "d31450ee0ddd09b0e08b43c9f7728f5f", + "cacheID": "8fadc4428353d6ef3444f63b913dc695", "id": null, "metadata": {}, "name": "TasksPageFragment_query", "operationKind": "query", - "text": "query TasksPageFragment_query(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 500\n $last: Int = null\n $order: TaskOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TasksPageFragment_16fISc\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n\nfragment TasksPageFragment_16fISc on Organization {\n tasks(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n name\n state\n description\n timeEstimate\n deadline\n ...TaskFormDialogFragment\n measure {\n id\n name\n }\n assignedTo {\n id\n fullName\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" + "text": "query TasksPageFragment_query(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 500\n $last: Int = null\n $order: TaskOrder = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...TasksPageFragment_16fISc\n id\n }\n}\n\nfragment TaskFormDialogFragment on Task {\n id\n description\n name\n state\n timeEstimate\n deadline\n assignedTo {\n id\n }\n measure {\n id\n }\n}\n\nfragment TasksCard_TaskRowFragment on Task {\n id\n name\n state\n description\n timeEstimate\n deadline\n canUpdate: permission(action: \"core:task:update\")\n canDelete: permission(action: \"core:task:delete\")\n assignedTo {\n id\n fullName\n }\n measure {\n id\n name\n }\n}\n\nfragment TasksPageFragment_16fISc on Organization {\n canCreateTask: permission(action: \"core:task:create\")\n tasks(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n state\n ...TaskFormDialogFragment\n ...TasksCard_TaskRowFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n" } }; })(); -(node as any).hash = "466d3b82119334991a0714bb0b7cd6d0"; +(node as any).hash = "6c9522af3e0782b9f919b76572ba6225"; export default node; diff --git a/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts b/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts index 9ed075c8b..b03d29bd0 100644 --- a/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts +++ b/apps/console/src/__generated__/core/TrustCenterGraphQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -50,6 +50,7 @@ export type TrustCenterGraphQuery$data = { }; readonly trustCenter?: { readonly active: boolean; + readonly canUpdate: boolean; readonly createdAt: any; readonly id: string; readonly ndaFileName: string | null | undefined; @@ -199,6 +200,19 @@ v9 = { }, (v5/*: any*/), (v6/*: any*/), + { + "alias": "canUpdate", + "args": [ + { + "kind": "Literal", + "name": "action", + "value": "core:trust-center:update" + } + ], + "kind": "ScalarField", + "name": "permission", + "storageKey": "permission(action:\"core:trust-center:update\")" + }, { "alias": null, "args": [ @@ -881,7 +895,7 @@ return { ] }, "params": { - "cacheID": "45a68d6b8fc3128a695529daa40eba3a", + "cacheID": "77cfcb8a51459702b07cd2295688ad07", "id": null, "metadata": { "connection": [ @@ -898,11 +912,11 @@ return { }, "name": "TrustCenterGraphQuery", "operationKind": "query", - "text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n references(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n createdAt\n updatedAt\n }\n }\n }\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n" + "text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n customDomain {\n id\n domain\n }\n trustCenter {\n id\n active\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:trust-center:update\")\n references(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n createdAt\n updatedAt\n }\n }\n }\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n trustCenterFiles(first: 100) {\n edges {\n node {\n id\n ...TrustCenterFilesCardFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n slackConnections(first: 100) {\n edges {\n node {\n id\n channel\n channelId\n createdAt\n updatedAt\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterFilesCardFragment on TrustCenterFile {\n id\n name\n category\n fileUrl\n trustCenterVisibility\n createdAt\n updatedAt\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n" } }; })(); -(node as any).hash = "1ee50612da47b187cb55b2e228ba5945"; +(node as any).hash = "8c59eb08a0ec74662a01a3b8bb8ab56f"; export default node; diff --git a/apps/console/src/components/organizations/SlackConnection.tsx b/apps/console/src/components/organizations/SlackConnection.tsx index a572714b0..18f9032a6 100644 --- a/apps/console/src/components/organizations/SlackConnection.tsx +++ b/apps/console/src/components/organizations/SlackConnection.tsx @@ -2,10 +2,9 @@ import { Badge, Button, Card } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; import { sprintf } from "@probo/helpers"; import type { TrustCenterGraphQuery$data } from "/__generated__/core/TrustCenterGraphQuery.graphql"; -import { use } from "react"; -import { PermissionsContext } from "/providers/PermissionsContext"; type Props = { + canUpdate: boolean; organizationId: string; slackConnections: NonNullable< TrustCenterGraphQuery$data["organization"]["slackConnections"] @@ -13,11 +12,11 @@ type Props = { }; export function SlackConnections({ + canUpdate, organizationId, slackConnections: connectedSlackConnections, }: Props) { const { __, dateTimeFormat } = useTranslate(); - const { isAuthorized } = use(PermissionsContext); const slackConnectionDefinitions = [ { id: "SLACK", @@ -87,7 +86,7 @@ export function SlackConnections({ ) : ( - isAuthorized("TrustCenter", "updateTrustCenter") && ( + canUpdate && ( diff --git a/apps/console/src/components/tasks/TasksCard.tsx b/apps/console/src/components/tasks/TasksCard.tsx index f42a7a6e8..d368485ec 100644 --- a/apps/console/src/components/tasks/TasksCard.tsx +++ b/apps/console/src/components/tasks/TasksCard.tsx @@ -18,38 +18,35 @@ import { useDialogRef, } from "@probo/ui"; import { Fragment, use } from "react"; -import { graphql, useMutation, useRelayEnvironment } from "react-relay"; +import { + graphql, + useFragment, + useMutation, + useRelayEnvironment, +} from "react-relay"; import { Link, useLocation, useParams } from "react-router"; -import type { TaskFormDialogFragment$key } from "/__generated__/core/TaskFormDialogFragment.graphql"; import TaskFormDialog, { taskUpdateMutation, } from "/components/tasks/TaskFormDialog"; import { updateStoreCounter } from "/hooks/useMutationWithIncrement"; import { useOrganizationId } from "/hooks/useOrganizationId"; import { PermissionsContext } from "/providers/PermissionsContext"; -import type { ItemOf } from "/types"; +import type { TasksCard_TaskRowFragment$key } from "/__generated__/core/TasksCard_TaskRowFragment.graphql"; +import type { TasksPageFragment$data } from "/__generated__/core/TasksPageFragment.graphql"; +import type { MeasureTasksTabQuery$data } from "/__generated__/core/MeasureTasksTabQuery.graphql"; +import type { TaskFormDialogFragment$key } from "/__generated__/core/TaskFormDialogFragment.graphql"; type Props = { - tasks: ({ - assignedTo?: { - id: string; - fullName: string; - } | null; - id: string; - name: string; - state: "TODO" | "DONE"; - description?: string | null; - timeEstimate?: string | null; - deadline?: string | null; - measure?: { - id: string; - name: string; - } | null; - } & TaskFormDialogFragment$key)[]; + tasks: + | TasksPageFragment$data["tasks"]["edges"] + | Extract< + MeasureTasksTabQuery$data["node"], + { __typename: "Measure" } + >["tasks"]["edges"]; connectionId: string; }; -export default function TasksCard({ tasks, connectionId }: Props) { +export function TasksCard({ tasks, connectionId }: Props) { const { __ } = useTranslate(); const hash = useLocation().hash.replace("#", ""); @@ -60,8 +57,8 @@ export default function TasksCard({ tasks, connectionId }: Props) { ] as const; const tasksPerHash = new Map([ - ["", tasks?.filter((t) => t.state === "TODO")], - ["done", tasks?.filter((t) => t.state === "DONE")], + ["", tasks?.filter(({ node }) => node.state === "TODO")], + ["done", tasks?.filter(({ node }) => node.state === "DONE")], ["all", tasks], ]); @@ -69,14 +66,9 @@ export default function TasksCard({ tasks, connectionId }: Props) { usePageTitle(__("Tasks")); - const { isAuthorized } = use(PermissionsContext); - - const hasAnyAction = - isAuthorized("Task", "updateTask") || isAuthorized("Task", "deleteTask"); - return (
- {tasks?.length === 0 ? ( + {tasks.length === 0 ? (

{__("No tasks")}

) : ( @@ -102,23 +94,21 @@ export default function TasksCard({ tasks, connectionId }: Props) { {h.label} - {tasksPerHash.get(h.hash)?.map((task) => ( + {tasksPerHash.get(h.hash)?.map(({ node: task }) => ( ))} )) : // Todo and Done tab simply list todos - filteredTasks?.map((task) => ( + filteredTasks?.map(({ node: task }) => ( ))}
@@ -129,11 +119,31 @@ export default function TasksCard({ tasks, connectionId }: Props) { } type TaskRowProps = { - task: ItemOf; + fKey: TasksCard_TaskRowFragment$key | TaskFormDialogFragment$key; connectionId: string; - hasAnyAction: boolean; }; +const fragment = graphql` + fragment TasksCard_TaskRowFragment on Task { + id + name + state + description + timeEstimate + deadline + canUpdate: permission(action: "core:task:update") + canDelete: permission(action: "core:task:delete") + assignedTo { + id + fullName + } + measure { + id + name + } + } +`; + const deleteMutation = graphql` mutation TasksCardDeleteMutation( $input: DeleteTaskInput! @@ -155,14 +165,19 @@ function TaskRow(props: TaskRowProps) { const { isAuthorized } = use(PermissionsContext); const relayEnv = useRelayEnvironment(); + const { canUpdate, canDelete, ...task } = + useFragment( + fragment, + props.fKey as TasksCard_TaskRowFragment$key, + ); const [updateTask, isUpdating] = useMutation(taskUpdateMutation); const onToggle = () => { promisifyMutation(updateTask)({ variables: { input: { - taskId: props.task.id, - state: props.task.state === "TODO" ? "DONE" : "TODO", + taskId: task.id, + state: task.state === "TODO" ? "DONE" : "TODO", }, }, }); @@ -173,7 +188,7 @@ function TaskRow(props: TaskRowProps) { () => promisifyMutation(deleteTask)({ variables: { - input: { taskId: props.task.id }, + input: { taskId: task.id }, connections: [props.connectionId], }, onCompleted: (_response, errors) => { @@ -195,7 +210,10 @@ function TaskRow(props: TaskRowProps) { return ( <> - +
@@ -205,52 +223,53 @@ function TaskRow(props: TaskRowProps) { className="cursor-pointer -m-1 p-1 disabled:opacity-60" disabled={isUpdating} > - +
-

{props.task.name}

- {props.task.description && ( +

{task.name}

+ {task.description && (

- {props.task.description} + {task.description}

)} +
- {props.task.measure && ( + {task.measure && ( - {props.task.measure?.name} + {task.measure?.name} )} - {props.task.timeEstimate && ( - {formatDuration(props.task.timeEstimate, __)} + {task.timeEstimate && ( + {formatDuration(task.timeEstimate, __)} )} - {props.task.deadline && ( -
- {props.task.assignedTo?.fullName && ( + {task.assignedTo?.fullName && (
- {props.task.assignedTo.fullName} + {task.assignedTo.fullName}
)}
{isUpdating && } - {props.hasAnyAction && ( + {(canUpdate || canDelete) && ( {isAuthorized("Task", "updateTask") && ( (); - const data = useLazyLoadQuery(tasksQuery, { + const { node } = useLazyLoadQuery(tasksQuery, { measureId: measure.id, }); - const node = data.node; - if (!node || !node.tasks) { - return null; + if (node.__typename !== "Measure") { + throw new Error("invalid node type"); } const connectionId = node.tasks.__id; - const tasks = node.tasks.edges?.map((edge) => edge.node) ?? []; return (
- + )} - +
); } diff --git a/apps/console/src/pages/organizations/trustCenter/TrustCenterOverviewTab.tsx b/apps/console/src/pages/organizations/trustCenter/TrustCenterOverviewTab.tsx index 6a55705c6..a0d612e6f 100644 --- a/apps/console/src/pages/organizations/trustCenter/TrustCenterOverviewTab.tsx +++ b/apps/console/src/pages/organizations/trustCenter/TrustCenterOverviewTab.tsx @@ -277,6 +277,7 @@ export default function TrustCenterOverviewTab() {

{__("Integrations")}

edge.node) ??