Add compliance registry snapshots

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-08-29 11:05:01 +02:00
parent 828895a436
commit 16c94c4cca
25 changed files with 781 additions and 199 deletions

View File

@@ -8,10 +8,10 @@ import { useMutationWithToasts } from "../useMutationWithToasts";
export const ComplianceRegistriesConnectionKey = "ComplianceRegistriesPage_complianceRegistries";
export const complianceRegistriesQuery = graphql`
query ComplianceRegistryGraphListQuery($organizationId: ID!) {
query ComplianceRegistryGraphListQuery($organizationId: ID!, $snapshotId: ID) {
node(id: $organizationId) {
... on Organization {
...ComplianceRegistriesPageFragment
...ComplianceRegistriesPageFragment @arguments(snapshotId: $snapshotId)
}
}
}
@@ -22,6 +22,8 @@ export const complianceRegistryNodeQuery = graphql`
node(id: $complianceRegistryId) {
... on ComplianceRegistry {
id
snapshotId
sourceId
referenceId
area
source

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<fa68dc3f1afe9ab6d98e189eff649e04>>
* @generated SignedSource<<41975a1dcc769268a6255ea703ff26fe>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type ComplianceRegistryGraphListQuery$variables = {
organizationId: string;
snapshotId?: string | null | undefined;
};
export type ComplianceRegistryGraphListQuery$data = {
readonly node: {
@@ -29,6 +30,11 @@ var v0 = [
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
v1 = [
@@ -38,21 +44,33 @@ 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",
@@ -78,7 +96,7 @@ return {
"kind": "InlineFragment",
"selections": [
{
"args": null,
"args": (v2/*: any*/),
"kind": "FragmentSpread",
"name": "ComplianceRegistriesPageFragment"
}
@@ -107,14 +125,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": "ComplianceRegistryConnection",
"kind": "LinkedField",
"name": "complianceRegistries",
@@ -143,7 +161,21 @@ return {
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "snapshotId",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "sourceId",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -215,7 +247,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -240,7 +272,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v2/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
@@ -292,12 +324,14 @@ return {
]
}
],
"storageKey": "complianceRegistries(first:10)"
"storageKey": null
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"args": (v5/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "ComplianceRegistriesPage_complianceRegistries",
"kind": "LinkedHandle",
@@ -313,16 +347,16 @@ return {
]
},
"params": {
"cacheID": "2852dc9732086326e7770650cbd00ad1",
"cacheID": "d578089841a93f60ae9ba5bc6e9175b0",
"id": null,
"metadata": {},
"name": "ComplianceRegistryGraphListQuery",
"operationKind": "query",
"text": "query ComplianceRegistryGraphListQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ComplianceRegistriesPageFragment\n }\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment on Organization {\n id\n complianceRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 ComplianceRegistryGraphListQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ComplianceRegistriesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment_3iomuz on Organization {\n id\n complianceRegistries(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n snapshotId\n sourceId\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 = "363434c78eb3e27ac52b6da13c7432a1";
(node as any).hash = "2c50dd58eb2d72e49bce300726f35a34";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f3d37c53737c5f0f3bd062eb2b682898>>
* @generated SignedSource<<ec60b0715df426d6819f03f6e1597fef>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -32,7 +32,9 @@ export type ComplianceRegistryGraphNodeQuery$data = {
readonly referenceId?: string;
readonly regulator?: string | null | undefined;
readonly requirement?: string | null | undefined;
readonly snapshotId?: string | null | undefined;
readonly source?: string | null | undefined;
readonly sourceId?: string | null | undefined;
readonly status?: ComplianceRegistryStatus;
readonly updatedAt?: any;
};
@@ -68,66 +70,80 @@ v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "referenceId",
"name": "snapshotId",
"storageKey": null
},
v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "area",
"name": "sourceId",
"storageKey": null
},
v5 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "source",
"name": "referenceId",
"storageKey": null
},
v6 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "requirement",
"name": "area",
"storageKey": null
},
v7 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "actionsToBeImplemented",
"name": "source",
"storageKey": null
},
v8 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "regulator",
"name": "requirement",
"storageKey": null
},
v9 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "lastReviewDate",
"name": "actionsToBeImplemented",
"storageKey": null
},
v10 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dueDate",
"name": "regulator",
"storageKey": null
},
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "status",
"name": "lastReviewDate",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dueDate",
"storageKey": null
},
v13 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "status",
"storageKey": null
},
v14 = {
"alias": null,
"args": null,
"concreteType": "People",
@@ -146,7 +162,7 @@ v12 = {
],
"storageKey": null
},
v13 = {
v15 = {
"alias": null,
"args": null,
"concreteType": "Organization",
@@ -165,14 +181,14 @@ v13 = {
],
"storageKey": null
},
v14 = {
v16 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "createdAt",
"storageKey": null
},
v15 = {
v17 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -210,7 +226,9 @@ return {
(v12/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v15/*: any*/)
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/)
],
"type": "ComplianceRegistry",
"abstractKey": null
@@ -259,7 +277,9 @@ return {
(v12/*: any*/),
(v13/*: any*/),
(v14/*: any*/),
(v15/*: any*/)
(v15/*: any*/),
(v16/*: any*/),
(v17/*: any*/)
],
"type": "ComplianceRegistry",
"abstractKey": null
@@ -270,16 +290,16 @@ return {
]
},
"params": {
"cacheID": "4b91258de0711b2821a26bef89b60b02",
"cacheID": "2c4649d3258530fd79420bc2ed8fd14a",
"id": null,
"metadata": {},
"name": "ComplianceRegistryGraphNodeQuery",
"operationKind": "query",
"text": "query ComplianceRegistryGraphNodeQuery(\n $complianceRegistryId: ID!\n) {\n node(id: $complianceRegistryId) {\n __typename\n ... on ComplianceRegistry {\n id\n referenceId\n area\n source\n requirement\n actionsToBeImplemented\n regulator\n lastReviewDate\n dueDate\n status\n owner {\n id\n fullName\n }\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
"text": "query ComplianceRegistryGraphNodeQuery(\n $complianceRegistryId: ID!\n) {\n node(id: $complianceRegistryId) {\n __typename\n ... on ComplianceRegistry {\n id\n snapshotId\n sourceId\n referenceId\n area\n source\n requirement\n actionsToBeImplemented\n regulator\n lastReviewDate\n dueDate\n status\n owner {\n id\n fullName\n }\n organization {\n id\n name\n }\n createdAt\n updatedAt\n }\n id\n }\n}\n"
}
};
})();
(node as any).hash = "1b3352776a5b514b7545111aeb780148";
(node as any).hash = "b290ce12f57b586e64bac227777bc294";
export default node;

