Add noncompliance snapshots

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-28 17:22:20 +02:00
parent a0af20ea95
commit 7d80a7d5f4
27 changed files with 574 additions and 166 deletions

View File

@@ -37,7 +37,7 @@ export function SnapshotBanner({ snapshotId }: Props) {
<span className="font-medium text-warning-800">{__("Snapshot")} {snapshot.name}</span>
</div>
<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>
</div>
</div>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<e9fde8de02cc2e3ec97ce64b67818bfe>>
* @generated SignedSource<<32724438ee7e1d53f9c53938a8129e4b>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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";
export type LinkedSnapshotsCardFragment$data = {
readonly createdAt: any;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<b68d2b7e020579736ca058b633352dee>>
* @generated SignedSource<<f6c8c318141054ceb118dfdb145a756d>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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";
export type LinkedSnapshotsDialogFragment$data = {
readonly id: string;

View File

@@ -8,10 +8,10 @@ import { useMutationWithToasts } from "../useMutationWithToasts";
export const RegistriesConnectionKey = "RegistriesPage_nonconformityRegistries";
export const nonconformityRegistriesQuery = graphql`
query NonconformityRegistryGraphListQuery($organizationId: ID!) {
query NonconformityRegistryGraphListQuery($organizationId: ID!, $snapshotId: ID) {
node(id: $organizationId) {
... on Organization {
...NonconformityRegistriesPageFragment
...NonconformityRegistriesPageFragment @arguments(snapshotId: $snapshotId)
}
}
}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<a6972659c0399779d3d646dc4057bc57>>
* @generated SignedSource<<b306072db6c1956ba956e52443ebf866>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type NonconformityRegistryGraphListQuery$variables = {
organizationId: string;
snapshotId?: string | null | undefined;
};
export type NonconformityRegistryGraphListQuery$data = {
readonly node: {
@@ -29,6 +30,11 @@ var v0 = [
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
v1 = [
@@ -38,28 +44,40 @@ v1 = [
"variableName": "organizationId"
}
],
v2 = {
v2 = [
{
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
}
],
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v3 = {
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v4 = [
v5 = [
{
"fields": (v2/*: any*/),
"kind": "ObjectValue",
"name": "filter"
},
{
"kind": "Literal",
"name": "first",
"value": 10
}
],
v5 = {
v6 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -85,7 +103,7 @@ return {
"kind": "InlineFragment",
"selections": [
{
"args": null,
"args": (v2/*: any*/),
"kind": "FragmentSpread",
"name": "NonconformityRegistriesPageFragment"
}
@@ -114,14 +132,14 @@ return {
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v4/*: any*/),
"args": (v5/*: any*/),
"concreteType": "NonconformityRegistryConnection",
"kind": "LinkedField",
"name": "nonconformityRegistries",
@@ -150,7 +168,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -215,8 +233,8 @@ return {
"name": "audit",
"plural": false,
"selections": [
(v3/*: any*/),
(v5/*: any*/),
(v4/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": null,
@@ -225,8 +243,8 @@ return {
"name": "framework",
"plural": false,
"selections": [
(v3/*: any*/),
(v5/*: any*/)
(v4/*: any*/),
(v6/*: any*/)
],
"storageKey": null
}
@@ -241,7 +259,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -266,7 +284,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v2/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
@@ -318,12 +336,14 @@ return {
]
}
],
"storageKey": "nonconformityRegistries(first:10)"
"storageKey": null
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"args": (v5/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "RegistriesPage_nonconformityRegistries",
"kind": "LinkedHandle",
@@ -339,16 +359,16 @@ return {
]
},
"params": {
"cacheID": "2196012e8a68c64e7d479a2b85021ffd",
"cacheID": "727537500ac037fec1a9ffd04a5c651f",
"id": null,
"metadata": {},
"name": "NonconformityRegistryGraphListQuery",
"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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<459d0a122659971be9b24c79f47691e7>>
* @generated SignedSource<<9f17487d2517912ef9f93b0026eaa555>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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 = {
description?: string | null | undefined;
name: string;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5bcc9f9b743d01fc99fd749b970dccd3>>
* @generated SignedSource<<a490e7800ce4b387ced38d07b3e42bca>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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 = {
snapshotId: string;
};

View File

@@ -29,6 +29,8 @@ import { useOrganizationId } from "/hooks/useOrganizationId";
import { CreateNonconformityRegistryDialog } from "./dialogs/CreateNonconformityRegistryDialog";
import { deleteNonconformityRegistryMutation, RegistriesConnectionKey } from "../../../hooks/graph/NonconformityRegistryGraph";
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 {
NonconformityRegistriesPageFragment$key,
@@ -47,10 +49,15 @@ const nonconformityRegistriesPageFragment = graphql`
@argumentDefinitions(
first: { type: "Int", defaultValue: 10 }
after: { type: "CursorKey" }
snapshotId: { type: "ID", defaultValue: null }
) {
id
nonconformityRegistries(first: $first, after: $after)
@connection(key: "RegistriesPage_nonconformityRegistries") {
nonconformityRegistries(
first: $first
after: $after
filter: { snapshotId: $snapshotId }
)
@connection(key: "RegistriesPage_nonconformityRegistries", filters: ["filter"]) {
__id
totalCount
edges {
@@ -91,15 +98,17 @@ const nonconformityRegistriesPageFragment = graphql`
export default function NonconformityRegistriesPage({ queryRef }: NonconformityRegistriesPageProps) {
const { __ } = useTranslate();
const organizationId = useOrganizationId();
const { snapshotId } = useParams<{ snapshotId?: string }>();
const isSnapshotMode = Boolean(snapshotId);
usePageTitle(__("Nonconformity Registries"));
const organization = usePreloadedQuery(
graphql`
query NonconformityRegistriesPageQuery($organizationId: ID!) {
query NonconformityRegistriesPageQuery($organizationId: ID!, $snapshotId: ID) {
node(id: $organizationId) {
... on Organization {
...NonconformityRegistriesPageFragment
...NonconformityRegistriesPageFragment @arguments(snapshotId: $snapshotId)
}
}
}
@@ -112,20 +121,29 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
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) ?? [];
return (
<div className="space-y-6">
{isSnapshotMode && (
<SnapshotBanner snapshotId={snapshotId!} />
)}
<PageHeader
title={__("Nonconformity Registries")}
description={__(
"Manage your organization's non conformity registries."
)}
>
<CreateNonconformityRegistryDialog organizationId={organizationId} connection={connectionId}>
<Button icon={IconPlusLarge}>{__("Add nonconformity registry")}</Button>
</CreateNonconformityRegistryDialog>
{!isSnapshotMode && (
<CreateNonconformityRegistryDialog organizationId={organizationId} connection={connectionId}>
<Button icon={IconPlusLarge}>{__("Add nonconformity registry")}</Button>
</CreateNonconformityRegistryDialog>
)}
</PageHeader>
{registries.length === 0 ? (
@@ -150,7 +168,7 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
<Th>{__("Audit")}</Th>
<Th>{__("Owner")}</Th>
<Th>{__("Due Date")}</Th>
<Th>{__("Actions")}</Th>
{!isSnapshotMode && (<Th>{__("Actions")}</Th>)}
</Tr>
</Thead>
<Tbody>
@@ -159,6 +177,8 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
key={registry.id}
registry={registry}
connectionId={connectionId}
isSnapshotMode={isSnapshotMode}
snapshotId={snapshotId}
/>
))}
</Tbody>
@@ -186,9 +206,13 @@ export default function NonconformityRegistriesPage({ queryRef }: NonconformityR
function RegistryRow({
registry,
connectionId,
isSnapshotMode,
snapshotId,
}: {
registry: NonconformityRegistry;
connectionId: string;
isSnapshotMode: boolean;
snapshotId?: string;
}) {
const organizationId = useOrganizationId();
const { __ } = useTranslate();
@@ -199,6 +223,10 @@ function RegistryRow({
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) => {
if (!connectionId) return;
@@ -225,7 +253,7 @@ function RegistryRow({
};
return (
<Tr to={`/organizations/${organizationId}/nonconformity-registries/${registry.id}`}>
<Tr to={registryDetailUrl}>
<Td>
<span className="font-mono text-sm">{registry.referenceId}</span>
</Td>
@@ -257,17 +285,18 @@ function RegistryRow({
<span className="text-txt-tertiary">{__("No due date")}</span>
)}
</Td>
<Td noLink width={50} className="text-end">
<ActionDropdown>
<DropdownItem
icon={IconTrashCan}
variant="danger"
onSelect={() => handleDeleteRegistry(registry)}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
</Td>
{!isSnapshotMode && (<Td noLink width={50} className="text-end">
<ActionDropdown>
<DropdownItem
icon={IconTrashCan}
variant="danger"
onSelect={() => handleDeleteRegistry(registry)}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
</Td>
)}
</Tr>
);
}

View File

@@ -26,6 +26,8 @@ import {
import { useTranslate } from "@probo/i18n";
import { useOrganizationId } from "/hooks/useOrganizationId";
import { ControlledField } from "/components/form/ControlledField";
import { SnapshotBanner } from "/components/SnapshotBanner";
import { useParams } from "react-router";
import { PeopleSelectField } from "/components/form/PeopleSelectField";
import { AuditSelectField } from "/components/form/AuditSelectField";
import { useFormWithSchema } from "/hooks/useFormWithSchema";
@@ -58,10 +60,16 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
const registry = data.node;
const { __ } = useTranslate();
const organizationId = useOrganizationId();
const { snapshotId } = useParams<{ snapshotId?: string }>();
const isSnapshotMode = Boolean(snapshotId);
const deleteRegistry = useDeleteNonconformityRegistry(
{ 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(
@@ -119,13 +127,20 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
const statusOptions = getNonconformityRegistryStatusOptions(__);
const breadcrumbNonconformityRegistriesUrl = isSnapshotMode
? `/organizations/${organizationId}/snapshots/${snapshotId}/nonconformity-registries`
: `/organizations/${organizationId}/nonconformity-registries`;
return (
<div className="space-y-6">
{isSnapshotMode && (
<SnapshotBanner snapshotId={snapshotId!} />
)}
<Breadcrumb
items={[
{
label: __("Nonconformity Registries"),
to: `/organizations/${organizationId}/nonconformity-registries`,
to: breadcrumbNonconformityRegistriesUrl,
},
{
label: registry.referenceId || __("Unknown Nonconformity Registry"),
@@ -142,15 +157,17 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
{getStatusLabel(registry.status || "OPEN")}
</Badge>
</div>
<ActionDropdown variant="secondary">
<DropdownItem
variant="danger"
icon={IconTrashCan}
onClick={deleteRegistry}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
{!isSnapshotMode && (
<ActionDropdown variant="secondary">
<DropdownItem
variant="danger"
icon={IconTrashCan}
onClick={deleteRegistry}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
)}
</div>
<div className="max-w-4xl">
@@ -164,6 +181,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
<Input
{...register("referenceId")}
placeholder={__("Enter reference ID")}
disabled={isSnapshotMode}
/>
</Field>
@@ -174,6 +192,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
label={__("Audit")}
error={formState.errors.auditId?.message}
required
disabled={isSnapshotMode}
/>
<Field label={__("Description")}>
@@ -181,6 +200,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
{...register("description")}
placeholder={__("Enter description")}
rows={3}
disabled={isSnapshotMode}
/>
</Field>
@@ -191,6 +211,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
type="select"
label={__("Status")}
required
disabled={isSnapshotMode}
>
{statusOptions.map((option) => (
<Option key={option.value} value={option.value}>
@@ -206,16 +227,17 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
label={__("Owner")}
error={formState.errors.ownerId?.message}
required
disabled={isSnapshotMode}
/>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Field label={__("Date Identified")}>
<Input {...register("dateIdentified")} type="date" />
<Input {...register("dateIdentified")} type="date" disabled={isSnapshotMode} />
</Field>
<Field label={__("Due Date")}>
<Input {...register("dueDate")} type="date" />
<Input {...register("dueDate")} type="date" disabled={isSnapshotMode} />
</Field>
</div>
@@ -228,6 +250,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
{...register("rootCause")}
placeholder={__("Enter root cause")}
rows={3}
disabled={isSnapshotMode}
/>
</Field>
@@ -236,6 +259,7 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
{...register("correctiveAction")}
placeholder={__("Enter corrective action")}
rows={3}
disabled={isSnapshotMode}
/>
</Field>
@@ -244,11 +268,12 @@ export default function NonconformityRegistryDetailsPage(props: Props) {
{...register("effectivenessCheck")}
placeholder={__("Enter effectiveness check details")}
rows={3}
disabled={isSnapshotMode}
/>
</Field>
<div className="flex justify-end">
{formState.isDirty && (
{formState.isDirty && !isSnapshotMode && (
<Button type="submit" disabled={formState.isSubmitting}>
{formState.isSubmitting ? __("Updating...") : __("Update")}
</Button>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<b883180c6334c3e1c4f7bd44785a0033>>
* @generated SignedSource<<fede190bc1e89813ce1034cf93d5ae95>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -86,6 +86,11 @@ return {
"defaultValue": 10,
"kind": "LocalArgument",
"name": "first"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
"kind": "Fragment",
@@ -122,7 +127,19 @@ return {
(v1/*: any*/),
{
"alias": "nonconformityRegistries",
"args": null,
"args": [
{
"fields": [
{
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
}
],
"kind": "ObjectValue",
"name": "filter"
}
],
"concreteType": "NonconformityRegistryConnection",
"kind": "LinkedField",
"name": "__RegistriesPage_nonconformityRegistries_connection",
@@ -333,6 +350,6 @@ return {
};
})();
(node as any).hash = "34c06ec98cb50738cf479e6bd7cdc83e";
(node as any).hash = "ebde2010138ec4b17adb214f7bd24ac6";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<2720ef53c549871eb0b99b8a0214367d>>
* @generated SignedSource<<1ea20f794eca2a8b357e64ccf3ac6deb>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type NonconformityRegistriesPageQuery$variables = {
organizationId: string;
snapshotId?: string | null | undefined;
};
export type NonconformityRegistriesPageQuery$data = {
readonly node: {
@@ -29,6 +30,11 @@ var v0 = [
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
v1 = [
@@ -38,28 +44,40 @@ v1 = [
"variableName": "organizationId"
}
],
v2 = {
v2 = [
{
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
}
],
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v3 = {
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v4 = [
v5 = [
{
"fields": (v2/*: any*/),
"kind": "ObjectValue",
"name": "filter"
},
{
"kind": "Literal",
"name": "first",
"value": 10
}
],
v5 = {
v6 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -85,7 +103,7 @@ return {
"kind": "InlineFragment",
"selections": [
{
"args": null,
"args": (v2/*: any*/),
"kind": "FragmentSpread",
"name": "NonconformityRegistriesPageFragment"
}
@@ -114,14 +132,14 @@ return {
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/),
(v4/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v4/*: any*/),
"args": (v5/*: any*/),
"concreteType": "NonconformityRegistryConnection",
"kind": "LinkedField",
"name": "nonconformityRegistries",
@@ -150,7 +168,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -215,8 +233,8 @@ return {
"name": "audit",
"plural": false,
"selections": [
(v3/*: any*/),
(v5/*: any*/),
(v4/*: any*/),
(v6/*: any*/),
{
"alias": null,
"args": null,
@@ -225,8 +243,8 @@ return {
"name": "framework",
"plural": false,
"selections": [
(v3/*: any*/),
(v5/*: any*/)
(v4/*: any*/),
(v6/*: any*/)
],
"storageKey": null
}
@@ -241,7 +259,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -266,7 +284,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v2/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
@@ -318,12 +336,14 @@ return {
]
}
],
"storageKey": "nonconformityRegistries(first:10)"
"storageKey": null
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"args": (v5/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "RegistriesPage_nonconformityRegistries",
"kind": "LinkedHandle",
@@ -339,16 +359,16 @@ return {
]
},
"params": {
"cacheID": "93352a54352d7b4fd8d2367bbe43e288",
"cacheID": "f2ec31e8e8ec0d13aeac353f53044f97",
"id": null,
"metadata": {},
"name": "NonconformityRegistriesPageQuery",
"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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<9c75b7a7e17dd904d30ab786c40015d4>>
* @generated SignedSource<<c584903b5c82a59b575deef3f54379d9>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -14,6 +14,7 @@ export type NonconformityRegistriesPageRefetchQuery$variables = {
after?: any | null | undefined;
first?: number | null | undefined;
id: string;
snapshotId?: string | null | undefined;
};
export type NonconformityRegistriesPageRefetchQuery$data = {
readonly node: {
@@ -26,57 +27,74 @@ export type NonconformityRegistriesPageRefetchQuery = {
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "after"
},
{
"defaultValue": 10,
"kind": "LocalArgument",
"name": "first"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "id"
}
],
v1 = [
var v0 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "after"
},
v1 = {
"defaultValue": 10,
"kind": "LocalArgument",
"name": "first"
},
v2 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "id"
},
v3 = {
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
},
v4 = [
{
"kind": "Variable",
"name": "id",
"variableName": "id"
}
],
v2 = [
{
"kind": "Variable",
"name": "after",
"variableName": "after"
},
{
"kind": "Variable",
"name": "first",
"variableName": "first"
}
],
v3 = {
v5 = {
"kind": "Variable",
"name": "after",
"variableName": "after"
},
v6 = {
"kind": "Variable",
"name": "first",
"variableName": "first"
},
v7 = {
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
},
v8 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v4 = {
v9 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v5 = {
v10 = [
(v5/*: any*/),
{
"fields": [
(v7/*: any*/)
],
"kind": "ObjectValue",
"name": "filter"
},
(v6/*: any*/)
],
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -85,21 +103,30 @@ v5 = {
};
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v2/*: any*/),
(v3/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "NonconformityRegistriesPageRefetchQuery",
"selections": [
{
"alias": null,
"args": (v1/*: any*/),
"args": (v4/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"args": (v2/*: any*/),
"args": [
(v5/*: any*/),
(v6/*: any*/),
(v7/*: any*/)
],
"kind": "FragmentSpread",
"name": "NonconformityRegistriesPageFragment"
}
@@ -112,26 +139,31 @@ return {
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v3/*: any*/),
(v2/*: any*/)
],
"kind": "Operation",
"name": "NonconformityRegistriesPageRefetchQuery",
"selections": [
{
"alias": null,
"args": (v1/*: any*/),
"args": (v4/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
(v8/*: any*/),
(v9/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": (v2/*: any*/),
"args": (v10/*: any*/),
"concreteType": "NonconformityRegistryConnection",
"kind": "LinkedField",
"name": "nonconformityRegistries",
@@ -160,7 +192,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v4/*: any*/),
(v9/*: any*/),
{
"alias": null,
"args": null,
@@ -225,8 +257,8 @@ return {
"name": "audit",
"plural": false,
"selections": [
(v4/*: any*/),
(v5/*: any*/),
(v9/*: any*/),
(v11/*: any*/),
{
"alias": null,
"args": null,
@@ -235,8 +267,8 @@ return {
"name": "framework",
"plural": false,
"selections": [
(v4/*: any*/),
(v5/*: any*/)
(v9/*: any*/),
(v11/*: any*/)
],
"storageKey": null
}
@@ -251,7 +283,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v4/*: any*/),
(v9/*: any*/),
{
"alias": null,
"args": null,
@@ -276,7 +308,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v3/*: any*/)
(v8/*: any*/)
],
"storageKey": null
},
@@ -332,8 +364,10 @@ return {
},
{
"alias": null,
"args": (v2/*: any*/),
"filters": null,
"args": (v10/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "RegistriesPage_nonconformityRegistries",
"kind": "LinkedHandle",
@@ -349,16 +383,16 @@ return {
]
},
"params": {
"cacheID": "c8a903834590297e238ea54aeea0dfbe",
"cacheID": "50e5771b4ff22e23d81c31bf7c92e619",
"id": null,
"metadata": {},
"name": "NonconformityRegistriesPageRefetchQuery",
"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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<05658205222e432a115cecc9c8f34d05>>
* @generated SignedSource<<515e309ba0b61b3cacd37ebd567203c4>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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";
export type SnapshotsPageFragment$data = {
readonly snapshots: {

View File

@@ -42,7 +42,7 @@ const snapshotCreateMutation = graphql`
const snapshotSchema = z.object({
name: z.string().min(2, { message: "Name is required" }),
description: z.string().optional(),
type: z.enum(["DATA"]),
type: z.enum(["DATA", "NONCONFORMITY_REGISTRIES"]),
});
type Props = {

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<22c84eaaec91c3555b99f0e067bea54f>>
* @generated SignedSource<<c6327f17cac8275a6ac5847f0b172905>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
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 = {
description?: string | null | undefined;
name: string;

View File

@@ -9,8 +9,23 @@ export const nonconformityRegistryRoutes= [
{
path: "nonconformity-registries",
fallback: PageSkeleton,
queryLoader: ({ organizationId }: { organizationId: string }) =>
loadQuery(relayEnvironment, nonconformityRegistriesQuery, { organizationId }),
queryLoader: (params: Record<string, string>) =>
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(
() => import("/pages/organizations/nonconformityRegistries/NonconformityRegistriesPage")
),
@@ -26,4 +41,15 @@ export const nonconformityRegistryRoutes= [
() => 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[];