Create assets helper
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -25,7 +25,7 @@ import { PeopleSelectField } from "/components/form/PeopleSelectField";
|
|||||||
import { VendorsMultiSelectField } from "/components/form/VendorsMultiSelectField";
|
import { VendorsMultiSelectField } from "/components/form/VendorsMultiSelectField";
|
||||||
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
import { useFormWithSchema } from "/hooks/useFormWithSchema";
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import { getAssetTypeVariant, getCriticityVariant } from "./utils/badgeVariants";
|
import { getAssetTypeVariant, getCriticityVariant } from "@probo/helpers";
|
||||||
|
|
||||||
const updateAssetSchema = z.object({
|
const updateAssetSchema = z.object({
|
||||||
name: z.string().min(1, "Name is required"),
|
name: z.string().min(1, "Name is required"),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { useDeleteAsset, useAssets } from "../../../hooks/graph/AssetGraph";
|
|||||||
import type { AssetGraphListQuery } from "/hooks/graph/__generated__/AssetGraphListQuery.graphql";
|
import type { AssetGraphListQuery } from "/hooks/graph/__generated__/AssetGraphListQuery.graphql";
|
||||||
import { faviconUrl } from "@probo/helpers";
|
import { faviconUrl } from "@probo/helpers";
|
||||||
import type { NodeOf } from "/types";
|
import type { NodeOf } from "/types";
|
||||||
import { getAssetTypeVariant, getCriticityVariant } from "./utils/badgeVariants";
|
import { getAssetTypeVariant, getCriticityVariant } from "@probo/helpers";
|
||||||
|
|
||||||
type AssetEntry = NodeOf<NonNullable<NonNullable<AssetGraphListQuery["response"]["node"]>["assets"]>>;
|
type AssetEntry = NodeOf<NonNullable<NonNullable<AssetGraphListQuery["response"]["node"]>["assets"]>>;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export const getAssetTypeVariant = (type: string) => {
|
export const getAssetTypeVariant = (type: string) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "PHYSICAL":
|
case "PHYSICAL":
|
||||||
return "warning";
|
return "neutral";
|
||||||
case "VIRTUAL":
|
case "VIRTUAL":
|
||||||
return "info";
|
return "info";
|
||||||
default:
|
default:
|
||||||
@@ -14,5 +14,6 @@ export { getRole, getRoles, peopleRoles } from "./people";
|
|||||||
export { certificationCategoryLabel, certifications } from "./certifications";
|
export { certificationCategoryLabel, certifications } from "./certifications";
|
||||||
export { availableFrameworks } from "./frameworks";
|
export { availableFrameworks } from "./frameworks";
|
||||||
export { getDocumentTypeLabel, documentTypes } from "./documents";
|
export { getDocumentTypeLabel, documentTypes } from "./documents";
|
||||||
|
export { getAssetTypeVariant, getCriticityVariant } from "./assets";
|
||||||
export { promisifyMutation } from "./relay";
|
export { promisifyMutation } from "./relay";
|
||||||
export { fileType, fileSize } from "./file";
|
export { fileType, fileSize } from "./file";
|
||||||
|
|||||||
Reference in New Issue
Block a user