Fix control order in SOA
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<6a0d32b2293db5f05fee4b79e61db4b6>>
|
||||
* @generated SignedSource<<3eedb29b73b6e2c450d59f1d1ae0d88a>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ return {
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "CREATED_AT"
|
||||
"field": "CONTROL_SECTION_TITLE"
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -304,7 +304,7 @@ return {
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "__StateOfApplicabilityControlsTab_applicabilityStatements_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"CREATED_AT\"})"
|
||||
"storageKey": "__StateOfApplicabilityControlsTab_applicabilityStatements_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})"
|
||||
}
|
||||
],
|
||||
"type": "StateOfApplicability",
|
||||
@@ -312,6 +312,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "b5a28520cb7a702b208cbfad2c904a99";
|
||||
(node as any).hash = "b80671ffb8f18997cb72a9beddd6cad3";
|
||||
|
||||
export default node;
|
||||
|
||||
370
apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts
generated
Normal file
370
apps/console/src/__generated__/core/StateOfApplicabilityControlsTabRefetchQuery.graphql.ts
generated
Normal file
@@ -0,0 +1,370 @@
|
||||
/**
|
||||
* @generated SignedSource<<6205c318cd1e934de3d61bd54de6e67d>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
|
||||
import { ConcreteRequest } from 'relay-runtime';
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type StateOfApplicabilityControlsTabRefetchQuery$variables = {
|
||||
stateOfApplicabilityId: string;
|
||||
};
|
||||
export type StateOfApplicabilityControlsTabRefetchQuery$data = {
|
||||
readonly node: {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"StateOfApplicabilityControlsTabFragment">;
|
||||
};
|
||||
};
|
||||
export type StateOfApplicabilityControlsTabRefetchQuery = {
|
||||
response: StateOfApplicabilityControlsTabRefetchQuery$data;
|
||||
variables: StateOfApplicabilityControlsTabRefetchQuery$variables;
|
||||
};
|
||||
|
||||
const node: ConcreteRequest = (function(){
|
||||
var v0 = [
|
||||
{
|
||||
"defaultValue": null,
|
||||
"kind": "LocalArgument",
|
||||
"name": "stateOfApplicabilityId"
|
||||
}
|
||||
],
|
||||
v1 = [
|
||||
{
|
||||
"kind": "Variable",
|
||||
"name": "id",
|
||||
"variableName": "stateOfApplicabilityId"
|
||||
}
|
||||
],
|
||||
v2 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "__typename",
|
||||
"storageKey": null
|
||||
},
|
||||
v3 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
v4 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Organization",
|
||||
"kind": "LinkedField",
|
||||
"name": "organization",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v5 = [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 1000
|
||||
},
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "CONTROL_SECTION_TITLE"
|
||||
}
|
||||
}
|
||||
],
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"fragment": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "StateOfApplicabilityControlsTabRefetchQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
{
|
||||
"args": null,
|
||||
"kind": "FragmentSpread",
|
||||
"name": "StateOfApplicabilityControlsTabFragment"
|
||||
}
|
||||
],
|
||||
"type": "StateOfApplicability",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"type": "Query",
|
||||
"abstractKey": null
|
||||
},
|
||||
"kind": "Request",
|
||||
"operation": {
|
||||
"argumentDefinitions": (v0/*: any*/),
|
||||
"kind": "Operation",
|
||||
"name": "StateOfApplicabilityControlsTabRefetchQuery",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v1/*: any*/),
|
||||
"concreteType": null,
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"kind": "InlineFragment",
|
||||
"selections": [
|
||||
(v4/*: any*/),
|
||||
{
|
||||
"alias": "canCreateApplicabilityStatement",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:applicability-statement:create"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:applicability-statement:create\")"
|
||||
},
|
||||
{
|
||||
"alias": "canUpdateApplicabilityStatement",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:applicability-statement:update"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:applicability-statement:update\")"
|
||||
},
|
||||
{
|
||||
"alias": "canDeleteApplicabilityStatement",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "action",
|
||||
"value": "core:applicability-statement:delete"
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:applicability-statement:delete\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v5/*: any*/),
|
||||
"concreteType": "ApplicabilityStatementConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "applicabilityStatements",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ApplicabilityStatementEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ApplicabilityStatement",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "applicability",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "justification",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Control",
|
||||
"kind": "LinkedField",
|
||||
"name": "control",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "sectionTitle",
|
||||
"storageKey": null
|
||||
},
|
||||
(v6/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "bestPractice",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "regulatory",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "contractual",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "riskAssessment",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Framework",
|
||||
"kind": "LinkedField",
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
(v6/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v4/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(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": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": (v5/*: any*/),
|
||||
"filters": [
|
||||
"orderBy"
|
||||
],
|
||||
"handle": "connection",
|
||||
"key": "StateOfApplicabilityControlsTab_applicabilityStatements",
|
||||
"kind": "LinkedHandle",
|
||||
"name": "applicabilityStatements"
|
||||
}
|
||||
],
|
||||
"type": "StateOfApplicability",
|
||||
"abstractKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "33994a831b0a5b34f01e96337e1a638d",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityControlsTabRefetchQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityControlsTabRefetchQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CONTROL_SECTION_TITLE}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "e0895b7dc7342b7df2d310a3a316bac1";
|
||||
|
||||
export default node;
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<eba2fad98effd0d92aa3d1451a71497c>>
|
||||
* @generated SignedSource<<06d20e72b67288c86573caa22b15adff>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -184,7 +184,7 @@ v14 = [
|
||||
"name": "orderBy",
|
||||
"value": {
|
||||
"direction": "ASC",
|
||||
"field": "CREATED_AT"
|
||||
"field": "CONTROL_SECTION_TITLE"
|
||||
}
|
||||
}
|
||||
];
|
||||
@@ -454,7 +454,7 @@ return {
|
||||
]
|
||||
}
|
||||
],
|
||||
"storageKey": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CREATED_AT\"})"
|
||||
"storageKey": "applicabilityStatements(first:1000,orderBy:{\"direction\":\"ASC\",\"field\":\"CONTROL_SECTION_TITLE\"})"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
@@ -477,12 +477,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "ae9d15bd80281c127b74f1a0a32099ee",
|
||||
"cacheID": "dceee9f818236953e28441fb1bbde7aa",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "StateOfApplicabilityDetailPageQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query StateOfApplicabilityDetailPageQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n canExport: permission(action: \"core:state-of-applicability:export\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CREATED_AT}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
"text": "query StateOfApplicabilityDetailPageQuery(\n $stateOfApplicabilityId: ID!\n) {\n node(id: $stateOfApplicabilityId) {\n __typename\n ... on StateOfApplicability {\n id\n name\n sourceId\n snapshotId\n createdAt\n updatedAt\n canUpdate: permission(action: \"core:state-of-applicability:update\")\n canDelete: permission(action: \"core:state-of-applicability:delete\")\n canExport: permission(action: \"core:state-of-applicability:export\")\n organization {\n id\n }\n owner {\n id\n fullName\n }\n ...StateOfApplicabilityControlsTabFragment\n }\n id\n }\n}\n\nfragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {\n id\n organization {\n id\n }\n canCreateApplicabilityStatement: permission(action: \"core:applicability-statement:create\")\n canUpdateApplicabilityStatement: permission(action: \"core:applicability-statement:update\")\n canDeleteApplicabilityStatement: permission(action: \"core:applicability-statement:delete\")\n applicabilityStatements(first: 1000, orderBy: {direction: ASC, field: CONTROL_SECTION_TITLE}) {\n edges {\n node {\n id\n applicability\n justification\n control {\n id\n sectionTitle\n name\n bestPractice\n regulatory\n contractual\n riskAssessment\n framework {\n id\n name\n }\n organization {\n id\n }\n }\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<d3e3309eefb502b19d48c61f9f162d18>>
|
||||
* @generated SignedSource<<240851e53a2871e13a6e19a5b327684c>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -189,7 +189,7 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "478c002a1f98dd87f23c6af0269ea2c6",
|
||||
"cacheID": "680c8a1d89c3f45d06e203072c68e593",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "WebhooksSettingsPage_createMutation",
|
||||
@@ -199,6 +199,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "f47b849f8cad710922bf62eb6aebdd93";
|
||||
(node as any).hash = "ba13f2e1f417d449aa7d959c6411f858";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -461,8 +461,12 @@ function AddApplicabilityStatementDialogContent({
|
||||
);
|
||||
}
|
||||
|
||||
export const AddApplicabilityStatementDialog = forwardRef<AddApplicabilityStatementDialogRef>(
|
||||
(_props, ref) => {
|
||||
type AddApplicabilityStatementDialogProps = {
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
export const AddApplicabilityStatementDialog = forwardRef<AddApplicabilityStatementDialogRef, AddApplicabilityStatementDialogProps>(
|
||||
({ onClose }, ref) => {
|
||||
const { __ } = useTranslate();
|
||||
const dialogRef = useDialogRef();
|
||||
const [stateOfApplicabilityId, setStateOfApplicabilityId] = useState<string | null>(null);
|
||||
@@ -486,6 +490,7 @@ export const AddApplicabilityStatementDialog = forwardRef<AddApplicabilityStatem
|
||||
setStateOfApplicabilityId(null);
|
||||
setOrganizationId(null);
|
||||
setConnectionId(null);
|
||||
onClose?.();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -149,13 +149,6 @@ export const EditControlDialog = forwardRef<EditControlDialogRef>((_props, ref)
|
||||
)}
|
||||
</DialogContent>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={() => dialogRef.current?.close()}
|
||||
>
|
||||
{__("Cancel")}
|
||||
</Button>
|
||||
<Button type="submit" disabled={isUpdating}>
|
||||
{__("Save")}
|
||||
</Button>
|
||||
|
||||
@@ -14,8 +14,9 @@ import {
|
||||
Thead,
|
||||
Tr,
|
||||
} from "@probo/ui";
|
||||
import { Suspense, useRef } from "react";
|
||||
import { graphql, useFragment } from "react-relay";
|
||||
import { Suspense, useCallback, useRef } from "react";
|
||||
import { graphql, useFragment, useRelayEnvironment } from "react-relay";
|
||||
import { fetchQuery } from "relay-runtime";
|
||||
|
||||
import type { StateOfApplicabilityControlsTabFragment$key } from "#/__generated__/core/StateOfApplicabilityControlsTabFragment.graphql";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
@@ -30,6 +31,16 @@ import {
|
||||
type EditControlDialogRef,
|
||||
} from "../dialogs/EditControlDialog";
|
||||
|
||||
const refetchStatementsQuery = graphql`
|
||||
query StateOfApplicabilityControlsTabRefetchQuery($stateOfApplicabilityId: ID!) {
|
||||
node(id: $stateOfApplicabilityId) {
|
||||
... on StateOfApplicability {
|
||||
...StateOfApplicabilityControlsTabFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const controlsFragment = graphql`
|
||||
fragment StateOfApplicabilityControlsTabFragment on StateOfApplicability {
|
||||
id
|
||||
@@ -47,7 +58,7 @@ export const controlsFragment = graphql`
|
||||
action: "core:applicability-statement:delete"
|
||||
)
|
||||
|
||||
applicabilityStatements(first: 1000, orderBy: { direction: ASC, field: CREATED_AT })
|
||||
applicabilityStatements(first: 1000, orderBy: { direction: ASC, field: CONTROL_SECTION_TITLE })
|
||||
@connection(key: "StateOfApplicabilityControlsTab_applicabilityStatements") {
|
||||
__id
|
||||
edges {
|
||||
@@ -99,10 +110,18 @@ export default function StateOfApplicabilityControlsTab({
|
||||
}) {
|
||||
const { __ } = useTranslate();
|
||||
const data = useFragment(controlsFragment, stateOfApplicability);
|
||||
const environment = useRelayEnvironment();
|
||||
const organizationId = useOrganizationId();
|
||||
const addStatementDialogRef = useRef<AddApplicabilityStatementDialogRef>(null);
|
||||
const editDialogRef = useRef<EditControlDialogRef>(null);
|
||||
|
||||
const handleDialogClose = useCallback(() => {
|
||||
if (!data.id) return;
|
||||
fetchQuery(environment, refetchStatementsQuery, {
|
||||
stateOfApplicabilityId: data.id,
|
||||
}).subscribe({});
|
||||
}, [environment, data.id]);
|
||||
|
||||
const connectionId = data.applicabilityStatements?.__id;
|
||||
|
||||
const linkedControls = (data.applicabilityStatements?.edges || []).map(edge => ({
|
||||
@@ -401,7 +420,7 @@ export default function StateOfApplicabilityControlsTab({
|
||||
</div>
|
||||
|
||||
<Suspense fallback={null}>
|
||||
<AddApplicabilityStatementDialog ref={addStatementDialogRef} />
|
||||
<AddApplicabilityStatementDialog ref={addStatementDialogRef} onClose={handleDialogClose} />
|
||||
<EditControlDialog ref={editDialogRef} />
|
||||
</Suspense>
|
||||
</>
|
||||
|
||||
@@ -39,6 +39,9 @@ type (
|
||||
Justification *string `db:"justification"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
|
||||
// Ordering only.
|
||||
SectionTitle string `db:"section_title"`
|
||||
}
|
||||
|
||||
ApplicabilityStatements []*ApplicabilityStatement
|
||||
@@ -48,6 +51,8 @@ func (s ApplicabilityStatement) CursorKey(orderBy ApplicabilityStatementOrderFie
|
||||
switch orderBy {
|
||||
case ApplicabilityStatementOrderFieldCreatedAt:
|
||||
return page.NewCursorKey(s.ID, s.CreatedAt)
|
||||
case ApplicabilityStatementOrderFieldControlSectionTitle:
|
||||
return page.NewCursorKey(s.ID, s.SectionTitle)
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
@@ -74,6 +79,29 @@ func (sac *ApplicabilityStatement) LoadByID(
|
||||
id gid.GID,
|
||||
) error {
|
||||
q := `
|
||||
WITH stmt AS (
|
||||
SELECT
|
||||
a.id,
|
||||
a.state_of_applicability_id,
|
||||
a.control_id,
|
||||
a.organization_id,
|
||||
a.snapshot_id,
|
||||
a.applicability,
|
||||
a.justification,
|
||||
a.created_at,
|
||||
a.updated_at,
|
||||
a.tenant_id,
|
||||
f.name || ' - ' || c.section_title AS section_title
|
||||
FROM
|
||||
applicability_statements a
|
||||
INNER JOIN
|
||||
controls c ON c.id = a.control_id
|
||||
INNER JOIN
|
||||
frameworks f ON f.id = c.framework_id
|
||||
WHERE
|
||||
a.%s
|
||||
AND a.id = @id
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
state_of_applicability_id,
|
||||
@@ -83,15 +111,15 @@ SELECT
|
||||
applicability,
|
||||
justification,
|
||||
created_at,
|
||||
updated_at
|
||||
updated_at,
|
||||
section_title
|
||||
FROM
|
||||
applicability_statements
|
||||
stmt
|
||||
WHERE
|
||||
%s
|
||||
AND id = @id
|
||||
LIMIT 1;
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), scope.SQLFragment())
|
||||
|
||||
args := pgx.StrictNamedArgs{"id": id}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
@@ -139,11 +167,16 @@ SELECT
|
||||
soac.applicability,
|
||||
soac.justification,
|
||||
soac.created_at,
|
||||
soac.updated_at
|
||||
soac.updated_at,
|
||||
f.name || ' - ' || c.section_title AS section_title
|
||||
FROM
|
||||
applicability_statements soac
|
||||
INNER JOIN
|
||||
current_soa ON soac.state_of_applicability_id = current_soa.id
|
||||
INNER JOIN
|
||||
controls c ON c.id = soac.control_id
|
||||
INNER JOIN
|
||||
frameworks f ON f.id = c.framework_id
|
||||
WHERE
|
||||
soac.control_id = @control_id
|
||||
LIMIT 1;
|
||||
@@ -373,6 +406,29 @@ func (sacs *ApplicabilityStatements) LoadByStateOfApplicabilityID(
|
||||
cursor *page.Cursor[ApplicabilityStatementOrderField],
|
||||
) error {
|
||||
q := `
|
||||
WITH stmt AS (
|
||||
SELECT
|
||||
a.id,
|
||||
a.state_of_applicability_id,
|
||||
a.control_id,
|
||||
a.organization_id,
|
||||
a.snapshot_id,
|
||||
a.applicability,
|
||||
a.justification,
|
||||
a.created_at,
|
||||
a.updated_at,
|
||||
a.tenant_id,
|
||||
f.name || ' - ' || c.section_title AS section_title
|
||||
FROM
|
||||
applicability_statements a
|
||||
INNER JOIN
|
||||
controls c ON c.id = a.control_id
|
||||
INNER JOIN
|
||||
frameworks f ON f.id = c.framework_id
|
||||
WHERE
|
||||
a.%[1]s
|
||||
AND a.state_of_applicability_id = @state_of_applicability_id
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
state_of_applicability_id,
|
||||
@@ -382,13 +438,12 @@ SELECT
|
||||
applicability,
|
||||
justification,
|
||||
created_at,
|
||||
updated_at
|
||||
updated_at,
|
||||
section_title
|
||||
FROM
|
||||
applicability_statements
|
||||
stmt
|
||||
WHERE
|
||||
%[1]s
|
||||
AND state_of_applicability_id = @state_of_applicability_id
|
||||
AND %[2]s
|
||||
%[2]s
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
|
||||
|
||||
@@ -459,11 +514,16 @@ WITH soac_ctrl AS (
|
||||
soac.justification,
|
||||
soac.created_at,
|
||||
soac.updated_at,
|
||||
soac.tenant_id
|
||||
soac.tenant_id,
|
||||
f.name || ' - ' || c.section_title AS section_title
|
||||
FROM
|
||||
applicability_statements soac
|
||||
INNER JOIN
|
||||
states_of_applicability soa ON soac.state_of_applicability_id = soa.id
|
||||
INNER JOIN
|
||||
controls c ON c.id = soac.control_id
|
||||
INNER JOIN
|
||||
frameworks f ON f.id = c.framework_id
|
||||
WHERE
|
||||
soac.%[1]s
|
||||
AND soac.control_id = @control_id
|
||||
@@ -478,7 +538,8 @@ SELECT
|
||||
applicability,
|
||||
justification,
|
||||
created_at,
|
||||
updated_at
|
||||
updated_at,
|
||||
section_title
|
||||
FROM
|
||||
soac_ctrl
|
||||
WHERE
|
||||
|
||||
@@ -21,13 +21,16 @@ import (
|
||||
type ApplicabilityStatementOrderField string
|
||||
|
||||
const (
|
||||
ApplicabilityStatementOrderFieldCreatedAt ApplicabilityStatementOrderField = "CREATED_AT"
|
||||
ApplicabilityStatementOrderFieldCreatedAt ApplicabilityStatementOrderField = "CREATED_AT"
|
||||
ApplicabilityStatementOrderFieldControlSectionTitle ApplicabilityStatementOrderField = "CONTROL_SECTION_TITLE"
|
||||
)
|
||||
|
||||
func (p ApplicabilityStatementOrderField) Column() string {
|
||||
switch p {
|
||||
case ApplicabilityStatementOrderFieldCreatedAt:
|
||||
return "created_at"
|
||||
case ApplicabilityStatementOrderFieldControlSectionTitle:
|
||||
return "section_title_sort_key(section_title)"
|
||||
}
|
||||
|
||||
panic("unknown ApplicabilityStatementOrderField")
|
||||
@@ -44,7 +47,8 @@ func (p ApplicabilityStatementOrderField) MarshalText() ([]byte, error) {
|
||||
func (p *ApplicabilityStatementOrderField) UnmarshalText(text []byte) error {
|
||||
val := string(text)
|
||||
switch val {
|
||||
case string(ApplicabilityStatementOrderFieldCreatedAt):
|
||||
case string(ApplicabilityStatementOrderFieldCreatedAt),
|
||||
string(ApplicabilityStatementOrderFieldControlSectionTitle):
|
||||
*p = ApplicabilityStatementOrderField(val)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ func (s StateOfApplicabilityService) ExportPDF(
|
||||
nil,
|
||||
page.Head,
|
||||
page.OrderBy[coredata.ApplicabilityStatementOrderField]{
|
||||
Field: coredata.ApplicabilityStatementOrderFieldCreatedAt,
|
||||
Field: coredata.ApplicabilityStatementOrderFieldControlSectionTitle,
|
||||
Direction: page.OrderDirectionAsc,
|
||||
},
|
||||
)
|
||||
|
||||
@@ -615,6 +615,10 @@ enum ApplicabilityStatementOrderField
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldCreatedAt"
|
||||
)
|
||||
CONTROL_SECTION_TITLE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.ApplicabilityStatementOrderFieldControlSectionTitle"
|
||||
)
|
||||
}
|
||||
|
||||
enum CountryCode
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1517,7 +1517,7 @@ type Organization struct {
|
||||
TrustCenterFiles *TrustCenterFileConnection `json:"trustCenterFiles"`
|
||||
TrustCenter *TrustCenter `json:"trustCenter,omitempty"`
|
||||
CustomDomain *CustomDomain `json:"customDomain,omitempty"`
|
||||
WebhookSubscriptions *WebhookSubscriptionConnection `json:"webhookSubscriptions"`
|
||||
WebhookSubscriptions *WebhookSubscriptionConnection `json:"webhookSubscriptions"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
Permission bool `json:"permission"`
|
||||
@@ -2623,6 +2623,22 @@ type Viewer struct {
|
||||
SignableDocument *SignableDocument `json:"signableDocument,omitempty"`
|
||||
}
|
||||
|
||||
type WebhookEvent struct {
|
||||
ID gid.GID `json:"id"`
|
||||
WebhookSubscriptionID gid.GID `json:"webhookSubscriptionId"`
|
||||
Status coredata.WebhookEventStatus `json:"status"`
|
||||
Response *string `json:"response,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
func (WebhookEvent) IsNode() {}
|
||||
func (this WebhookEvent) GetID() gid.GID { return this.ID }
|
||||
|
||||
type WebhookEventEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *WebhookEvent `json:"node"`
|
||||
}
|
||||
|
||||
type WebhookSubscription struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Organization *Organization `json:"organization,omitempty"`
|
||||
@@ -2642,19 +2658,3 @@ type WebhookSubscriptionEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *WebhookSubscription `json:"node"`
|
||||
}
|
||||
|
||||
type WebhookEvent struct {
|
||||
ID gid.GID `json:"id"`
|
||||
WebhookSubscriptionID gid.GID `json:"webhookSubscriptionId"`
|
||||
Status coredata.WebhookEventStatus `json:"status"`
|
||||
Response *string `json:"response,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
func (WebhookEvent) IsNode() {}
|
||||
func (this WebhookEvent) GetID() gid.GID { return this.ID }
|
||||
|
||||
type WebhookEventEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *WebhookEvent `json:"node"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user