Add noncompliance snapshots
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -37,7 +37,7 @@ export function SnapshotBanner({ snapshotId }: Props) {
|
|||||||
<span className="font-medium text-warning-800">{__("Snapshot")} {snapshot.name}</span>
|
<span className="font-medium text-warning-800">{__("Snapshot")} {snapshot.name}</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-warning-700">
|
<p className="text-sm text-warning-700">
|
||||||
{__("You are viewing a snapshot of data from")} {dateFormat(snapshot.createdAt, { year: "numeric", month: "short", day: "numeric" })}
|
{__("You are viewing a snapshot from")} {dateFormat(snapshot.createdAt, { year: "numeric", month: "short", day: "numeric" })}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<e9fde8de02cc2e3ec97ce64b67818bfe>>
|
* @generated SignedSource<<32724438ee7e1d53f9c53938a8129e4b>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type LinkedSnapshotsCardFragment$data = {
|
export type LinkedSnapshotsCardFragment$data = {
|
||||||
readonly createdAt: any;
|
readonly createdAt: any;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<b68d2b7e020579736ca058b633352dee>>
|
* @generated SignedSource<<f6c8c318141054ceb118dfdb145a756d>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type LinkedSnapshotsDialogFragment$data = {
|
export type LinkedSnapshotsDialogFragment$data = {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import { useMutationWithToasts } from "../useMutationWithToasts";
|
|||||||
export const RegistriesConnectionKey = "RegistriesPage_nonconformityRegistries";
|
export const RegistriesConnectionKey = "RegistriesPage_nonconformityRegistries";
|
||||||
|
|
||||||
export const nonconformityRegistriesQuery = graphql`
|
export const nonconformityRegistriesQuery = graphql`
|
||||||
query NonconformityRegistryGraphListQuery($organizationId: ID!) {
|
query NonconformityRegistryGraphListQuery($organizationId: ID!, $snapshotId: ID) {
|
||||||
node(id: $organizationId) {
|
node(id: $organizationId) {
|
||||||
... on Organization {
|
... on Organization {
|
||||||
...NonconformityRegistriesPageFragment
|
...NonconformityRegistriesPageFragment @arguments(snapshotId: $snapshotId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<a6972659c0399779d3d646dc4057bc57>>
|
* @generated SignedSource<<b306072db6c1956ba956e52443ebf866>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
|
|||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type NonconformityRegistryGraphListQuery$variables = {
|
export type NonconformityRegistryGraphListQuery$variables = {
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
|
snapshotId?: string | null | undefined;
|
||||||
};
|
};
|
||||||
export type NonconformityRegistryGraphListQuery$data = {
|
export type NonconformityRegistryGraphListQuery$data = {
|
||||||
readonly node: {
|
readonly node: {
|
||||||
@@ -29,6 +30,11 @@ var v0 = [
|
|||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "organizationId"
|
"name": "organizationId"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "snapshotId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v1 = [
|
v1 = [
|
||||||
@@ -38,28 +44,40 @@ v1 = [
|
|||||||
"variableName": "organizationId"
|
"variableName": "organizationId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v2 = {
|
v2 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "snapshotId",
|
||||||
|
"variableName": "snapshotId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v3 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "__typename",
|
"name": "__typename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v3 = {
|
v4 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v4 = [
|
v5 = [
|
||||||
|
{
|
||||||
|
"fields": (v2/*: any*/),
|
||||||
|
"kind": "ObjectValue",
|
||||||
|
"name": "filter"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
"value": 10
|
"value": 10
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v5 = {
|
v6 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
@@ -85,7 +103,7 @@ return {
|
|||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"args": null,
|
"args": (v2/*: any*/),
|
||||||
"kind": "FragmentSpread",
|
"kind": "FragmentSpread",
|
||||||
"name": "NonconformityRegistriesPageFragment"
|
"name": "NonconformityRegistriesPageFragment"
|
||||||
}
|
}
|
||||||
@@ -114,14 +132,14 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
|
||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"concreteType": "NonconformityRegistryConnection",
|
"concreteType": "NonconformityRegistryConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "nonconformityRegistries",
|
"name": "nonconformityRegistries",
|
||||||
@@ -150,7 +168,7 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -215,8 +233,8 @@ return {
|
|||||||
"name": "audit",
|
"name": "audit",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v6/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -225,8 +243,8 @@ return {
|
|||||||
"name": "framework",
|
"name": "framework",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/)
|
(v6/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -241,7 +259,7 @@ return {
|
|||||||
"name": "owner",
|
"name": "owner",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -266,7 +284,7 @@ return {
|
|||||||
"name": "updatedAt",
|
"name": "updatedAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v2/*: any*/)
|
(v3/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
@@ -318,12 +336,14 @@ return {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": "nonconformityRegistries(first:10)"
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"filters": null,
|
"filters": [
|
||||||
|
"filter"
|
||||||
|
],
|
||||||
"handle": "connection",
|
"handle": "connection",
|
||||||
"key": "RegistriesPage_nonconformityRegistries",
|
"key": "RegistriesPage_nonconformityRegistries",
|
||||||
"kind": "LinkedHandle",
|
"kind": "LinkedHandle",
|
||||||
@@ -339,16 +359,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "2196012e8a68c64e7d479a2b85021ffd",
|
"cacheID": "727537500ac037fec1a9ffd04a5c651f",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "NonconformityRegistryGraphListQuery",
|
"name": "NonconformityRegistryGraphListQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query NonconformityRegistryGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...NonconformityRegistriesPageFragment\n }\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment on Organization {\n id\n nonconformityRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
"text": "query NonconformityRegistryGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...NonconformityRegistriesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment_3iomuz on Organization {\n id\n nonconformityRegistries(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "b8104dc2e4ccb9eecfe1f0d494084975";
|
(node as any).hash = "2bb77e5c9adce5860e4dd2c31f1155e4";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<459d0a122659971be9b24c79f47691e7>>
|
* @generated SignedSource<<9f17487d2517912ef9f93b0026eaa555>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
export type CreateSnapshotInput = {
|
export type CreateSnapshotInput = {
|
||||||
description?: string | null | undefined;
|
description?: string | null | undefined;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<5bcc9f9b743d01fc99fd749b970dccd3>>
|
* @generated SignedSource<<a490e7800ce4b387ced38d07b3e42bca>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
export type SnapshotGraphNodeQuery$variables = {
|
export type SnapshotGraphNodeQuery$variables = {
|
||||||
snapshotId: string;
|
snapshotId: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import { useOrganizationId } from "/hooks/useOrganizationId";
|
|||||||
import { CreateNonconformityRegistryDialog } from "./dialogs/CreateNonconformityRegistryDialog";
|
import { CreateNonconformityRegistryDialog } from "./dialogs/CreateNonconformityRegistryDialog";
|
||||||
import { deleteNonconformityRegistryMutation, RegistriesConnectionKey } from "../../../hooks/graph/NonconformityRegistryGraph";
|
import { deleteNonconformityRegistryMutation, RegistriesConnectionKey } from "../../../hooks/graph/NonconformityRegistryGraph";
|
||||||
import { sprintf, promisifyMutation, getStatusVariant, getStatusLabel } from "@probo/helpers";
|
import { sprintf, promisifyMutation, getStatusVariant, getStatusLabel } from "@probo/helpers";
|
||||||
|
import { SnapshotBanner } from "/components/SnapshotBanner";
|
||||||
|
import { useParams } from "react-router";
|
||||||
import type { NonconformityRegistriesPageQuery } from "./__generated__/NonconformityRegistriesPageQuery.graphql";
|
import type { NonconformityRegistriesPageQuery } from "./__generated__/NonconformityRegistriesPageQuery.graphql";
|
||||||
import type {
|
import type {
|
||||||
NonconformityRegistriesPageFragment$key,
|
NonconformityRegistriesPageFragment$key,
|
||||||
@@ -47,10 +49,15 @@ const nonconformityRegistriesPageFragment = graphql`
|
|||||||
@argumentDefinitions(
|
@argumentDefinitions(
|
||||||
first: { type: "Int", defaultValue: 10 }
|
first: { type: "Int", defaultValue: 10 }
|
||||||
after: { type: "CursorKey" }
|
after: { type: "CursorKey" }
|
||||||
|
snapshotId: { type: "ID", defaultValue: null }
|
||||||
) {
|
) {
|
||||||
id
|
id
|
||||||
nonconformityRegistries(first: $first, after: $after)
|
nonconformityRegistries(
|
||||||
@connection(key: "RegistriesPage_nonconformityRegistries") {
|
first: $first
|
||||||
|
after: $after
|
||||||
|
filter: { snapshotId: $snapshotId }
|
||||||
|
)
|
||||||
|
@connection(key: "RegistriesPage_nonconformityRegistries", filters: ["filter"]) {
|
||||||
__id
|
__id
|
||||||
totalCount
|
totalCount
|
||||||
edges {
|
edges {
|
||||||
@@ -91,15 +98,17 @@ const nonconformityRegistriesPageFragment = graphql`
|
|||||||
export default function NonconformityRegistriesPage({ queryRef }: NonconformityRegistriesPageProps) {
|
export default function NonconformityRegistriesPage({ queryRef }: NonconformityRegistriesPageProps) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
|
const { snapshotId } = useParams<{ snapshotId?: string }>();
|
||||||
|
const isSnapshotMode = Boolean(snapshotId);
|
||||||
|
|
||||||
usePageTitle(__("Nonconformity Registries"));
|
usePageTitle(__("Nonconformity Registries"));
|
||||||
|
|
||||||
const organization = usePreloadedQuery(
|
const organization = usePreloadedQuery(
|
||||||
graphql`
|
graphql`
|
||||||
query NonconformityRegistriesPageQuery($organizationId: ID!) {
|
query NonconformityRegistriesPageQuery($organizationId: ID!, $snapshotId: ID) {
|
||||||
node(id: $organizationId) {
|
node(id: $organizationId) {
|
||||||
... on Organization {
|
... on Organization {
|
||||||
...NonconformityRegistriesPageFragment
|
...NonconformityRegistriesPageFragment @arguments(snapshotId: $snapshotId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,20 +121,29 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
|
|||||||
organization.node as NonconformityRegistriesPageFragment$key
|
organization.node as NonconformityRegistriesPageFragment$key
|
||||||
);
|
);
|
||||||
|
|
||||||
const connectionId = ConnectionHandler.getConnectionID(organizationId, RegistriesConnectionKey);
|
const connectionId = ConnectionHandler.getConnectionID(
|
||||||
|
organizationId,
|
||||||
|
RegistriesConnectionKey,
|
||||||
|
{ filter: { snapshotId: snapshotId || null } }
|
||||||
|
);
|
||||||
const registries: NonconformityRegistry[] = registriesData?.nonconformityRegistries?.edges?.map((edge) => edge.node) ?? [];
|
const registries: NonconformityRegistry[] = registriesData?.nonconformityRegistries?.edges?.map((edge) => edge.node) ?? [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
{isSnapshotMode && (
|
||||||
|
<SnapshotBanner snapshotId={snapshotId!} />
|
||||||
|
)}
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title={__("Nonconformity Registries")}
|
title={__("Nonconformity Registries")}
|
||||||
description={__(
|
description={__(
|
||||||
"Manage your organization's non conformity registries."
|
"Manage your organization's non conformity registries."
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
{!isSnapshotMode && (
|
||||||
<CreateNonconformityRegistryDialog organizationId={organizationId} connection={connectionId}>
|
<CreateNonconformityRegistryDialog organizationId={organizationId} connection={connectionId}>
|
||||||
<Button icon={IconPlusLarge}>{__("Add nonconformity registry")}</Button>
|
<Button icon={IconPlusLarge}>{__("Add nonconformity registry")}</Button>
|
||||||
</CreateNonconformityRegistryDialog>
|
</CreateNonconformityRegistryDialog>
|
||||||
|
)}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
{registries.length === 0 ? (
|
{registries.length === 0 ? (
|
||||||
@@ -150,7 +168,7 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
|
|||||||
<Th>{__("Audit")}</Th>
|
<Th>{__("Audit")}</Th>
|
||||||
<Th>{__("Owner")}</Th>
|
<Th>{__("Owner")}</Th>
|
||||||
<Th>{__("Due Date")}</Th>
|
<Th>{__("Due Date")}</Th>
|
||||||
<Th>{__("Actions")}</Th>
|
{!isSnapshotMode && (<Th>{__("Actions")}</Th>)}
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
@@ -159,6 +177,8 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
|
|||||||
key={registry.id}
|
key={registry.id}
|
||||||
registry={registry}
|
registry={registry}
|
||||||
connectionId={connectionId}
|
connectionId={connectionId}
|
||||||
|
isSnapshotMode={isSnapshotMode}
|
||||||
|
snapshotId={snapshotId}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Tbody>
|
</Tbody>
|
||||||
@@ -186,9 +206,13 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
|
|||||||
function RegistryRow({
|
function RegistryRow({
|
||||||
registry,
|
registry,
|
||||||
connectionId,
|
connectionId,
|
||||||
|
isSnapshotMode,
|
||||||
|
snapshotId,
|
||||||
}: {
|
}: {
|
||||||
registry: NonconformityRegistry;
|
registry: NonconformityRegistry;
|
||||||
connectionId: string;
|
connectionId: string;
|
||||||
|
isSnapshotMode: boolean;
|
||||||
|
snapshotId?: string;
|
||||||
}) {
|
}) {
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
@@ -199,6 +223,10 @@ function RegistryRow({
|
|||||||
return new Date(dateString).toLocaleDateString();
|
return new Date(dateString).toLocaleDateString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const registryDetailUrl = isSnapshotMode
|
||||||
|
? `/organizations/${organizationId}/snapshots/${snapshotId}/nonconformity-registries/${registry.id}`
|
||||||
|
: `/organizations/${organizationId}/nonconformity-registries/${registry.id}`;
|
||||||
|
|
||||||
const handleDeleteRegistry = (registry: NonconformityRegistry) => {
|
const handleDeleteRegistry = (registry: NonconformityRegistry) => {
|
||||||
if (!connectionId) return;
|
if (!connectionId) return;
|
||||||
|
|
||||||
@@ -225,7 +253,7 @@ function RegistryRow({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr to={`/organizations/${organizationId}/nonconformity-registries/${registry.id}`}>
|
<Tr to={registryDetailUrl}>
|
||||||
<Td>
|
<Td>
|
||||||
<span className="font-mono text-sm">{registry.referenceId}</span>
|
<span className="font-mono text-sm">{registry.referenceId}</span>
|
||||||
</Td>
|
</Td>
|
||||||
@@ -257,7 +285,7 @@ function RegistryRow({
|
|||||||
<span className="text-txt-tertiary">{__("No due date")}</span>
|
<span className="text-txt-tertiary">{__("No due date")}</span>
|
||||||
)}
|
)}
|
||||||
</Td>
|
</Td>
|
||||||
<Td noLink width={50} className="text-end">
|
{!isSnapshotMode && (<Td noLink width={50} className="text-end">
|
||||||
<ActionDropdown>
|
<ActionDropdown>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
icon={IconTrashCan}
|
icon={IconTrashCan}
|
||||||
@@ -268,6 +296,7 @@ function RegistryRow({
|
|||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
</ActionDropdown>
|
</ActionDropdown>
|
||||||
</Td>
|
</Td>
|
||||||
|
)}
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import {
|
|||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||||
import { ControlledField } from "/components/form/ControlledField";
|
import { ControlledField } from "/components/form/ControlledField";
|
||||||
|
import { SnapshotBanner } from "/components/SnapshotBanner";
|
||||||
|
import { useParams } from "react-router";
|
||||||
import { PeopleSelectField } from "/components/form/PeopleSelectField";
|
import { PeopleSelectField } from "/components/form/PeopleSelectField";
|
||||||
import { AuditSelectField } from "/components/form/AuditSelectField";
|
import { AuditSelectField } from "/components/form/AuditSelectField";
|
||||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||||
@@ -58,10 +60,16 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
const registry = data.node;
|
const registry = data.node;
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
|
const { snapshotId } = useParams<{ snapshotId?: string }>();
|
||||||
|
const isSnapshotMode = Boolean(snapshotId);
|
||||||
|
|
||||||
const deleteRegistry = useDeleteNonconformityRegistry(
|
const deleteRegistry = useDeleteNonconformityRegistry(
|
||||||
{ id: registry.id!, referenceId: registry.referenceId! },
|
{ id: registry.id!, referenceId: registry.referenceId! },
|
||||||
ConnectionHandler.getConnectionID(organizationId, RegistriesConnectionKey)
|
ConnectionHandler.getConnectionID(
|
||||||
|
organizationId,
|
||||||
|
RegistriesConnectionKey,
|
||||||
|
{ filter: { snapshotId: snapshotId || null } }
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
const { control, formState, handleSubmit, register, reset } = useFormWithSchema(
|
const { control, formState, handleSubmit, register, reset } = useFormWithSchema(
|
||||||
@@ -119,13 +127,20 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
|
|
||||||
const statusOptions = getNonconformityRegistryStatusOptions(__);
|
const statusOptions = getNonconformityRegistryStatusOptions(__);
|
||||||
|
|
||||||
|
const breadcrumbNonconformityRegistriesUrl = isSnapshotMode
|
||||||
|
? `/organizations/${organizationId}/snapshots/${snapshotId}/nonconformity-registries`
|
||||||
|
: `/organizations/${organizationId}/nonconformity-registries`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
{isSnapshotMode && (
|
||||||
|
<SnapshotBanner snapshotId={snapshotId!} />
|
||||||
|
)}
|
||||||
<Breadcrumb
|
<Breadcrumb
|
||||||
items={[
|
items={[
|
||||||
{
|
{
|
||||||
label: __("Nonconformity Registries"),
|
label: __("Nonconformity Registries"),
|
||||||
to: `/organizations/${organizationId}/nonconformity-registries`,
|
to: breadcrumbNonconformityRegistriesUrl,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: registry.referenceId || __("Unknown Nonconformity Registry"),
|
label: registry.referenceId || __("Unknown Nonconformity Registry"),
|
||||||
@@ -142,6 +157,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{getStatusLabel(registry.status || "OPEN")}
|
{getStatusLabel(registry.status || "OPEN")}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
{!isSnapshotMode && (
|
||||||
<ActionDropdown variant="secondary">
|
<ActionDropdown variant="secondary">
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
variant="danger"
|
variant="danger"
|
||||||
@@ -151,6 +167,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{__("Delete")}
|
{__("Delete")}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
</ActionDropdown>
|
</ActionDropdown>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="max-w-4xl">
|
<div className="max-w-4xl">
|
||||||
@@ -164,6 +181,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
<Input
|
<Input
|
||||||
{...register("referenceId")}
|
{...register("referenceId")}
|
||||||
placeholder={__("Enter reference ID")}
|
placeholder={__("Enter reference ID")}
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
@@ -174,6 +192,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
label={__("Audit")}
|
label={__("Audit")}
|
||||||
error={formState.errors.auditId?.message}
|
error={formState.errors.auditId?.message}
|
||||||
required
|
required
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field label={__("Description")}>
|
<Field label={__("Description")}>
|
||||||
@@ -181,6 +200,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{...register("description")}
|
{...register("description")}
|
||||||
placeholder={__("Enter description")}
|
placeholder={__("Enter description")}
|
||||||
rows={3}
|
rows={3}
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
@@ -191,6 +211,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
type="select"
|
type="select"
|
||||||
label={__("Status")}
|
label={__("Status")}
|
||||||
required
|
required
|
||||||
|
disabled={isSnapshotMode}
|
||||||
>
|
>
|
||||||
{statusOptions.map((option) => (
|
{statusOptions.map((option) => (
|
||||||
<Option key={option.value} value={option.value}>
|
<Option key={option.value} value={option.value}>
|
||||||
@@ -206,16 +227,17 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
label={__("Owner")}
|
label={__("Owner")}
|
||||||
error={formState.errors.ownerId?.message}
|
error={formState.errors.ownerId?.message}
|
||||||
required
|
required
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<Field label={__("Date Identified")}>
|
<Field label={__("Date Identified")}>
|
||||||
<Input {...register("dateIdentified")} type="date" />
|
<Input {...register("dateIdentified")} type="date" disabled={isSnapshotMode} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<Field label={__("Due Date")}>
|
<Field label={__("Due Date")}>
|
||||||
<Input {...register("dueDate")} type="date" />
|
<Input {...register("dueDate")} type="date" disabled={isSnapshotMode} />
|
||||||
</Field>
|
</Field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -228,6 +250,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{...register("rootCause")}
|
{...register("rootCause")}
|
||||||
placeholder={__("Enter root cause")}
|
placeholder={__("Enter root cause")}
|
||||||
rows={3}
|
rows={3}
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
@@ -236,6 +259,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{...register("correctiveAction")}
|
{...register("correctiveAction")}
|
||||||
placeholder={__("Enter corrective action")}
|
placeholder={__("Enter corrective action")}
|
||||||
rows={3}
|
rows={3}
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
@@ -244,11 +268,12 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
|
|||||||
{...register("effectivenessCheck")}
|
{...register("effectivenessCheck")}
|
||||||
placeholder={__("Enter effectiveness check details")}
|
placeholder={__("Enter effectiveness check details")}
|
||||||
rows={3}
|
rows={3}
|
||||||
|
disabled={isSnapshotMode}
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end">
|
||||||
{formState.isDirty && (
|
{formState.isDirty && !isSnapshotMode && (
|
||||||
<Button type="submit" disabled={formState.isSubmitting}>
|
<Button type="submit" disabled={formState.isSubmitting}>
|
||||||
{formState.isSubmitting ? __("Updating...") : __("Update")}
|
{formState.isSubmitting ? __("Updating...") : __("Update")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<b883180c6334c3e1c4f7bd44785a0033>>
|
* @generated SignedSource<<fede190bc1e89813ce1034cf93d5ae95>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -86,6 +86,11 @@ return {
|
|||||||
"defaultValue": 10,
|
"defaultValue": 10,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "first"
|
"name": "first"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "snapshotId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kind": "Fragment",
|
"kind": "Fragment",
|
||||||
@@ -122,7 +127,19 @@ return {
|
|||||||
(v1/*: any*/),
|
(v1/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": "nonconformityRegistries",
|
"alias": "nonconformityRegistries",
|
||||||
"args": null,
|
"args": [
|
||||||
|
{
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "snapshotId",
|
||||||
|
"variableName": "snapshotId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "ObjectValue",
|
||||||
|
"name": "filter"
|
||||||
|
}
|
||||||
|
],
|
||||||
"concreteType": "NonconformityRegistryConnection",
|
"concreteType": "NonconformityRegistryConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "__RegistriesPage_nonconformityRegistries_connection",
|
"name": "__RegistriesPage_nonconformityRegistries_connection",
|
||||||
@@ -333,6 +350,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "34c06ec98cb50738cf479e6bd7cdc83e";
|
(node as any).hash = "ebde2010138ec4b17adb214f7bd24ac6";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<2720ef53c549871eb0b99b8a0214367d>>
|
* @generated SignedSource<<1ea20f794eca2a8b357e64ccf3ac6deb>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
|
|||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type NonconformityRegistriesPageQuery$variables = {
|
export type NonconformityRegistriesPageQuery$variables = {
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
|
snapshotId?: string | null | undefined;
|
||||||
};
|
};
|
||||||
export type NonconformityRegistriesPageQuery$data = {
|
export type NonconformityRegistriesPageQuery$data = {
|
||||||
readonly node: {
|
readonly node: {
|
||||||
@@ -29,6 +30,11 @@ var v0 = [
|
|||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "organizationId"
|
"name": "organizationId"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "snapshotId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v1 = [
|
v1 = [
|
||||||
@@ -38,28 +44,40 @@ v1 = [
|
|||||||
"variableName": "organizationId"
|
"variableName": "organizationId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v2 = {
|
v2 = [
|
||||||
|
{
|
||||||
|
"kind": "Variable",
|
||||||
|
"name": "snapshotId",
|
||||||
|
"variableName": "snapshotId"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
v3 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "__typename",
|
"name": "__typename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v3 = {
|
v4 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v4 = [
|
v5 = [
|
||||||
|
{
|
||||||
|
"fields": (v2/*: any*/),
|
||||||
|
"kind": "ObjectValue",
|
||||||
|
"name": "filter"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"kind": "Literal",
|
"kind": "Literal",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
"value": 10
|
"value": 10
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v5 = {
|
v6 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
@@ -85,7 +103,7 @@ return {
|
|||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"args": null,
|
"args": (v2/*: any*/),
|
||||||
"kind": "FragmentSpread",
|
"kind": "FragmentSpread",
|
||||||
"name": "NonconformityRegistriesPageFragment"
|
"name": "NonconformityRegistriesPageFragment"
|
||||||
}
|
}
|
||||||
@@ -114,14 +132,14 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
|
||||||
(v3/*: any*/),
|
(v3/*: any*/),
|
||||||
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"concreteType": "NonconformityRegistryConnection",
|
"concreteType": "NonconformityRegistryConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "nonconformityRegistries",
|
"name": "nonconformityRegistries",
|
||||||
@@ -150,7 +168,7 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -215,8 +233,8 @@ return {
|
|||||||
"name": "audit",
|
"name": "audit",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v6/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -225,8 +243,8 @@ return {
|
|||||||
"name": "framework",
|
"name": "framework",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/)
|
(v6/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -241,7 +259,7 @@ return {
|
|||||||
"name": "owner",
|
"name": "owner",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v4/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -266,7 +284,7 @@ return {
|
|||||||
"name": "updatedAt",
|
"name": "updatedAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v2/*: any*/)
|
(v3/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
@@ -318,12 +336,14 @@ return {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"storageKey": "nonconformityRegistries(first:10)"
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v4/*: any*/),
|
"args": (v5/*: any*/),
|
||||||
"filters": null,
|
"filters": [
|
||||||
|
"filter"
|
||||||
|
],
|
||||||
"handle": "connection",
|
"handle": "connection",
|
||||||
"key": "RegistriesPage_nonconformityRegistries",
|
"key": "RegistriesPage_nonconformityRegistries",
|
||||||
"kind": "LinkedHandle",
|
"kind": "LinkedHandle",
|
||||||
@@ -339,16 +359,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "93352a54352d7b4fd8d2367bbe43e288",
|
"cacheID": "f2ec31e8e8ec0d13aeac353f53044f97",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "NonconformityRegistriesPageQuery",
|
"name": "NonconformityRegistriesPageQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query NonconformityRegistriesPageQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...NonconformityRegistriesPageFragment\n }\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment on Organization {\n id\n nonconformityRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
"text": "query NonconformityRegistriesPageQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...NonconformityRegistriesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment_3iomuz on Organization {\n id\n nonconformityRegistries(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "22c4716894e332336d2e165756a2d021";
|
(node as any).hash = "180821c7fad7b6071d78444e1eac0742";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<9c75b7a7e17dd904d30ab786c40015d4>>
|
* @generated SignedSource<<c584903b5c82a59b575deef3f54379d9>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -14,6 +14,7 @@ export type NonconformityRegistriesPageRefetchQuery$variables = {
|
|||||||
after?: any | null | undefined;
|
after?: any | null | undefined;
|
||||||
first?: number | null | undefined;
|
first?: number | null | undefined;
|
||||||
id: string;
|
id: string;
|
||||||
|
snapshotId?: string | null | undefined;
|
||||||
};
|
};
|
||||||
export type NonconformityRegistriesPageRefetchQuery$data = {
|
export type NonconformityRegistriesPageRefetchQuery$data = {
|
||||||
readonly node: {
|
readonly node: {
|
||||||
@@ -26,57 +27,74 @@ export type NonconformityRegistriesPageRefetchQuery = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const node: ConcreteRequest = (function(){
|
const node: ConcreteRequest = (function(){
|
||||||
var v0 = [
|
var v0 = {
|
||||||
{
|
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "after"
|
"name": "after"
|
||||||
},
|
},
|
||||||
{
|
v1 = {
|
||||||
"defaultValue": 10,
|
"defaultValue": 10,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "first"
|
"name": "first"
|
||||||
},
|
},
|
||||||
{
|
v2 = {
|
||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
"kind": "LocalArgument",
|
"kind": "LocalArgument",
|
||||||
"name": "id"
|
"name": "id"
|
||||||
}
|
},
|
||||||
],
|
v3 = {
|
||||||
v1 = [
|
"defaultValue": null,
|
||||||
|
"kind": "LocalArgument",
|
||||||
|
"name": "snapshotId"
|
||||||
|
},
|
||||||
|
v4 = [
|
||||||
{
|
{
|
||||||
"kind": "Variable",
|
"kind": "Variable",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"variableName": "id"
|
"variableName": "id"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
v2 = [
|
v5 = {
|
||||||
{
|
|
||||||
"kind": "Variable",
|
"kind": "Variable",
|
||||||
"name": "after",
|
"name": "after",
|
||||||
"variableName": "after"
|
"variableName": "after"
|
||||||
},
|
},
|
||||||
{
|
v6 = {
|
||||||
"kind": "Variable",
|
"kind": "Variable",
|
||||||
"name": "first",
|
"name": "first",
|
||||||
"variableName": "first"
|
"variableName": "first"
|
||||||
}
|
},
|
||||||
],
|
v7 = {
|
||||||
v3 = {
|
"kind": "Variable",
|
||||||
|
"name": "snapshotId",
|
||||||
|
"variableName": "snapshotId"
|
||||||
|
},
|
||||||
|
v8 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "__typename",
|
"name": "__typename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v4 = {
|
v9 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v5 = {
|
v10 = [
|
||||||
|
(v5/*: any*/),
|
||||||
|
{
|
||||||
|
"fields": [
|
||||||
|
(v7/*: any*/)
|
||||||
|
],
|
||||||
|
"kind": "ObjectValue",
|
||||||
|
"name": "filter"
|
||||||
|
},
|
||||||
|
(v6/*: any*/)
|
||||||
|
],
|
||||||
|
v11 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
@@ -85,21 +103,30 @@ v5 = {
|
|||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
"fragment": {
|
"fragment": {
|
||||||
"argumentDefinitions": (v0/*: any*/),
|
"argumentDefinitions": [
|
||||||
|
(v0/*: any*/),
|
||||||
|
(v1/*: any*/),
|
||||||
|
(v2/*: any*/),
|
||||||
|
(v3/*: any*/)
|
||||||
|
],
|
||||||
"kind": "Fragment",
|
"kind": "Fragment",
|
||||||
"metadata": null,
|
"metadata": null,
|
||||||
"name": "NonconformityRegistriesPageRefetchQuery",
|
"name": "NonconformityRegistriesPageRefetchQuery",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v1/*: any*/),
|
"args": (v4/*: any*/),
|
||||||
"concreteType": null,
|
"concreteType": null,
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"args": (v2/*: any*/),
|
"args": [
|
||||||
|
(v5/*: any*/),
|
||||||
|
(v6/*: any*/),
|
||||||
|
(v7/*: any*/)
|
||||||
|
],
|
||||||
"kind": "FragmentSpread",
|
"kind": "FragmentSpread",
|
||||||
"name": "NonconformityRegistriesPageFragment"
|
"name": "NonconformityRegistriesPageFragment"
|
||||||
}
|
}
|
||||||
@@ -112,26 +139,31 @@ return {
|
|||||||
},
|
},
|
||||||
"kind": "Request",
|
"kind": "Request",
|
||||||
"operation": {
|
"operation": {
|
||||||
"argumentDefinitions": (v0/*: any*/),
|
"argumentDefinitions": [
|
||||||
|
(v0/*: any*/),
|
||||||
|
(v1/*: any*/),
|
||||||
|
(v3/*: any*/),
|
||||||
|
(v2/*: any*/)
|
||||||
|
],
|
||||||
"kind": "Operation",
|
"kind": "Operation",
|
||||||
"name": "NonconformityRegistriesPageRefetchQuery",
|
"name": "NonconformityRegistriesPageRefetchQuery",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v1/*: any*/),
|
"args": (v4/*: any*/),
|
||||||
"concreteType": null,
|
"concreteType": null,
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v3/*: any*/),
|
(v8/*: any*/),
|
||||||
(v4/*: any*/),
|
(v9/*: any*/),
|
||||||
{
|
{
|
||||||
"kind": "InlineFragment",
|
"kind": "InlineFragment",
|
||||||
"selections": [
|
"selections": [
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v2/*: any*/),
|
"args": (v10/*: any*/),
|
||||||
"concreteType": "NonconformityRegistryConnection",
|
"concreteType": "NonconformityRegistryConnection",
|
||||||
"kind": "LinkedField",
|
"kind": "LinkedField",
|
||||||
"name": "nonconformityRegistries",
|
"name": "nonconformityRegistries",
|
||||||
@@ -160,7 +192,7 @@ return {
|
|||||||
"name": "node",
|
"name": "node",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v4/*: any*/),
|
(v9/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -225,8 +257,8 @@ return {
|
|||||||
"name": "audit",
|
"name": "audit",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v4/*: any*/),
|
(v9/*: any*/),
|
||||||
(v5/*: any*/),
|
(v11/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -235,8 +267,8 @@ return {
|
|||||||
"name": "framework",
|
"name": "framework",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v4/*: any*/),
|
(v9/*: any*/),
|
||||||
(v5/*: any*/)
|
(v11/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -251,7 +283,7 @@ return {
|
|||||||
"name": "owner",
|
"name": "owner",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v4/*: any*/),
|
(v9/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -276,7 +308,7 @@ return {
|
|||||||
"name": "updatedAt",
|
"name": "updatedAt",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v3/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
@@ -332,8 +364,10 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": (v2/*: any*/),
|
"args": (v10/*: any*/),
|
||||||
"filters": null,
|
"filters": [
|
||||||
|
"filter"
|
||||||
|
],
|
||||||
"handle": "connection",
|
"handle": "connection",
|
||||||
"key": "RegistriesPage_nonconformityRegistries",
|
"key": "RegistriesPage_nonconformityRegistries",
|
||||||
"kind": "LinkedHandle",
|
"kind": "LinkedHandle",
|
||||||
@@ -349,16 +383,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "c8a903834590297e238ea54aeea0dfbe",
|
"cacheID": "50e5771b4ff22e23d81c31bf7c92e619",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "NonconformityRegistriesPageRefetchQuery",
|
"name": "NonconformityRegistriesPageRefetchQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query NonconformityRegistriesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...NonconformityRegistriesPageFragment_2HEEH6\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment_2HEEH6 on Organization {\n id\n nonconformityRegistries(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
"text": "query NonconformityRegistriesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $snapshotId: ID = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...NonconformityRegistriesPageFragment_35e0S5\n id\n }\n}\n\nfragment NonconformityRegistriesPageFragment_35e0S5 on Organization {\n id\n nonconformityRegistries(first: $first, after: $after, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n referenceId\n description\n status\n dateIdentified\n dueDate\n rootCause\n correctiveAction\n effectivenessCheck\n audit {\n id\n name\n framework {\n id\n name\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "34c06ec98cb50738cf479e6bd7cdc83e";
|
(node as any).hash = "ebde2010138ec4b17adb214f7bd24ac6";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<05658205222e432a115cecc9c8f34d05>>
|
* @generated SignedSource<<515e309ba0b61b3cacd37ebd567203c4>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type SnapshotsPageFragment$data = {
|
export type SnapshotsPageFragment$data = {
|
||||||
readonly snapshots: {
|
readonly snapshots: {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const snapshotCreateMutation = graphql`
|
|||||||
const snapshotSchema = z.object({
|
const snapshotSchema = z.object({
|
||||||
name: z.string().min(2, { message: "Name is required" }),
|
name: z.string().min(2, { message: "Name is required" }),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
type: z.enum(["DATA"]),
|
type: z.enum(["DATA", "NONCONFORMITY_REGISTRIES"]),
|
||||||
});
|
});
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<22c84eaaec91c3555b99f0e067bea54f>>
|
* @generated SignedSource<<c6327f17cac8275a6ac5847f0b172905>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NON_CONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
export type SnapshotsType = "ASSETS" | "COMPLIANCE_REGISTRIES" | "DATA" | "NONCONFORMITY_REGISTRIES" | "RISKS" | "VENDORS";
|
||||||
export type CreateSnapshotInput = {
|
export type CreateSnapshotInput = {
|
||||||
description?: string | null | undefined;
|
description?: string | null | undefined;
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
@@ -9,8 +9,23 @@ export const nonconformityRegistryRoutes= [
|
|||||||
{
|
{
|
||||||
path: "nonconformity-registries",
|
path: "nonconformity-registries",
|
||||||
fallback: PageSkeleton,
|
fallback: PageSkeleton,
|
||||||
queryLoader: ({ organizationId }: { organizationId: string }) =>
|
queryLoader: (params: Record<string, string>) =>
|
||||||
loadQuery(relayEnvironment, nonconformityRegistriesQuery, { organizationId }),
|
loadQuery(relayEnvironment, nonconformityRegistriesQuery, {
|
||||||
|
organizationId: params.organizationId,
|
||||||
|
snapshotId: null
|
||||||
|
}),
|
||||||
|
Component: lazy(
|
||||||
|
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistriesPage")
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "snapshots/:snapshotId/nonconformity-registries",
|
||||||
|
fallback: PageSkeleton,
|
||||||
|
queryLoader: (params: Record<string, string>) =>
|
||||||
|
loadQuery(relayEnvironment, nonconformityRegistriesQuery, {
|
||||||
|
organizationId: params.organizationId,
|
||||||
|
snapshotId: params.snapshotId
|
||||||
|
}),
|
||||||
Component: lazy(
|
Component: lazy(
|
||||||
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistriesPage")
|
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistriesPage")
|
||||||
),
|
),
|
||||||
@@ -26,4 +41,15 @@ export const nonconformityRegistryRoutes= [
|
|||||||
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistryDetailsPage")
|
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistryDetailsPage")
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "snapshots/:snapshotId/nonconformity-registries/:registryId",
|
||||||
|
fallback: PageSkeleton,
|
||||||
|
queryLoader: (params: Record<string, string>) =>
|
||||||
|
loadQuery(relayEnvironment, nonconformityRegistryNodeQuery, {
|
||||||
|
nonconformityRegistryId: params.registryId
|
||||||
|
}),
|
||||||
|
Component: lazy(
|
||||||
|
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistryDetailsPage")
|
||||||
|
),
|
||||||
|
},
|
||||||
] satisfies AppRoute[];
|
] satisfies AppRoute[];
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ type Translator = (s: string) => string;
|
|||||||
|
|
||||||
export const snapshotTypes = [
|
export const snapshotTypes = [
|
||||||
"DATA",
|
"DATA",
|
||||||
|
"NONCONFORMITY_REGISTRIES",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export function getSnapshotTypeLabel(__: Translator, type: string | null | undefined) {
|
export function getSnapshotTypeLabel(__: Translator, type: string | null | undefined) {
|
||||||
@@ -18,7 +19,7 @@ export function getSnapshotTypeLabel(__: Translator, type: string | null | undef
|
|||||||
return __("Assets");
|
return __("Assets");
|
||||||
case "DATA":
|
case "DATA":
|
||||||
return __("Data");
|
return __("Data");
|
||||||
case "NON_CONFORMITY_REGISTRIES":
|
case "NONCONFORMITY_REGISTRIES":
|
||||||
return __("Nonconformity Registries");
|
return __("Nonconformity Registries");
|
||||||
case "COMPLIANCE_REGISTRIES":
|
case "COMPLIANCE_REGISTRIES":
|
||||||
return __("Compliance Registries");
|
return __("Compliance Registries");
|
||||||
@@ -31,6 +32,8 @@ export function getSnapshotTypeUrlPath(type?: string): string {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case "DATA":
|
case "DATA":
|
||||||
return "/data";
|
return "/data";
|
||||||
|
case "NONCONFORMITY_REGISTRIES":
|
||||||
|
return "/nonconformity-registries";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
15
pkg/coredata/migrations/20250828T142256Z.sql
Normal file
15
pkg/coredata/migrations/20250828T142256Z.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
ALTER TABLE nonconformity_registries ADD COLUMN snapshot_id TEXT;
|
||||||
|
ALTER TABLE nonconformity_registries ADD COLUMN source_id TEXT;
|
||||||
|
|
||||||
|
ALTER TABLE nonconformity_registries DROP CONSTRAINT IF EXISTS nonconformity_registries_audit_id_fkey;
|
||||||
|
ALTER TABLE nonconformity_registries ADD CONSTRAINT nonconformity_registries_audit_id_fkey
|
||||||
|
FOREIGN KEY (audit_id) REFERENCES audits(id) ON UPDATE CASCADE ON DELETE RESTRICT;
|
||||||
|
|
||||||
|
ALTER TABLE nonconformity_registries ADD CONSTRAINT nonconformity_registries_snapshot_id_fkey
|
||||||
|
FOREIGN KEY (snapshot_id)
|
||||||
|
REFERENCES snapshots(id)
|
||||||
|
ON UPDATE CASCADE
|
||||||
|
ON DELETE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE nonconformity_registries ADD CONSTRAINT nonconformity_registries_source_id_snapshot_id_key
|
||||||
|
UNIQUE (source_id, snapshot_id);
|
||||||
@@ -30,6 +30,8 @@ type (
|
|||||||
NonconformityRegistry struct {
|
NonconformityRegistry struct {
|
||||||
ID gid.GID `db:"id"`
|
ID gid.GID `db:"id"`
|
||||||
OrganizationID gid.GID `db:"organization_id"`
|
OrganizationID gid.GID `db:"organization_id"`
|
||||||
|
SnapshotID *gid.GID `db:"snapshot_id"`
|
||||||
|
SourceID *gid.GID `db:"source_id"`
|
||||||
ReferenceID string `db:"reference_id"`
|
ReferenceID string `db:"reference_id"`
|
||||||
Description *string `db:"description"`
|
Description *string `db:"description"`
|
||||||
AuditID gid.GID `db:"audit_id"`
|
AuditID gid.GID `db:"audit_id"`
|
||||||
@@ -74,6 +76,8 @@ func (nr *NonconformityRegistry) LoadByID(
|
|||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
organization_id,
|
organization_id,
|
||||||
|
snapshot_id,
|
||||||
|
source_id,
|
||||||
reference_id,
|
reference_id,
|
||||||
description,
|
description,
|
||||||
audit_id,
|
audit_id,
|
||||||
@@ -119,6 +123,7 @@ func (nrs *NonconformityRegistries) CountByOrganizationID(
|
|||||||
conn pg.Conn,
|
conn pg.Conn,
|
||||||
scope Scoper,
|
scope Scoper,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
|
filter *NonconformityRegistryFilter,
|
||||||
) (int, error) {
|
) (int, error) {
|
||||||
q := `
|
q := `
|
||||||
SELECT
|
SELECT
|
||||||
@@ -128,12 +133,14 @@ FROM
|
|||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
AND organization_id = @organization_id
|
AND organization_id = @organization_id
|
||||||
|
AND %s
|
||||||
`
|
`
|
||||||
|
|
||||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
|
||||||
|
|
||||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||||
maps.Copy(args, scope.SQLArguments())
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
maps.Copy(args, filter.SQLArguments())
|
||||||
|
|
||||||
row := conn.QueryRow(ctx, q, args)
|
row := conn.QueryRow(ctx, q, args)
|
||||||
|
|
||||||
@@ -152,11 +159,14 @@ func (nrs *NonconformityRegistries) LoadByOrganizationID(
|
|||||||
scope Scoper,
|
scope Scoper,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
cursor *page.Cursor[NonconformityRegistryOrderField],
|
cursor *page.Cursor[NonconformityRegistryOrderField],
|
||||||
|
filter *NonconformityRegistryFilter,
|
||||||
) error {
|
) error {
|
||||||
q := `
|
q := `
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
organization_id,
|
organization_id,
|
||||||
|
snapshot_id,
|
||||||
|
source_id,
|
||||||
reference_id,
|
reference_id,
|
||||||
description,
|
description,
|
||||||
audit_id,
|
audit_id,
|
||||||
@@ -175,12 +185,14 @@ WHERE
|
|||||||
%s
|
%s
|
||||||
AND organization_id = @organization_id
|
AND organization_id = @organization_id
|
||||||
AND %s
|
AND %s
|
||||||
|
AND %s
|
||||||
`
|
`
|
||||||
|
|
||||||
q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment())
|
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment(), cursor.SQLFragment())
|
||||||
|
|
||||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||||
maps.Copy(args, scope.SQLArguments())
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
maps.Copy(args, filter.SQLArguments())
|
||||||
maps.Copy(args, cursor.SQLArguments())
|
maps.Copy(args, cursor.SQLArguments())
|
||||||
|
|
||||||
rows, err := conn.Query(ctx, q, args)
|
rows, err := conn.Query(ctx, q, args)
|
||||||
@@ -287,6 +299,7 @@ SET
|
|||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
AND id = @id
|
AND id = @id
|
||||||
|
AND snapshot_id IS NULL
|
||||||
`
|
`
|
||||||
|
|
||||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||||
@@ -324,7 +337,7 @@ func (nr *NonconformityRegistry) Delete(
|
|||||||
DELETE FROM nonconformity_registries
|
DELETE FROM nonconformity_registries
|
||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
AND id = @id
|
AND id = @id AND snapshot_id IS NULL
|
||||||
`
|
`
|
||||||
|
|
||||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||||
@@ -339,3 +352,64 @@ WHERE
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (nrs NonconformityRegistries) Snapshot(ctx context.Context, conn pg.Conn, scope Scoper, organizationID, snapshotID gid.GID) error {
|
||||||
|
query := `
|
||||||
|
INSERT INTO nonconformity_registries (
|
||||||
|
id,
|
||||||
|
tenant_id,
|
||||||
|
snapshot_id,
|
||||||
|
source_id,
|
||||||
|
organization_id,
|
||||||
|
reference_id,
|
||||||
|
description,
|
||||||
|
audit_id,
|
||||||
|
date_identified,
|
||||||
|
root_cause,
|
||||||
|
corrective_action,
|
||||||
|
owner_id,
|
||||||
|
due_date,
|
||||||
|
status,
|
||||||
|
effectiveness_check,
|
||||||
|
created_at,
|
||||||
|
updated_at
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
generate_gid(decode_base64_unpadded(@tenant_id), @nonconformity_registry_entity_type),
|
||||||
|
@tenant_id,
|
||||||
|
@snapshot_id,
|
||||||
|
r.id,
|
||||||
|
r.organization_id,
|
||||||
|
r.reference_id,
|
||||||
|
r.description,
|
||||||
|
r.audit_id,
|
||||||
|
r.date_identified,
|
||||||
|
r.root_cause,
|
||||||
|
r.corrective_action,
|
||||||
|
r.owner_id,
|
||||||
|
r.due_date,
|
||||||
|
r.status,
|
||||||
|
r.effectiveness_check,
|
||||||
|
r.created_at,
|
||||||
|
r.updated_at
|
||||||
|
FROM nonconformity_registries r
|
||||||
|
WHERE %s AND r.organization_id = @organization_id AND r.snapshot_id IS NULL
|
||||||
|
`
|
||||||
|
|
||||||
|
query = fmt.Sprintf(query, scope.SQLFragment())
|
||||||
|
|
||||||
|
args := pgx.StrictNamedArgs{
|
||||||
|
"tenant_id": scope.GetTenantID(),
|
||||||
|
"snapshot_id": snapshotID,
|
||||||
|
"organization_id": organizationID,
|
||||||
|
"nonconformity_registry_entity_type": NonconformityRegistryEntityType,
|
||||||
|
}
|
||||||
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
|
||||||
|
_, err := conn.Exec(ctx, query, args)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot insert data snapshots: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|||||||
60
pkg/coredata/nonconformity_registry_filter.go
Normal file
60
pkg/coredata/nonconformity_registry_filter.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice appear in all copies.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
// PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
package coredata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/getprobo/probo/pkg/gid"
|
||||||
|
"github.com/jackc/pgx/v5"
|
||||||
|
)
|
||||||
|
|
||||||
|
type (
|
||||||
|
NonconformityRegistryFilter struct {
|
||||||
|
snapshotID **gid.GID
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewNonconformityRegistryFilter() *NonconformityRegistryFilter {
|
||||||
|
return &NonconformityRegistryFilter{
|
||||||
|
snapshotID: nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewNonconformityRegistryFilterBySnapshotID(snapshotID **gid.GID) *NonconformityRegistryFilter {
|
||||||
|
return &NonconformityRegistryFilter{
|
||||||
|
snapshotID: snapshotID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *NonconformityRegistryFilter) SQLArguments() pgx.NamedArgs {
|
||||||
|
args := pgx.NamedArgs{}
|
||||||
|
|
||||||
|
if f.snapshotID != nil && *f.snapshotID != nil {
|
||||||
|
args["filter_snapshot_id"] = **f.snapshotID
|
||||||
|
}
|
||||||
|
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *NonconformityRegistryFilter) SQLFragment() string {
|
||||||
|
if f.snapshotID == nil {
|
||||||
|
return "TRUE"
|
||||||
|
}
|
||||||
|
|
||||||
|
if *f.snapshotID == nil {
|
||||||
|
return "snapshot_id IS NULL"
|
||||||
|
} else {
|
||||||
|
return "snapshot_id = @filter_snapshot_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,8 @@ func GetSnapshottable(snapshotType SnapshotsType) (Snapshottable, error) {
|
|||||||
switch snapshotType {
|
switch snapshotType {
|
||||||
case SnapshotsTypeData:
|
case SnapshotsTypeData:
|
||||||
return Data{}, nil
|
return Data{}, nil
|
||||||
|
case SnapshotsTypeNonConformityRegistries:
|
||||||
|
return NonconformityRegistries{}, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported snapshot type: %s", snapshotType)
|
return nil, fmt.Errorf("unsupported snapshot type: %s", snapshotType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,13 +221,14 @@ func (s NonconformityRegistryService) ListForOrganizationID(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
cursor *page.Cursor[coredata.NonconformityRegistryOrderField],
|
cursor *page.Cursor[coredata.NonconformityRegistryOrderField],
|
||||||
|
filter *coredata.NonconformityRegistryFilter,
|
||||||
) (*page.Page[*coredata.NonconformityRegistry, coredata.NonconformityRegistryOrderField], error) {
|
) (*page.Page[*coredata.NonconformityRegistry, coredata.NonconformityRegistryOrderField], error) {
|
||||||
var registries coredata.NonconformityRegistries
|
var registries coredata.NonconformityRegistries
|
||||||
|
|
||||||
err := s.svc.pg.WithConn(
|
err := s.svc.pg.WithConn(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
err := registries.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor)
|
err := registries.LoadByOrganizationID(ctx, conn, s.svc.scope, organizationID, cursor, filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot load nonconformity registries: %w", err)
|
return fmt.Errorf("cannot load nonconformity registries: %w", err)
|
||||||
}
|
}
|
||||||
@@ -246,6 +247,7 @@ func (s NonconformityRegistryService) ListForOrganizationID(
|
|||||||
func (s NonconformityRegistryService) CountForOrganizationID(
|
func (s NonconformityRegistryService) CountForOrganizationID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
|
filter *coredata.NonconformityRegistryFilter,
|
||||||
) (int, error) {
|
) (int, error) {
|
||||||
var count int
|
var count int
|
||||||
|
|
||||||
@@ -253,7 +255,7 @@ func (s NonconformityRegistryService) CountForOrganizationID(
|
|||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) (err error) {
|
func(conn pg.Conn) (err error) {
|
||||||
registries := coredata.NonconformityRegistries{}
|
registries := coredata.NonconformityRegistries{}
|
||||||
count, err = registries.CountByOrganizationID(ctx, conn, s.svc.scope, organizationID)
|
count, err = registries.CountByOrganizationID(ctx, conn, s.svc.scope, organizationID, filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot count nonconformity registries: %w", err)
|
return fmt.Errorf("cannot count nonconformity registries: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1106,6 +1106,10 @@ input DatumFilter {
|
|||||||
snapshotId: ID
|
snapshotId: ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input NonconformityRegistryFilter {
|
||||||
|
snapshotId: ID
|
||||||
|
}
|
||||||
|
|
||||||
# Core Types
|
# Core Types
|
||||||
type TrustCenter implements Node {
|
type TrustCenter implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
@@ -1245,6 +1249,7 @@ type Organization implements Node {
|
|||||||
last: Int
|
last: Int
|
||||||
before: CursorKey
|
before: CursorKey
|
||||||
orderBy: NonconformityRegistryOrder
|
orderBy: NonconformityRegistryOrder
|
||||||
|
filter: NonconformityRegistryFilter
|
||||||
): NonconformityRegistryConnection! @goField(forceResolver: true)
|
): NonconformityRegistryConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
complianceRegistries(
|
complianceRegistries(
|
||||||
|
|||||||
@@ -881,7 +881,7 @@ type ComplexityRoot struct {
|
|||||||
LogoURL func(childComplexity int) int
|
LogoURL func(childComplexity int) int
|
||||||
Measures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy, filter *types.MeasureFilter) int
|
Measures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy, filter *types.MeasureFilter) int
|
||||||
Name func(childComplexity int) int
|
Name func(childComplexity int) int
|
||||||
NonconformityRegistries func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy) int
|
NonconformityRegistries func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy, filter *types.NonconformityRegistryFilter) int
|
||||||
Peoples func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PeopleOrderBy, filter *types.PeopleFilter) int
|
Peoples func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.PeopleOrderBy, filter *types.PeopleFilter) int
|
||||||
ProcessingActivityRegistries func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ProcessingActivityRegistryOrderBy) int
|
ProcessingActivityRegistries func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ProcessingActivityRegistryOrderBy) int
|
||||||
Risks func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.RiskOrderBy, filter *types.RiskFilter) int
|
Risks func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.RiskOrderBy, filter *types.RiskFilter) int
|
||||||
@@ -1666,7 +1666,7 @@ type OrganizationResolver interface {
|
|||||||
Assets(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AssetOrderBy) (*types.AssetConnection, error)
|
Assets(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AssetOrderBy) (*types.AssetConnection, error)
|
||||||
Data(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DatumOrderBy, filter *types.DatumFilter) (*types.DatumConnection, error)
|
Data(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DatumOrderBy, filter *types.DatumFilter) (*types.DatumConnection, error)
|
||||||
Audits(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AuditOrderBy) (*types.AuditConnection, error)
|
Audits(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AuditOrderBy) (*types.AuditConnection, error)
|
||||||
NonconformityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy) (*types.NonconformityRegistryConnection, error)
|
NonconformityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy, filter *types.NonconformityRegistryFilter) (*types.NonconformityRegistryConnection, error)
|
||||||
ComplianceRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ComplianceRegistryOrderBy) (*types.ComplianceRegistryConnection, error)
|
ComplianceRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ComplianceRegistryOrderBy) (*types.ComplianceRegistryConnection, error)
|
||||||
ContinualImprovementRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ContinualImprovementRegistriesOrderBy) (*types.ContinualImprovementRegistryConnection, error)
|
ContinualImprovementRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ContinualImprovementRegistriesOrderBy) (*types.ContinualImprovementRegistryConnection, error)
|
||||||
ProcessingActivityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ProcessingActivityRegistryOrderBy) (*types.ProcessingActivityRegistryConnection, error)
|
ProcessingActivityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ProcessingActivityRegistryOrderBy) (*types.ProcessingActivityRegistryConnection, error)
|
||||||
@@ -5478,7 +5478,7 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.Organization.NonconformityRegistries(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.NonconformityRegistryOrderBy)), true
|
return e.complexity.Organization.NonconformityRegistries(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.NonconformityRegistryOrderBy), args["filter"].(*types.NonconformityRegistryFilter)), true
|
||||||
|
|
||||||
case "Organization.peoples":
|
case "Organization.peoples":
|
||||||
if e.complexity.Organization.Peoples == nil {
|
if e.complexity.Organization.Peoples == nil {
|
||||||
@@ -7724,6 +7724,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler {
|
|||||||
ec.unmarshalInputInviteUserInput,
|
ec.unmarshalInputInviteUserInput,
|
||||||
ec.unmarshalInputMeasureFilter,
|
ec.unmarshalInputMeasureFilter,
|
||||||
ec.unmarshalInputMeasureOrder,
|
ec.unmarshalInputMeasureOrder,
|
||||||
|
ec.unmarshalInputNonconformityRegistryFilter,
|
||||||
ec.unmarshalInputNonconformityRegistryOrder,
|
ec.unmarshalInputNonconformityRegistryOrder,
|
||||||
ec.unmarshalInputOrganizationFilter,
|
ec.unmarshalInputOrganizationFilter,
|
||||||
ec.unmarshalInputOrganizationOrder,
|
ec.unmarshalInputOrganizationOrder,
|
||||||
@@ -8981,6 +8982,10 @@ input DatumFilter {
|
|||||||
snapshotId: ID
|
snapshotId: ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input NonconformityRegistryFilter {
|
||||||
|
snapshotId: ID
|
||||||
|
}
|
||||||
|
|
||||||
# Core Types
|
# Core Types
|
||||||
type TrustCenter implements Node {
|
type TrustCenter implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
@@ -9120,6 +9125,7 @@ type Organization implements Node {
|
|||||||
last: Int
|
last: Int
|
||||||
before: CursorKey
|
before: CursorKey
|
||||||
orderBy: NonconformityRegistryOrder
|
orderBy: NonconformityRegistryOrder
|
||||||
|
filter: NonconformityRegistryFilter
|
||||||
): NonconformityRegistryConnection! @goField(forceResolver: true)
|
): NonconformityRegistryConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
complianceRegistries(
|
complianceRegistries(
|
||||||
@@ -16801,6 +16807,11 @@ func (ec *executionContext) field_Organization_nonconformityRegistries_args(ctx
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
args["orderBy"] = arg4
|
args["orderBy"] = arg4
|
||||||
|
arg5, err := ec.field_Organization_nonconformityRegistries_argsFilter(ctx, rawArgs)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
args["filter"] = arg5
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
func (ec *executionContext) field_Organization_nonconformityRegistries_argsFirst(
|
func (ec *executionContext) field_Organization_nonconformityRegistries_argsFirst(
|
||||||
@@ -16868,6 +16879,19 @@ func (ec *executionContext) field_Organization_nonconformityRegistries_argsOrder
|
|||||||
return zeroVal, nil
|
return zeroVal, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) field_Organization_nonconformityRegistries_argsFilter(
|
||||||
|
ctx context.Context,
|
||||||
|
rawArgs map[string]any,
|
||||||
|
) (*types.NonconformityRegistryFilter, error) {
|
||||||
|
ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("filter"))
|
||||||
|
if tmp, ok := rawArgs["filter"]; ok {
|
||||||
|
return ec.unmarshalONonconformityRegistryFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐNonconformityRegistryFilter(ctx, tmp)
|
||||||
|
}
|
||||||
|
|
||||||
|
var zeroVal *types.NonconformityRegistryFilter
|
||||||
|
return zeroVal, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) field_Organization_peoples_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
func (ec *executionContext) field_Organization_peoples_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
|
||||||
var err error
|
var err error
|
||||||
args := map[string]any{}
|
args := map[string]any{}
|
||||||
@@ -41754,7 +41778,7 @@ func (ec *executionContext) _Organization_nonconformityRegistries(ctx context.Co
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return ec.resolvers.Organization().NonconformityRegistries(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.NonconformityRegistryOrderBy))
|
return ec.resolvers.Organization().NonconformityRegistries(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.NonconformityRegistryOrderBy), fc.Args["filter"].(*types.NonconformityRegistryFilter))
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@@ -62770,6 +62794,33 @@ func (ec *executionContext) unmarshalInputMeasureOrder(ctx context.Context, obj
|
|||||||
return it, nil
|
return it, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalInputNonconformityRegistryFilter(ctx context.Context, obj any) (types.NonconformityRegistryFilter, error) {
|
||||||
|
var it types.NonconformityRegistryFilter
|
||||||
|
asMap := map[string]any{}
|
||||||
|
for k, v := range obj.(map[string]any) {
|
||||||
|
asMap[k] = v
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldsInOrder := [...]string{"snapshotId"}
|
||||||
|
for _, k := range fieldsInOrder {
|
||||||
|
v, ok := asMap[k]
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
switch k {
|
||||||
|
case "snapshotId":
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("snapshotId"))
|
||||||
|
data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
|
it.SnapshotID = data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return it, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalInputNonconformityRegistryOrder(ctx context.Context, obj any) (types.NonconformityRegistryOrderBy, error) {
|
func (ec *executionContext) unmarshalInputNonconformityRegistryOrder(ctx context.Context, obj any) (types.NonconformityRegistryOrderBy, error) {
|
||||||
var it types.NonconformityRegistryOrderBy
|
var it types.NonconformityRegistryOrderBy
|
||||||
asMap := map[string]any{}
|
asMap := map[string]any{}
|
||||||
@@ -87078,6 +87129,14 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalONonconformityRegistryFilter2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐNonconformityRegistryFilter(ctx context.Context, v any) (*types.NonconformityRegistryFilter, error) {
|
||||||
|
if v == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
res, err := ec.unmarshalInputNonconformityRegistryFilter(ctx, v)
|
||||||
|
return &res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalONonconformityRegistryOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐNonconformityRegistryOrderBy(ctx context.Context, v any) (*types.NonconformityRegistryOrderBy, error) {
|
func (ec *executionContext) unmarshalONonconformityRegistryOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐNonconformityRegistryOrderBy(ctx context.Context, v any) (*types.NonconformityRegistryOrderBy, error) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ type (
|
|||||||
|
|
||||||
Resolver any
|
Resolver any
|
||||||
ParentID gid.GID
|
ParentID gid.GID
|
||||||
|
Filter *NonconformityRegistryFilter
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ func NewNonconformityRegistryConnection(
|
|||||||
p *page.Page[*coredata.NonconformityRegistry, coredata.NonconformityRegistryOrderField],
|
p *page.Page[*coredata.NonconformityRegistry, coredata.NonconformityRegistryOrderField],
|
||||||
parentType any,
|
parentType any,
|
||||||
parentID gid.GID,
|
parentID gid.GID,
|
||||||
|
filter *NonconformityRegistryFilter,
|
||||||
) *NonconformityRegistryConnection {
|
) *NonconformityRegistryConnection {
|
||||||
edges := make([]*NonconformityRegistryEdge, len(p.Data))
|
edges := make([]*NonconformityRegistryEdge, len(p.Data))
|
||||||
for i, registry := range p.Data {
|
for i, registry := range p.Data {
|
||||||
@@ -49,6 +51,7 @@ func NewNonconformityRegistryConnection(
|
|||||||
|
|
||||||
Resolver: parentType,
|
Resolver: parentType,
|
||||||
ParentID: parentID,
|
ParentID: parentID,
|
||||||
|
Filter: filter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1138,6 +1138,10 @@ type NonconformityRegistryEdge struct {
|
|||||||
Node *NonconformityRegistry `json:"node"`
|
Node *NonconformityRegistry `json:"node"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NonconformityRegistryFilter struct {
|
||||||
|
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type Organization struct {
|
type Organization struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|||||||
@@ -3313,7 +3313,12 @@ func (r *nonconformityRegistryConnectionResolver) TotalCount(ctx context.Context
|
|||||||
|
|
||||||
switch obj.Resolver.(type) {
|
switch obj.Resolver.(type) {
|
||||||
case *organizationResolver:
|
case *organizationResolver:
|
||||||
count, err := prb.NonconformityRegistries.CountForOrganizationID(ctx, obj.ParentID)
|
nonconformityRegistryFilter := coredata.NewNonconformityRegistryFilterBySnapshotID(nil)
|
||||||
|
if obj.Filter != nil {
|
||||||
|
nonconformityRegistryFilter = coredata.NewNonconformityRegistryFilterBySnapshotID(&obj.Filter.SnapshotID)
|
||||||
|
}
|
||||||
|
|
||||||
|
count, err := prb.NonconformityRegistries.CountForOrganizationID(ctx, obj.ParentID, nonconformityRegistryFilter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("cannot count nonconformity registries: %w", err)
|
return 0, fmt.Errorf("cannot count nonconformity registries: %w", err)
|
||||||
}
|
}
|
||||||
@@ -3686,7 +3691,7 @@ func (r *organizationResolver) Audits(ctx context.Context, obj *types.Organizati
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NonconformityRegistries is the resolver for the nonconformityRegistries field.
|
// NonconformityRegistries is the resolver for the nonconformityRegistries field.
|
||||||
func (r *organizationResolver) NonconformityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy) (*types.NonconformityRegistryConnection, error) {
|
func (r *organizationResolver) NonconformityRegistries(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.NonconformityRegistryOrderBy, filter *types.NonconformityRegistryFilter) (*types.NonconformityRegistryConnection, error) {
|
||||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||||
|
|
||||||
pageOrderBy := page.OrderBy[coredata.NonconformityRegistryOrderField]{
|
pageOrderBy := page.OrderBy[coredata.NonconformityRegistryOrderField]{
|
||||||
@@ -3702,12 +3707,17 @@ func (r *organizationResolver) NonconformityRegistries(ctx context.Context, obj
|
|||||||
|
|
||||||
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
|
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
|
||||||
|
|
||||||
page, err := prb.NonconformityRegistries.ListForOrganizationID(ctx, obj.ID, cursor)
|
nonconformityRegistryFilter := coredata.NewNonconformityRegistryFilterBySnapshotID(nil)
|
||||||
|
if filter != nil {
|
||||||
|
nonconformityRegistryFilter = coredata.NewNonconformityRegistryFilterBySnapshotID(&filter.SnapshotID)
|
||||||
|
}
|
||||||
|
|
||||||
|
page, err := prb.NonconformityRegistries.ListForOrganizationID(ctx, obj.ID, cursor, nonconformityRegistryFilter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot list organization nonconformity registries: %w", err)
|
return nil, fmt.Errorf("cannot list organization nonconformity registries: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return types.NewNonconformityRegistryConnection(page, r, obj.ID), nil
|
return types.NewNonconformityRegistryConnection(page, r, obj.ID, filter), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComplianceRegistries is the resolver for the complianceRegistries field.
|
// ComplianceRegistries is the resolver for the complianceRegistries field.
|
||||||
|
|||||||
Reference in New Issue
Block a user