Move console to a relay multi project config

Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
Émile Ré
2025-12-30 10:37:23 +01:00
committed by Bryan Frimin
parent c1df98cec1
commit 6b2864e160
572 changed files with 6400 additions and 4263 deletions

View File

@@ -1,10 +1,15 @@
import { Field, Option, Select, Badge } from "@probo/ui";
import { Suspense, type ComponentProps } from "react";
import { useTranslate } from "@probo/i18n";
import { type Control, Controller, type FieldValues, type Path } from "react-hook-form";
import {
type Control,
Controller,
type FieldValues,
type Path,
} from "react-hook-form";
import { useLazyLoadQuery, graphql } from "react-relay";
import { getAuditStateVariant, getAuditStateLabel } from "@probo/helpers";
import type { AuditSelectFieldQuery } from "./__generated__/AuditSelectFieldQuery.graphql";
import type { AuditSelectFieldQuery } from "/__generated__/core/AuditSelectFieldQuery.graphql";
const auditsQuery = graphql`
query AuditSelectFieldQuery($organizationId: ID!) {
@@ -60,12 +65,19 @@ export function AuditSelectField<T extends FieldValues = FieldValues>({
}
function AuditSelectWithQuery<T extends FieldValues = FieldValues>(
props: Pick<Props<T>, "organizationId" | "control" | "name" | "disabled">
props: Pick<Props<T>, "organizationId" | "control" | "name" | "disabled">,
) {
const { __ } = useTranslate();
const { name, organizationId, control } = props;
const data = useLazyLoadQuery<AuditSelectFieldQuery>(auditsQuery, { organizationId }, { fetchPolicy: "network-only" });
const audits = data?.organization?.audits?.edges?.map((edge) => edge.node).filter((node) => node !== null) ?? [];
const data = useLazyLoadQuery<AuditSelectFieldQuery>(
auditsQuery,
{ organizationId },
{ fetchPolicy: "network-only" },
);
const audits =
data?.organization?.audits?.edges
?.map((edge) => edge.node)
.filter((node) => node !== null) ?? [];
const NONE_VALUE = "__NONE__";
@@ -79,7 +91,9 @@ function AuditSelectWithQuery<T extends FieldValues = FieldValues>(
id={name}
variant="editor"
placeholder={__("Select an audit")}
onValueChange={(value) => field.onChange(value === NONE_VALUE ? "" : value)}
onValueChange={(value) =>
field.onChange(value === NONE_VALUE ? "" : value)
}
key={audits?.length.toString() ?? "0"}
{...field}
className="w-full"
@@ -94,8 +108,7 @@ function AuditSelectWithQuery<T extends FieldValues = FieldValues>(
<span>
{audit.name
? `${audit.framework.name} - ${audit.name}`
: audit.framework.name
}
: audit.framework.name}
</span>
<div className="ml-3">
<Badge variant={getAuditStateVariant(audit.state)}>

View File

@@ -5,7 +5,7 @@ import type {
ProcessingActivityLawfulBasis,
ProcessingActivityDataProtectionImpactAssessment,
ProcessingActivityTransferImpactAssessment,
} from "../../hooks/graph/__generated__/ProcessingActivityGraphCreateMutation.graphql";
} from "/__generated__/core/ProcessingActivityGraphCreateMutation.graphql";
export function SpecialOrCriminalDataOptions() {
const { __ } = useTranslate();
@@ -58,7 +58,7 @@ export function LawfulBasisOptions() {
export function getLawfulBasisLabel(
value: ProcessingActivityLawfulBasis | null | undefined,
__: (key: string) => string
__: (key: string) => string,
): string {
if (!value) return "-";
@@ -76,7 +76,7 @@ export function getLawfulBasisLabel(
export function getResidualRiskLabel(
value: "LOW" | "MEDIUM" | "HIGH" | null | undefined,
__: (key: string) => string
__: (key: string) => string,
): string {
if (!value) return "-";

View File

@@ -1,215 +0,0 @@
/**
* @generated SignedSource<<21026731cd2ebaf80c8c2e251b9a57f8>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
export type AuditSelectFieldQuery$variables = {
organizationId: string;
};
export type AuditSelectFieldQuery$data = {
readonly organization: {
readonly audits?: {
readonly edges: ReadonlyArray<{
readonly node: {
readonly framework: {
readonly id: string;
readonly name: string;
};
readonly id: string;
readonly name: string | null | undefined;
readonly state: AuditState;
readonly validFrom: any | null | undefined;
readonly validUntil: any | null | undefined;
};
}>;
};
};
};
export type AuditSelectFieldQuery = {
response: AuditSelectFieldQuery$data;
variables: AuditSelectFieldQuery$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
}
],
v1 = [
{
"kind": "Variable",
"name": "id",
"variableName": "organizationId"
}
],
v2 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
},
v4 = {
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"concreteType": "AuditConnection",
"kind": "LinkedField",
"name": "audits",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "AuditEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "Audit",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/),
{
"alias": null,
"args": null,
"concreteType": "Framework",
"kind": "LinkedField",
"name": "framework",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "validFrom",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "validUntil",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "audits(first:100)"
}
],
"type": "Organization",
"abstractKey": null
};
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "AuditSelectFieldQuery",
"selections": [
{
"alias": "organization",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v4/*: any*/)
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "AuditSelectFieldQuery",
"selections": [
{
"alias": "organization",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
(v4/*: any*/),
(v2/*: any*/)
],
"storageKey": null
}
]
},
"params": {
"cacheID": "339c5438bb684c44887cc9cb53fb2c6a",
"id": null,
"metadata": {},
"name": "AuditSelectFieldQuery",
"operationKind": "query",
"text": "query AuditSelectFieldQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n audits(first: 100) {\n edges {\n node {\n id\n name\n framework {\n id\n name\n }\n state\n validFrom\n validUntil\n }\n }\n }\n }\n id\n }\n}\n"
}
};
})();
(node as any).hash = "2bde1a04326144fe1b133672870807eb";
export default node;

View File

@@ -1,197 +0,0 @@
/**
* @generated SignedSource<<760a4c9ef58d487ab996d36a6cf1aa21>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type StateOfApplicabilityControlsFieldFrameworkControlsQuery$variables = {
frameworkId: string;
};
export type StateOfApplicabilityControlsFieldFrameworkControlsQuery$data = {
readonly framework: {
readonly controls?: {
readonly edges: ReadonlyArray<{
readonly node: {
readonly id: string;
readonly name: string;
readonly sectionTitle: string;
};
}>;
};
readonly id?: string;
};
};
export type StateOfApplicabilityControlsFieldFrameworkControlsQuery = {
response: StateOfApplicabilityControlsFieldFrameworkControlsQuery$data;
variables: StateOfApplicabilityControlsFieldFrameworkControlsQuery$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "frameworkId"
}
],
v1 = [
{
"kind": "Variable",
"name": "id",
"variableName": "frameworkId"
}
],
v2 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v3 = {
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 500
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "ASC",
"field": "SECTION_TITLE"
}
}
],
"concreteType": "ControlConnection",
"kind": "LinkedField",
"name": "controls",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "ControlEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "Control",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "sectionTitle",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "controls(first:500,orderBy:{\"direction\":\"ASC\",\"field\":\"SECTION_TITLE\"})"
};
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "StateOfApplicabilityControlsFieldFrameworkControlsQuery",
"selections": [
{
"alias": "framework",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"kind": "InlineFragment",
"selections": [
(v2/*: any*/),
(v3/*: any*/)
],
"type": "Framework",
"abstractKey": null
}
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "StateOfApplicabilityControlsFieldFrameworkControlsQuery",
"selections": [
{
"alias": "framework",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
(v2/*: any*/),
{
"kind": "InlineFragment",
"selections": [
(v3/*: any*/)
],
"type": "Framework",
"abstractKey": null
}
],
"storageKey": null
}
]
},
"params": {
"cacheID": "4e57853f9452f6167ef9dd2521f0b998",
"id": null,
"metadata": {},
"name": "StateOfApplicabilityControlsFieldFrameworkControlsQuery",
"operationKind": "query",
"text": "query StateOfApplicabilityControlsFieldFrameworkControlsQuery(\n $frameworkId: ID!\n) {\n framework: node(id: $frameworkId) {\n __typename\n ... on Framework {\n id\n controls(first: 500, orderBy: {field: SECTION_TITLE, direction: ASC}) {\n edges {\n node {\n id\n sectionTitle\n name\n }\n }\n }\n }\n id\n }\n}\n"
}
};
})();
(node as any).hash = "2817a6951ce5ad1efdee9951636916ff";
export default node;

View File

@@ -1,172 +0,0 @@
/**
* @generated SignedSource<<09147ad036a4ae9295cd5fc5242f6ee7>>
* @lightSyntaxTransform
* @nogrep
*/
/* tslint:disable */
/* eslint-disable */
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type StateOfApplicabilityControlsFieldFrameworksQuery$variables = {
organizationId: string;
};
export type StateOfApplicabilityControlsFieldFrameworksQuery$data = {
readonly organization: {
readonly frameworks?: {
readonly edges: ReadonlyArray<{
readonly node: {
readonly id: string;
readonly name: string;
};
}>;
};
};
};
export type StateOfApplicabilityControlsFieldFrameworksQuery = {
response: StateOfApplicabilityControlsFieldFrameworksQuery$data;
variables: StateOfApplicabilityControlsFieldFrameworksQuery$variables;
};
const node: ConcreteRequest = (function(){
var v0 = [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "organizationId"
}
],
v1 = [
{
"kind": "Variable",
"name": "id",
"variableName": "organizationId"
}
],
v2 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
},
v3 = {
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"concreteType": "FrameworkConnection",
"kind": "LinkedField",
"name": "frameworks",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "FrameworkEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{
"alias": null,
"args": null,
"concreteType": "Framework",
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "name",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "frameworks(first:100)"
}
],
"type": "Organization",
"abstractKey": null
};
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Fragment",
"metadata": null,
"name": "StateOfApplicabilityControlsFieldFrameworksQuery",
"selections": [
{
"alias": "organization",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
(v3/*: any*/)
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": (v0/*: any*/),
"kind": "Operation",
"name": "StateOfApplicabilityControlsFieldFrameworksQuery",
"selections": [
{
"alias": "organization",
"args": (v1/*: any*/),
"concreteType": null,
"kind": "LinkedField",
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
(v3/*: any*/),
(v2/*: any*/)
],
"storageKey": null
}
]
},
"params": {
"cacheID": "88fe75a1aeca2c9971693ed79bf82afe",
"id": null,
"metadata": {},
"name": "StateOfApplicabilityControlsFieldFrameworksQuery",
"operationKind": "query",
"text": "query StateOfApplicabilityControlsFieldFrameworksQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n frameworks(first: 100) {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n id\n }\n}\n"
}
};
})();
(node as any).hash = "5a0adc0c46445f40980fdb8edb8122ce";
export default node;