Change data enum

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-06-09 13:20:01 -07:00
parent 13b7bfcc74
commit df3b43cd18
19 changed files with 348 additions and 236 deletions

View File

@@ -60,7 +60,7 @@ const dataListFragment = graphql`
node {
id
name
dataSensitivity
dataClassification
owner {
id
fullName
@@ -236,29 +236,27 @@ function DataListContent({
<div className="flex items-center gap-2">
<Badge
variant={
item?.dataSensitivity === "NONE"
item?.dataClassification === "PUBLIC"
? "default"
: item?.dataSensitivity === "LOW"
: item?.dataClassification === "INTERNAL"
? "success"
: item?.dataSensitivity === "MEDIUM"
: item?.dataClassification === "CONFIDENTIAL"
? "info"
: item?.dataSensitivity === "HIGH"
: item?.dataClassification === "SECRET"
? "warning"
: "destructive"
}
className="px-3 py-0.5 text-xs font-medium"
>
{item?.dataSensitivity === "NONE"
? "No sensitive data"
: item?.dataSensitivity === "LOW"
? "Public or non-sensitive data"
: item?.dataSensitivity === "MEDIUM"
? "Internal/restricted data"
: item?.dataSensitivity === "HIGH"
? "Confidential data"
: item?.dataSensitivity === "CRITICAL"
? "Regulated/PII/financial data"
: "No sensitive data"}
{item?.dataClassification === "PUBLIC"
? "Public"
: item?.dataClassification === "INTERNAL"
? "Internal"
: item?.dataClassification === "CONFIDENTIAL"
? "Confidential"
: item?.dataClassification === "SECRET"
? "Secret"
: "Unknown"}
</Badge>
<Button
variant="ghost"

View File

@@ -13,7 +13,7 @@ import {
useMutation,
} from "react-relay";
import { Suspense, useEffect, useState, useCallback } from "react";
import type { DatumViewQuery as DatumViewQueryType } from "./__generated__/DatumViewQuery.graphql";
import type { DataClassification, DatumViewQuery as DatumViewQueryType } from "./__generated__/DatumViewQuery.graphql";
import { useParams } from "react-router";
import { PageTemplate } from "@/components/PageTemplate";
import { DatumViewSkeleton } from "./DatumPage";
@@ -35,7 +35,7 @@ const datumViewQuery = graphql`
... on Datum {
id
name
dataSensitivity
dataClassification
vendors {
edges {
node {
@@ -75,7 +75,7 @@ const updateDatumMutation = graphql`
datum {
id
name
dataSensitivity
dataClassification
vendors {
edges {
node {
@@ -93,13 +93,13 @@ const updateDatumMutation = graphql`
}
`;
type DataSensitivity = "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
// type DataClassification = "PUBLIC" | "INTERNAL" | "CONFIDENTIAL" | "SECRET";
interface Datum {
readonly id?: string;
readonly name?: string;
readonly description?: string;
readonly dataSensitivity?: DataSensitivity;
readonly dataClassification?: DataClassification;
readonly owner?: {
readonly id: string;
readonly fullName: string;
@@ -171,7 +171,7 @@ function DatumViewContent({
const organization = data.organization as Organization;
const [formData, setFormData] = useState({
name: datum?.name || "",
dataSensitivity: datum?.dataSensitivity || "NONE",
dataClassification: datum?.dataClassification || "INTERNAL",
ownerId: datum?.owner?.id || "",
selectedVendorIds: datum?.vendors?.edges?.map(edge => edge?.node?.id).filter((id): id is string => id != null) || [],
});
@@ -188,7 +188,7 @@ function DatumViewContent({
input: {
id: nodeId,
name: formData.name,
dataSensitivity: formData.dataSensitivity,
dataClassification: formData.dataClassification,
ownerId: formData.ownerId,
vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined,
},
@@ -233,7 +233,7 @@ function DatumViewContent({
const datum = data.node as Datum | null;
setFormData({
name: datum?.name || "",
dataSensitivity: datum?.dataSensitivity || "NONE",
dataClassification: datum?.dataClassification || "INTERNAL",
ownerId: datum?.owner?.id || "",
selectedVendorIds: datum?.vendors?.edges?.map(edge => edge?.node?.id).filter((id): id is string => id != null) || [],
});
@@ -317,18 +317,17 @@ function DatumViewContent({
<Label className="text-sm">Data Sensitivity</Label>
</div>
<Select
value={formData.dataSensitivity}
onValueChange={(value) => handleFieldChange("dataSensitivity", value)}
value={formData.dataClassification}
onValueChange={(value) => handleFieldChange("dataClassification", value)}
>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select data sensitivity" />
</SelectTrigger>
<SelectContent>
<SelectItem value="NONE">No sensitive data</SelectItem>
<SelectItem value="LOW">Public or non-sensitive data</SelectItem>
<SelectItem value="MEDIUM">Internal/restricted data</SelectItem>
<SelectItem value="HIGH">Confidential data</SelectItem>
<SelectItem value="CRITICAL">Regulated/PII/financial data</SelectItem>
<SelectItem value="PUBLIC">Public</SelectItem>
<SelectItem value="INTERNAL">Internal</SelectItem>
<SelectItem value="CONFIDENTIAL">Confidential</SelectItem>
<SelectItem value="SECRET">Secret</SelectItem>
</SelectContent>
</Select>
</div>

View File

@@ -44,7 +44,7 @@ const createDatumMutation = graphql`
node {
id
name
dataSensitivity
dataClassification
owner {
id
fullName
@@ -129,7 +129,7 @@ function NewDataViewContent({
const [formData, setFormData] = useState({
name: "",
dataSensitivity: "NONE" as "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL",
dataClassification: "INTERNAL" as "PUBLIC" | "INTERNAL" | "CONFIDENTIAL" | "SECRET",
ownerId: "",
selectedVendorIds: [] as string[],
});
@@ -184,7 +184,7 @@ function NewDataViewContent({
input: {
organizationId: organizationId!,
name: formData.name,
dataSensitivity: formData.dataSensitivity,
dataClassification: formData.dataClassification,
ownerId: formData.ownerId,
vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined,
} satisfies CreateDatumInput,
@@ -278,19 +278,18 @@ function NewDataViewContent({
<div className="space-y-2">
<Label className="text-sm">Data Sensitivity</Label>
<Select
value={formData.dataSensitivity}
value={formData.dataClassification}
onValueChange={(value: string) =>
handleFieldChange("dataSensitivity", value as "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL")}
handleFieldChange("dataClassification", value as "PUBLIC" | "INTERNAL" | "CONFIDENTIAL" | "SECRET")}
>
<SelectTrigger>
<SelectValue placeholder="Select data sensitivity" />
</SelectTrigger>
<SelectContent>
<SelectItem value="NONE">No sensitive data</SelectItem>
<SelectItem value="LOW">Public or non-sensitive data</SelectItem>
<SelectItem value="MEDIUM">Internal/restricted data</SelectItem>
<SelectItem value="HIGH">Confidential data</SelectItem>
<SelectItem value="CRITICAL">Regulated/PII/financial data</SelectItem>
<SelectItem value="PUBLIC">Public</SelectItem>
<SelectItem value="INTERNAL">Internal</SelectItem>
<SelectItem value="CONFIDENTIAL">Confidential</SelectItem>
<SelectItem value="SECRET">Secret</SelectItem>
</SelectContent>
</Select>
</div>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<9fb6bfbd0ba80aa33ef3d8edfdb53a19>>
* @generated SignedSource<<390d190ae303b0edd4858bc50f58c048>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -208,7 +208,7 @@ return {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
{
@@ -368,16 +368,16 @@ return {
]
},
"params": {
"cacheID": "1a9be11b8d32e569f75ae591226e7b8b",
"cacheID": "7a663a198e00b6cc15d889565e48f4e2",
"id": null,
"metadata": {},
"name": "DataListViewPaginationQuery",
"operationKind": "query",
"text": "query DataListViewPaginationQuery(\n $after: CursorKey\n $before: CursorKey\n $first: Int\n $last: Int\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
"text": "query DataListViewPaginationQuery(\n $after: CursorKey\n $before: CursorKey\n $first: Int\n $last: Int\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataClassification\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
}
};
})();
(node as any).hash = "d1b1652f1f59c091709bce823b6a0eaa";
(node as any).hash = "b8465a1295d6d7351cee98f2e4f9756a";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<905fb20472d2c30aabb9a9afc41acf41>>
* @generated SignedSource<<f5c4ef95583024470ef959e39f4452a2>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -208,7 +208,7 @@ return {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
{
@@ -368,12 +368,12 @@ return {
]
},
"params": {
"cacheID": "0c5725c38efb32dc65674c4bbd8dd154",
"cacheID": "164b5819fe6d186b9baa512c67b59e9a",
"id": null,
"metadata": {},
"name": "DataListViewQuery",
"operationKind": "query",
"text": "query DataListViewQuery(\n $organizationId: ID!\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n organization: node(id: $organizationId) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
"text": "query DataListViewQuery(\n $organizationId: ID!\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n organization: node(id: $organizationId) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataClassification\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<25f5cfd4e1e5f0724a1082db9d9b10d6>>
* @generated SignedSource<<63f7ca6490b6387c5950790772723ebc>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,7 +9,7 @@
// @ts-nocheck
import { ReaderFragment } from 'relay-runtime';
export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE";
export type DataClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
import { FragmentRefs } from "relay-runtime";
export type DataListView_data$data = {
readonly data: {
@@ -17,7 +17,7 @@ export type DataListView_data$data = {
readonly edges: ReadonlyArray<{
readonly node: {
readonly createdAt: string;
readonly dataSensitivity: DataSensitivity;
readonly dataClassification: DataClassification;
readonly id: string;
readonly name: string;
readonly owner: {
@@ -165,7 +165,7 @@ return {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
{
@@ -316,6 +316,6 @@ return {
};
})();
(node as any).hash = "d1b1652f1f59c091709bce823b6a0eaa";
(node as any).hash = "b8465a1295d6d7351cee98f2e4f9756a";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<272734160b60bf94a6f031e685751b64>>
* @generated SignedSource<<435da2b0f7d8b9ec259d386a752c18b7>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -10,7 +10,7 @@
import { ConcreteRequest } from 'relay-runtime';
import { FragmentRefs } from "relay-runtime";
export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE";
export type DataClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DatumViewQuery$variables = {
datumId: string;
organizationId: string;
@@ -18,7 +18,7 @@ export type DatumViewQuery$variables = {
export type DatumViewQuery$data = {
readonly node: {
readonly createdAt?: string;
readonly dataSensitivity?: DataSensitivity;
readonly dataClassification?: DataClassification;
readonly id?: string;
readonly name?: string;
readonly owner?: {
@@ -91,7 +91,7 @@ v4 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
v5 = {
@@ -469,7 +469,7 @@ return {
]
},
"params": {
"cacheID": "c3fd8609637a69d90a532344150b4d6a",
"cacheID": "958954258516869d985feedba1cf9db3",
"id": null,
"metadata": {
"connection": [
@@ -486,11 +486,11 @@ return {
},
"name": "DatumViewQuery",
"operationKind": "query",
"text": "query DatumViewQuery(\n $datumId: ID!\n $organizationId: ID!\n) {\n node(id: $datumId) {\n __typename\n ... on Datum {\n id\n name\n dataSensitivity\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
"text": "query DatumViewQuery(\n $datumId: ID!\n $organizationId: ID!\n) {\n node(id: $datumId) {\n __typename\n ... on Datum {\n id\n name\n dataClassification\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();
(node as any).hash = "2f759d45493db37e45b3a7166dd36c2e";
(node as any).hash = "836074301e1d6f8c2aec59fc569bd68e";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<4aa66259b93ace779a3e38430cf8c1ee>>
* @generated SignedSource<<6a2c795f1b3328794d9e3db73151feaa>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,9 +9,9 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE";
export type DataClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type UpdateDatumInput = {
dataSensitivity?: DataSensitivity | null | undefined;
dataClassification?: DataClassification | null | undefined;
id: string;
name?: string | null | undefined;
ownerId?: string | null | undefined;
@@ -23,7 +23,7 @@ export type DatumViewUpdateDatumMutation$variables = {
export type DatumViewUpdateDatumMutation$data = {
readonly updateDatum: {
readonly datum: {
readonly dataSensitivity: DataSensitivity;
readonly dataClassification: DataClassification;
readonly id: string;
readonly name: string;
readonly owner: {
@@ -96,7 +96,7 @@ v2 = [
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
{
@@ -184,16 +184,16 @@ return {
"selections": (v2/*: any*/)
},
"params": {
"cacheID": "1e5b2489558fef74becf57d2457a4891",
"cacheID": "ec5c79edccc379aae627f969ec18c55e",
"id": null,
"metadata": {},
"name": "DatumViewUpdateDatumMutation",
"operationKind": "mutation",
"text": "mutation DatumViewUpdateDatumMutation(\n $input: UpdateDatumInput!\n) {\n updateDatum(input: $input) {\n datum {\n id\n name\n dataSensitivity\n vendors {\n edges {\n node {\n id\n }\n }\n }\n owner {\n id\n fullName\n }\n updatedAt\n }\n }\n}\n"
"text": "mutation DatumViewUpdateDatumMutation(\n $input: UpdateDatumInput!\n) {\n updateDatum(input: $input) {\n datum {\n id\n name\n dataClassification\n vendors {\n edges {\n node {\n id\n }\n }\n }\n owner {\n id\n fullName\n }\n updatedAt\n }\n }\n}\n"
}
};
})();
(node as any).hash = "ac445fa9f2ccebef8203e0138c794ea8";
(node as any).hash = "38b1842eb3e3549efc9e961c56c22879";
export default node;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<5b93fe65ad69563bbcb6e75d0b913eb8>>
* @generated SignedSource<<87179d28750a2a84a6c1ea1b779cbd49>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -9,9 +9,9 @@
// @ts-nocheck
import { ConcreteRequest } from 'relay-runtime';
export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE";
export type DataClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type CreateDatumInput = {
dataSensitivity: DataSensitivity;
dataClassification: DataClassification;
name: string;
organizationId: string;
ownerId: string;
@@ -25,7 +25,7 @@ export type NewDatumViewCreateDatumMutation$data = {
readonly createDatum: {
readonly datumEdge: {
readonly node: {
readonly dataSensitivity: DataSensitivity;
readonly dataClassification: DataClassification;
readonly id: string;
readonly name: string;
readonly owner: {
@@ -103,7 +103,7 @@ v5 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "dataSensitivity",
"name": "dataClassification",
"storageKey": null
},
{
@@ -232,16 +232,16 @@ return {
]
},
"params": {
"cacheID": "0ab550803b091f5dfa1935f810eaecdc",
"cacheID": "1349272a7b0c9f14ee6e257f66ad5cea",
"id": null,
"metadata": {},
"name": "NewDatumViewCreateDatumMutation",
"operationKind": "mutation",
"text": "mutation NewDatumViewCreateDatumMutation(\n $input: CreateDatumInput!\n) {\n createDatum(input: $input) {\n datumEdge {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n }\n}\n"
"text": "mutation NewDatumViewCreateDatumMutation(\n $input: CreateDatumInput!\n) {\n createDatum(input: $input) {\n datumEdge {\n node {\n id\n name\n dataClassification\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n }\n}\n"
}
};
})();
(node as any).hash = "697a260fb7d44115c617682d38b9259d";
(node as any).hash = "9b5546ff1b7563fdb7db2bbcba53f3fe";
export default node;