View File

@@ -24,10 +24,12 @@ import {
useMutation,
type PreloadedQuery,
} from "react-relay";
import { useParams } from "react-router";
import { useOrganizationId } from "/hooks/useOrganizationId";
import { CreateComplianceRegistryDialog } from "./dialogs/CreateComplianceRegistryDialog";
import { deleteComplianceRegistryMutation } from "../../../hooks/graph/ComplianceRegistryGraph";
import { sprintf, promisifyMutation, getStatusVariant, getStatusLabel } from "@probo/helpers";
import { SnapshotBanner } from "/components/SnapshotBanner";
import type { ComplianceRegistriesPageQuery } from "./__generated__/ComplianceRegistriesPageQuery.graphql";
import type {
ComplianceRegistriesPageFragment$key,
@@ -46,15 +48,22 @@ const complianceRegistriesPageFragment = graphql`
@argumentDefinitions(
first: { type: "Int", defaultValue: 10 }
after: { type: "CursorKey" }
snapshotId: { type: "ID", defaultValue: null }
) {
id
complianceRegistries(first: $first, after: $after)
@connection(key: "ComplianceRegistriesPage_complianceRegistries") {
complianceRegistries(
first: $first
after: $after
filter: { snapshotId: $snapshotId }
)
@connection(key: "ComplianceRegistriesPage_complianceRegistries", filters: ["filter"]) {
__id
totalCount
edges {
node {
id
snapshotId
sourceId
referenceId
area
source
@@ -83,15 +92,17 @@ const complianceRegistriesPageFragment = graphql`
export default function ComplianceRegistriesPage({ queryRef }: ComplianceRegistriesPageProps) {
const { __ } = useTranslate();
const organizationId = useOrganizationId();
const { snapshotId } = useParams<{ snapshotId?: string }>();
const isSnapshotMode = Boolean(snapshotId);
usePageTitle(__("Compliance Registries"));
const organization = usePreloadedQuery(
graphql`
query ComplianceRegistriesPageQuery($organizationId: ID!) {
query ComplianceRegistriesPageQuery($organizationId: ID!, $snapshotId: ID) {
node(id: $organizationId) {
... on Organization {
...ComplianceRegistriesPageFragment
...ComplianceRegistriesPageFragment @arguments(snapshotId: $snapshotId)
}
}
}
@@ -109,15 +120,20 @@ export default function ComplianceRegistriesPage({ queryRef }: ComplianceRegistr
return (
<div className="space-y-6">
{isSnapshotMode && snapshotId && (
<SnapshotBanner snapshotId={snapshotId} />
)}
<PageHeader
title={__("Compliance Registries")}
description={__(
"Manage your organization's compliance registry entries."
)}
>
<CreateComplianceRegistryDialog organizationId={organizationId} connection={connectionId}>
<Button icon={IconPlusLarge}>{__("Add compliance registry")}</Button>
</CreateComplianceRegistryDialog>
{!snapshotId && (
<CreateComplianceRegistryDialog organizationId={organizationId} connection={connectionId}>
<Button icon={IconPlusLarge}>{__("Add compliance registry")}</Button>
</CreateComplianceRegistryDialog>
)}
</PageHeader>
{registries.length === 0 ? (
@@ -151,6 +167,7 @@ export default function ComplianceRegistriesPage({ queryRef }: ComplianceRegistr
key={registry.id}
registry={registry}
connectionId={connectionId}
snapshotId={snapshotId}
/>
))}
</Tbody>
@@ -176,14 +193,17 @@ export default function ComplianceRegistriesPage({ queryRef }: ComplianceRegistr
function RegistryRow({
registry,
connectionId,
snapshotId,
}: {
registry: ComplianceRegistry;
connectionId: string;
snapshotId?: string;
}) {
const organizationId = useOrganizationId();
const { __ } = useTranslate();
const [deleteRegistry] = useMutation(deleteComplianceRegistryMutation);
const confirm = useConfirm();
const isSnapshotMode = Boolean(snapshotId);
const formatDate = (dateString: string) => {
return new Date(dateString).toLocaleDateString();
@@ -211,8 +231,12 @@ function RegistryRow({
);
};
const detailsUrl = isSnapshotMode
? `/organizations/${organizationId}/snapshots/${snapshotId}/compliance-registries/${registry.id}`
: `/organizations/${organizationId}/compliance-registries/${registry.id}`;
return (
<Tr to={`/organizations/${organizationId}/compliance-registries/${registry.id}`}>
<Tr to={detailsUrl}>
<Td>
<span className="font-mono text-sm">{registry.referenceId}</span>
</Td>
@@ -234,15 +258,17 @@ function RegistryRow({
)}
</Td>
<Td noLink width={50} className="text-end">
<ActionDropdown>
<DropdownItem
icon={IconTrashCan}
variant="danger"
onSelect={handleDelete}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
{!isSnapshotMode && (
<ActionDropdown>
<DropdownItem
icon={IconTrashCan}
variant="danger"
onSelect={handleDelete}
>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
)}
</Td>
</Tr>
);

View File

@@ -25,12 +25,14 @@ import {
Select,
} from "@probo/ui";
import { useTranslate } from "@probo/i18n";
import { useParams } from "react-router";
import { useOrganizationId } from "/hooks/useOrganizationId";
import { PeopleSelectField } from "/components/form/PeopleSelectField";
import { useFormWithSchema } from "/hooks/useFormWithSchema";
import { Controller } from "react-hook-form";
import z from "zod";
import { getStatusVariant, getStatusLabel, formatDatetime, getComplianceRegistryStatusOptions } from "@probo/helpers";
import { getStatusVariant, getStatusLabel, formatDatetime, getComplianceRegistryStatusOptions, validateSnapshotConsistency } from "@probo/helpers";
import { SnapshotBanner } from "/components/SnapshotBanner";
import type { ComplianceRegistryGraphNodeQuery } from "/hooks/graph/__generated__/ComplianceRegistryGraphNodeQuery.graphql";
const updateRegistrySchema = z.object({
@@ -56,11 +58,15 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
const { __ } = useTranslate();
const { toast } = useToast();
const organizationId = useOrganizationId();
const { snapshotId } = useParams<{ snapshotId?: string }>();
const isSnapshotMode = Boolean(snapshotId);
if (!registry) {
return <div>{__("Compliance registry entry not found")}</div>;
}
validateSnapshotConsistency(registry, snapshotId);
const updateRegistry = useUpdateComplianceRegistry();
const statusOptions = getComplianceRegistryStatusOptions(__);
@@ -124,29 +130,38 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
}
});
const breadcrumbComplianceRegistriesUrl = isSnapshotMode
? `/organizations/${organizationId}/snapshots/${snapshotId}/compliance-registries`
: `/organizations/${organizationId}/compliance-registries`;
return (
<div className="space-y-6">
{isSnapshotMode && snapshotId && (
<SnapshotBanner snapshotId={snapshotId} />
)}
<div className="flex justify-between items-start">
<div>
<Breadcrumb
items={[
{ label: __("Compliance Registries"), to: "../compliance-registries" },
{ label: registry.referenceId! },
]}
/>
<div className="flex items-center gap-3 mt-2">
<h1 className="text-2xl font-bold">{registry.referenceId}</h1>
<Badge variant={getStatusVariant(registry.status || "OPEN")}>
{getStatusLabel(registry.status || "OPEN")}
</Badge>
</div>
<Breadcrumb
items={[
{ label: __("Compliance Registries"), to: breadcrumbComplianceRegistriesUrl },
{ label: registry.referenceId! },
]}
/>
<div className="flex items-center gap-3 mt-2">
<h1 className="text-2xl font-bold">{registry.referenceId}</h1>
<Badge variant={getStatusVariant(registry.status || "OPEN")}>
{getStatusLabel(registry.status || "OPEN")}
</Badge>
</div>
</div>
<ActionDropdown>
<DropdownItem icon={IconTrashCan} onClick={deleteRegistry}>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
{!isSnapshotMode && (
<ActionDropdown>
<DropdownItem icon={IconTrashCan} onClick={deleteRegistry}>
{__("Delete")}
</DropdownItem>
</ActionDropdown>
)}
</div>
<Card padded>
@@ -159,6 +174,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("referenceId")}
placeholder={__("Enter reference ID")}
disabled={isSnapshotMode}
/>
</Field>
@@ -172,6 +188,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("area")}
placeholder={__("Enter area")}
disabled={isSnapshotMode}
/>
</Field>
@@ -182,6 +199,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("source")}
placeholder={__("Enter source")}
disabled={isSnapshotMode}
/>
</Field>
</div>
@@ -198,6 +216,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
onValueChange={field.onChange}
value={field.value}
className="w-full"
disabled={isSnapshotMode}
>
{statusOptions.map((option) => (
<Option key={option.value} value={option.value}>
@@ -223,6 +242,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
label={__("Owner")}
error={formState.errors.ownerId?.message}
required
disabled={isSnapshotMode}
/>
)}
/>
@@ -236,6 +256,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("regulator")}
placeholder={__("Enter regulator")}
disabled={isSnapshotMode}
/>
</Field>
</div>
@@ -248,6 +269,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("lastReviewDate")}
type="date"
disabled={isSnapshotMode}
/>
</Field>
@@ -258,6 +280,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
<Input
{...register("dueDate")}
type="date"
disabled={isSnapshotMode}
/>
</Field>
</div>
@@ -270,6 +293,7 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
{...register("requirement")}
placeholder={__("Enter requirement")}
rows={4}
disabled={isSnapshotMode}
/>
</Field>
@@ -281,17 +305,20 @@ export default function ComplianceRegistryDetailsPage(props: Props) {
{...register("actionsToBeImplemented")}
placeholder={__("Enter actions to be implemented")}
rows={4}
disabled={isSnapshotMode}
/>
</Field>
<div className="flex justify-end">
<Button
type="submit"
disabled={formState.isSubmitting}
>
{formState.isSubmitting ? __("Saving...") : __("Save Changes")}
</Button>
</div>
{!isSnapshotMode && (
<div className="flex justify-end">
<Button
type="submit"
disabled={formState.isSubmitting}
>
{formState.isSubmitting ? __("Saving...") : __("Save Changes")}
</Button>
</div>
)}
</form>
</Card>
</div>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<312905201e0a72d96dd29afeed17dee1>>
* @generated SignedSource<<db8b4530d56ae89fa8e332555a85eb33>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -29,7 +29,9 @@ export type ComplianceRegistriesPageFragment$data = {
readonly referenceId: string;
readonly regulator: string | null | undefined;
readonly requirement: string | null | undefined;
readonly snapshotId: string | null | undefined;
readonly source: string | null | undefined;
readonly sourceId: string | null | undefined;
readonly status: ComplianceRegistryStatus;
readonly updatedAt: any;
};
@@ -72,6 +74,11 @@ return {
"defaultValue": 10,
"kind": "LocalArgument",
"name": "first"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
"kind": "Fragment",
@@ -108,7 +115,19 @@ return {
(v1/*: any*/),
{
"alias": "complianceRegistries",
"args": null,
"args": [
{
"fields": [
{
"kind": "Variable",
"name": "snapshotId",
"variableName": "snapshotId"
}
],
"kind": "ObjectValue",
"name": "filter"
}
],
"concreteType": "ComplianceRegistryConnection",
"kind": "LinkedField",
"name": "__ComplianceRegistriesPage_complianceRegistries_connection",
@@ -138,6 +157,20 @@ return {
"plural": false,
"selections": [
(v1/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "snapshotId",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "sourceId",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -300,6 +333,6 @@ return {
};
})();
(node as any).hash = "b6b97d09ba132cbc1ffb006c23a33589";
(node as any).hash = "b22ac157b9ba89ab14fe8363e56957ef";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<c6faaadb8a0f7d2b70fed9a5801f3580>>
* @generated SignedSource<<794221c1dbbf8fd2d1808863d55d2c05>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type ComplianceRegistriesPageQuery$variables = {
organizationId: string;
snapshotId?: string | null | undefined;
};
export type ComplianceRegistriesPageQuery$data = {
readonly node: {
@@ -29,6 +30,11 @@ var v0 = [
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
},
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "snapshotId"
}
],
v1 = [
@@ -38,21 +44,33 @@ 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",
@@ -78,7 +96,7 @@ return {
"kind": "InlineFragment",
"selections": [
{
"args": null,
"args": (v2/*: any*/),
"kind": "FragmentSpread",
"name": "ComplianceRegistriesPageFragment"
}
@@ -107,14 +125,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": "ComplianceRegistryConnection",
"kind": "LinkedField",
"name": "complianceRegistries",
@@ -143,7 +161,21 @@ return {
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "snapshotId",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "sourceId",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -215,7 +247,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v3/*: any*/),
(v4/*: any*/),
{
"alias": null,
"args": null,
@@ -240,7 +272,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v2/*: any*/)
(v3/*: any*/)
],
"storageKey": null
},
@@ -292,12 +324,14 @@ return {
]
}
],
"storageKey": "complianceRegistries(first:10)"
"storageKey": null
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"args": (v5/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "ComplianceRegistriesPage_complianceRegistries",
"kind": "LinkedHandle",
@@ -313,16 +347,16 @@ return {
]
},
"params": {
"cacheID": "e4fba5ed79a8d19c72d2814f1adf38c3",
"cacheID": "b63e74cea7f47c7e4f735ad2b52e1765",
"id": null,
"metadata": {},
"name": "ComplianceRegistriesPageQuery",
"operationKind": "query",
"text": "query ComplianceRegistriesPageQuery(\n $organizationId: ID!\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ComplianceRegistriesPageFragment\n }\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment on Organization {\n id\n complianceRegistries(first: 10) {\n totalCount\n edges {\n node {\n id\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 ComplianceRegistriesPageQuery(\n $organizationId: ID!\n $snapshotId: ID\n) {\n node(id: $organizationId) {\n __typename\n ... on Organization {\n ...ComplianceRegistriesPageFragment_3iomuz\n }\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment_3iomuz on Organization {\n id\n complianceRegistries(first: 10, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n snapshotId\n sourceId\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 = "3e8551eebdf52ee84fb3910ee77cfe15";
(node as any).hash = "f0064c0d6d6e628923be30edb4b249db";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<25a63f42437f72ee5aea5f2c6e324d4a>>
* @generated SignedSource<<af4b3139bff8ab757fa1876aa4be4bb1>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -14,6 +14,7 @@ export type ComplianceRegistriesPageRefetchQuery$variables = {
after?: any | null | undefined;
first?: number | null | undefined;
id: string;
snapshotId?: string | null | undefined;
};
export type ComplianceRegistriesPageRefetchQuery$data = {
readonly node: {
@@ -26,73 +27,99 @@ export type ComplianceRegistriesPageRefetchQuery = {
};
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
};
},
v10 = [
(v5/*: any*/),
{
"fields": [
(v7/*: any*/)
],
"kind": "ObjectValue",
"name": "filter"
},
(v6/*: any*/)
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v2/*: any*/),
(v3/*: any*/)
],
"kind": "Fragment",
"metadata": null,
"name": "ComplianceRegistriesPageRefetchQuery",
"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": "ComplianceRegistriesPageFragment"
}
@@ -105,26 +132,31 @@ return {
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/),
(v3/*: any*/),
(v2/*: any*/)
],
"kind": "Operation",
"name": "ComplianceRegistriesPageRefetchQuery",
"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": "ComplianceRegistryConnection",
"kind": "LinkedField",
"name": "complianceRegistries",
@@ -153,7 +185,21 @@ return {
"name": "node",
"plural": false,
"selections": [
(v4/*: any*/),
(v9/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "snapshotId",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "sourceId",
"storageKey": null
},
{
"alias": null,
"args": null,
@@ -225,7 +271,7 @@ return {
"name": "owner",
"plural": false,
"selections": [
(v4/*: any*/),
(v9/*: any*/),
{
"alias": null,
"args": null,
@@ -250,7 +296,7 @@ return {
"name": "updatedAt",
"storageKey": null
},
(v3/*: any*/)
(v8/*: any*/)
],
"storageKey": null
},
@@ -306,8 +352,10 @@ return {
},
{
"alias": null,
"args": (v2/*: any*/),
"filters": null,
"args": (v10/*: any*/),
"filters": [
"filter"
],
"handle": "connection",
"key": "ComplianceRegistriesPage_complianceRegistries",
"kind": "LinkedHandle",
@@ -323,16 +371,16 @@ return {
]
},
"params": {
"cacheID": "2b10e1f8598c007ee1e3e93e39b51b0d",
"cacheID": "d14ed4a195ca3b570ad5ecd255cf17e8",
"id": null,
"metadata": {},
"name": "ComplianceRegistriesPageRefetchQuery",
"operationKind": "query",
"text": "query ComplianceRegistriesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...ComplianceRegistriesPageFragment_2HEEH6\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment_2HEEH6 on Organization {\n id\n complianceRegistries(first: $first, after: $after) {\n totalCount\n edges {\n node {\n id\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 ComplianceRegistriesPageRefetchQuery(\n $after: CursorKey\n $first: Int = 10\n $snapshotId: ID = null\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...ComplianceRegistriesPageFragment_35e0S5\n id\n }\n}\n\nfragment ComplianceRegistriesPageFragment_35e0S5 on Organization {\n id\n complianceRegistries(first: $first, after: $after, filter: {snapshotId: $snapshotId}) {\n totalCount\n edges {\n node {\n id\n snapshotId\n sourceId\n referenceId\n area\n source\n requirement\n status\n lastReviewDate\n dueDate\n actionsToBeImplemented\n regulator\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 = "b6b97d09ba132cbc1ffb006c23a33589";
(node as any).hash = "b22ac157b9ba89ab14fe8363e56957ef";
export default node;

View File

@@ -19,6 +19,7 @@ import { useMutationWithToasts } from "/hooks/useMutationWithToasts";
import { useOrganizationId } from "/hooks/useOrganizationId";
import { ControlledField } from "/components/form/ControlledField";
import { SnapshotTypeOptions } from "/components/form/SnapshotTypeOptions";
import { snapshotTypes } from "@probo/helpers";
const snapshotCreateMutation = graphql`
mutation SnapshotFormDialogCreateMutation(
@@ -42,7 +43,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", "NONCONFORMITY_REGISTRIES"]),
type: z.enum(snapshotTypes),
});
type Props = {

View File

@@ -9,8 +9,23 @@ export const complianceRegistryRoutes = [
{
path: "compliance-registries",
fallback: PageSkeleton,
queryLoader: ({ organizationId }: { organizationId: string }) =>
loadQuery(relayEnvironment, complianceRegistriesQuery, { organizationId }),
queryLoader: (params: Record<string, string>) =>
loadQuery(relayEnvironment, complianceRegistriesQuery, {
organizationId: params.organizationId,
snapshotId: null
}),
Component: lazy(
() => import("/pages/organizations/complianceRegistries/ComplianceRegistriesPage")
),
},
{
path: "snapshots/:snapshotId/compliance-registries",
fallback: PageSkeleton,
queryLoader: (params: Record<string, string>) =>
loadQuery(relayEnvironment, complianceRegistriesQuery, {
organizationId: params.organizationId,
snapshotId: params.snapshotId
}),
Component: lazy(
() => import("/pages/organizations/complianceRegistries/ComplianceRegistriesPage")
),
@@ -26,4 +41,15 @@ export const complianceRegistryRoutes = [
() => import("/pages/organizations/complianceRegistries/ComplianceRegistryDetailsPage")
),
},
{
path: "snapshots/:snapshotId/compliance-registries/:registryId",
fallback: PageSkeleton,
queryLoader: (params: Record<string, string>) =>
loadQuery(relayEnvironment, complianceRegistryNodeQuery, {
complianceRegistryId: params.registryId
}),
Component: lazy(
() => import("/pages/organizations/complianceRegistries/ComplianceRegistryDetailsPage")
),
},
] satisfies AppRoute[];