diff --git a/frontend/src/components/config/index.tsx b/frontend/src/components/config/index.tsx index 985286dd4..9a5fe70a9 100644 --- a/frontend/src/components/config/index.tsx +++ b/frontend/src/components/config/index.tsx @@ -4,7 +4,7 @@ import { ConfirmUpdate, } from "@components/config/util"; import { Section } from "@components/layouts"; -import { snake_case_to_upper_space_case } from "@lib/formatting"; +import { cn } from "@lib/utils"; import { Types } from "@monitor/client"; import { Button } from "@ui/button"; import { Card, CardHeader, CardTitle, CardContent } from "@ui/card"; @@ -73,6 +73,21 @@ export const ConfigLayout = < type PrimitiveConfigArgs = { placeholder: string }; +type ConfigComponent = { + label: string; + icon?: ReactNode; + actions?: ReactNode; + hidden?: boolean; + labelHidden?: boolean; + contentHidden?: boolean; + components: { + [K in keyof Partial]: + | boolean + | PrimitiveConfigArgs + | ((value: T[K], set: (value: Partial) => void) => ReactNode); + }; +}; + export const Config = ({ config, update, @@ -91,16 +106,8 @@ export const Config = ({ selector?: ReactNode; titleOther?: ReactNode; components: Record< - string, - Record< - string, - { - [K in keyof Partial]: - | boolean - | PrimitiveConfigArgs - | ((value: T[K], set: (value: Partial) => void) => ReactNode); - } - > + string, // sidebar key + ConfigComponent[] >; }) => { const [show, setShow] = useState(keys(components)[0]); @@ -136,6 +143,7 @@ export const Config = ({ } >
+ {/** The sidebar when large */}
{keys(components).map((tab) => ( ))}
+
- {Object.entries(components[show]).map(([k, v]) => ( - - {k && ( - - {snake_case_to_upper_space_case(k)} - - )} - - set((p) => ({ ...p, ...u }))} - components={v} - disabled={disabled} - /> - - - ))} + {components[show].map( + ({ + label, + labelHidden, + icon, + actions, + hidden, + contentHidden, + components, + }) => + !hidden && ( + + {!labelHidden && ( + + + {icon} + {label} + + {actions} + + )} + {!contentHidden && ( + + set((p) => ({ ...p, ...u }))} + components={components} + disabled={disabled} + /> + + )} + + ) + )}
@@ -200,10 +236,13 @@ export const ConfigAgain = < const value = update[key] ?? config[key]; if (typeof component === "function") { return ( - {component?.(value, set)} + {component(value, set)} ); } else if (typeof component === "object" || component === true) { - const args = (typeof component === "object") ? component as PrimitiveConfigArgs : undefined; + const args = + typeof component === "object" + ? (component as PrimitiveConfigArgs) + : undefined; switch (typeof value) { case "string": return ( @@ -245,7 +284,6 @@ export const ConfigAgain = < } else if (component === false) { return ; } - })} ); diff --git a/frontend/src/components/config/util.tsx b/frontend/src/components/config/util.tsx index fdec8b1b0..f6231b0a2 100644 --- a/frontend/src/components/config/util.tsx +++ b/frontend/src/components/config/util.tsx @@ -104,11 +104,12 @@ export const DoubleInput = < leftpl, rightval, rightpl, - addName, + // addName, onLeftChange, onRightChange, - onAdd, + // onAdd, onRemove, + containerClassName, inputClassName, }: { disabled: boolean; @@ -117,15 +118,16 @@ export const DoubleInput = < leftpl: string; rightval: R; rightpl: string; - addName: string; + // addName: string; onLeftChange: (value: T[L], i: number) => void; onRightChange: (value: T[R], i: number) => void; - onAdd: () => void; + // onAdd: () => void; onRemove: (i: number) => void; + containerClassName?: string; inputClassName?: string; }) => { return ( -
+
{values?.map((value, i) => (
))} - {!disabled && ( + {/* {!disabled && ( - )} + )} */}
); }; diff --git a/frontend/src/components/resources/alerter/config.tsx b/frontend/src/components/resources/alerter/config.tsx index e5c72726c..a07fa2d55 100644 --- a/frontend/src/components/resources/alerter/config.tsx +++ b/frontend/src/components/resources/alerter/config.tsx @@ -36,12 +36,15 @@ export const AlerterConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: { type, params: update } }); }} components={{ - general: { - general: { - url: true, - enabled: true, + general: [ + { + label: "General", + components: { + url: true, + enabled: true, + }, }, - }, + ], }} selector={
diff --git a/frontend/src/components/resources/build/config.tsx b/frontend/src/components/resources/build/config.tsx index a317cba3a..952f769e0 100644 --- a/frontend/src/components/resources/build/config.tsx +++ b/frontend/src/components/resources/build/config.tsx @@ -44,135 +44,153 @@ export const BuildConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: update }); }} components={{ - general: { - general: { - version: (version, set) => { - const { major, minor, patch } = version ?? { - major: 0, - minor: 0, - patch: 0, - }; - return ( - -
-
- v{major}.{minor}.{patch} + general: [ + { + label: "General", + components: { + version: (version, set) => { + const { major, minor, patch } = version ?? { + major: 0, + minor: 0, + patch: 0, + }; + return ( + +
+
+ v{major}.{minor}.{patch} +
+ {!disabled && ( + + )} + {!disabled && ( + + )}
- {!disabled && ( - - )} - {!disabled && ( - - )} -
+ + ); + }, + builder_id: (id, set) => ( + + set({ builder_id })} + disabled={disabled} + /> - ); + ), }, - builder_id: (id, set) => ( - - ( + set({ builder_id })} + account_type="github" + selected={account} + onSelect={(github_account) => set({ github_account })} + disabled={disabled} + placeholder="None" + /> + ), + }, + }, + { + label: "Docker", + components: { + build_path: true, + dockerfile_path: true, + docker_account: (account, set) => ( + set({ docker_account })} + disabled={disabled} + placeholder="None" + /> + ), + docker_organization: + docker_organizations === undefined || + docker_organizations.length === 0 + ? undefined + : (value, set) => ( + + ), + use_buildx: true, + labels: (l, set) => ( + + ), + extra_args: (value, set) => ( + + ), + }, + }, + { + label: "Pre Build", + components: { + pre_build: (value, set) => ( + set({ pre_build: value })} disabled={disabled} /> - - ), + ), + }, }, - git: { - repo: { placeholder: "Enter repo" }, - branch: { placeholder: "Enter branch" }, - commit: { placeholder: "Enter specific commit hash. Optional." }, - github_account: (account, set) => ( - set({ github_account })} - disabled={disabled} - placeholder="None" - /> - ), + { + label: "Github Webhook", + components: { + ["build" as any]: () => ( + + + + ), + webhook_enabled: true, + }, }, - docker: { - build_path: true, - dockerfile_path: true, - docker_account: (account, set) => ( - set({ docker_account })} - disabled={disabled} - placeholder="None" - /> - ), - docker_organization: - docker_organizations === undefined || - docker_organizations.length === 0 - ? undefined - : (value, set) => ( - - ), - use_buildx: true, - labels: (l, set) => ( - - ), - extra_args: (value, set) => ( - - ), + ], + "Build Args": [ + { + label: "Build Args", + components: { + build_args: (vars, set) => ( + + ), + skip_secret_interp: true, + }, }, - pre_build: { - pre_build: (value, set) => ( - set({ pre_build: value })} - disabled={disabled} - /> - ), - }, - github_webhook: { - ["build" as any]: () => ( - - - - ), - webhook_enabled: true, - }, - }, - "Build Args": { - "Build Args": { - build_args: (vars, set) => ( - - ), - skip_secret_interp: true, - }, - }, + ], }} /> ); diff --git a/frontend/src/components/resources/builder/config.tsx b/frontend/src/components/resources/builder/config.tsx index 1d8ed7358..ec3c99300 100644 --- a/frontend/src/components/resources/builder/config.tsx +++ b/frontend/src/components/resources/builder/config.tsx @@ -32,43 +32,46 @@ const AwsBuilderConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: { type: "Aws", params: update } }); }} components={{ - general: { - general: { - region: true, - instance_type: true, - volume_gb: true, - ami_id: true, - subnet_id: true, - key_pair_name: true, - assign_public_ip: true, - use_public_ip: true, - security_group_ids: (values, set) => ( - - ), - github_accounts: (accounts, set) => ( - - ), - docker_accounts: (accounts, set) => ( - - ), - port: true, + general: [ + { + label: "General", + components: { + region: true, + instance_type: true, + volume_gb: true, + ami_id: true, + subnet_id: true, + key_pair_name: true, + assign_public_ip: true, + use_public_ip: true, + security_group_ids: (values, set) => ( + + ), + github_accounts: (accounts, set) => ( + + ), + docker_accounts: (accounts, set) => ( + + ), + port: true, + }, }, - }, + ], }} /> ); @@ -95,21 +98,24 @@ const ServerBuilderConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: { type: "Server", params: update } }); }} components={{ - general: { - general: { - server_id: (id, set) => ( -
- Select Server - set({ server_id })} - disabled={disabled} - /> -
- ), + general: [ + { + label: "General", + components: { + server_id: (id, set) => ( +
+ Select Server + set({ server_id })} + disabled={disabled} + /> +
+ ), + }, }, - }, + ], }} /> ); diff --git a/frontend/src/components/resources/common.tsx b/frontend/src/components/resources/common.tsx index 58030fd05..397dc91a4 100644 --- a/frontend/src/components/resources/common.tsx +++ b/frontend/src/components/resources/common.tsx @@ -81,11 +81,13 @@ export const ResourceSelector = ({ selected, onSelect, disabled, + align, }: { type: UsableResource; selected: string | undefined; onSelect?: (id: string) => void; disabled?: boolean; + align?: "start" | "center" | "end" }) => { const [open, setOpen] = useState(false); const [input, setInput] = useState(""); @@ -103,7 +105,7 @@ export const ResourceSelector = ({ {!disabled && } - + ) => void; disabled: boolean; }) => ( - 0 ? "items-start" : undefined} - > +
{ labels[i].variable = variable; set({ labels: [...labels] }); @@ -304,14 +304,11 @@ export const LabelsConfig = ({ labels[i].value = value; set({ labels: [...labels] }); }} - onAdd={() => - set({ labels: [...(labels ?? []), { variable: "", value: "" }] }) - } onRemove={(idx) => set({ labels: [...labels.filter((_, i) => i !== idx)] }) } /> - +
); export const CopyGithubWebhook = ({ @@ -333,10 +330,12 @@ export const ServerSelector = ({ selected, set, disabled, + align, }: { selected: string | undefined; set: (input: Partial) => void; disabled: boolean; + align?: "start" | "center" | "end" }) => ( set({ server_id })} disabled={disabled} + align={align} /> ); \ No newline at end of file diff --git a/frontend/src/components/resources/deployment/config/components/extra-args.tsx b/frontend/src/components/resources/deployment/config/components/extra-args.tsx index f43b439f4..a471a705d 100644 --- a/frontend/src/components/resources/deployment/config/components/extra-args.tsx +++ b/frontend/src/components/resources/deployment/config/components/extra-args.tsx @@ -1,4 +1,3 @@ -import { ConfigItem } from "@components/config/util"; import { useRead } from "@lib/hooks"; import { Types } from "@monitor/client"; import { Button } from "@ui/button"; @@ -25,50 +24,46 @@ export const ExtraArgs = ({ disabled: boolean; }) => { return ( - 0 ? "items-start" : undefined} - > -
- {args.map((arg, i) => ( -
- { - args[i] = e.target.value; - set({ extra_args: [...args] }); - }} - disabled={disabled} - /> - {!disabled && ( - - )} -
- ))} - - {!disabled && ( -
- - set({ extra_args: [...args, suggestion] }) +
+ {args.map((arg, i) => ( +
+ { + args[i] = e.target.value; + set({ extra_args: [...args] }); + }} + disabled={disabled} + className="w-[400px] max-w-full" + /> + {!disabled && ( +
- )} -
- + > + + + )} +
+ ))} + + {/* {!disabled && ( +
+ + set({ extra_args: [...args, suggestion] }) + } + /> +
+ )} */} +
); }; -const AddExtraArgMenu = ({ +export const AddExtraArgMenu = ({ onSelect, }: { onSelect: (suggestion: string) => void; @@ -86,7 +81,7 @@ const AddExtraArgMenu = ({ Add Extra Arg - + onSelect("")} + onSelect={() => { + onSelect(""); + setOpen(false); + }} className="w-full cursor-pointer" > Empty Extra Arg @@ -111,7 +109,10 @@ const AddExtraArgMenu = ({ {suggestions?.map((suggestion) => ( onSelect(suggestion)} + onSelect={() => { + onSelect(suggestion); + setOpen(false); + }} className="w-full overflow-hidden overflow-ellipsis cursor-pointer" > {suggestion} diff --git a/frontend/src/components/resources/deployment/config/components/ports.tsx b/frontend/src/components/resources/deployment/config/components/ports.tsx index b2bb31973..95006e953 100644 --- a/frontend/src/components/resources/deployment/config/components/ports.tsx +++ b/frontend/src/components/resources/deployment/config/components/ports.tsx @@ -1,4 +1,4 @@ -import { ConfigItem, DoubleInput } from "@components/config/util"; +import { DoubleInput } from "@components/config/util"; import { Types } from "@monitor/client"; export const PortsConfig = ({ @@ -10,18 +10,16 @@ export const PortsConfig = ({ set: (input: Partial) => void; disabled: boolean; }) => ( - 0 ? "items-start" : undefined} - > +
{ ports[i].local = local; set({ ports: [...ports] }); @@ -30,10 +28,7 @@ export const PortsConfig = ({ ports[i].container = container; set({ ports: [...ports] }); }} - onAdd={() => - set({ ports: [...(ports ?? []), { container: "", local: "" }] }) - } onRemove={(idx) => set({ ports: [...ports.filter((_, i) => i !== idx)] })} /> - +
); diff --git a/frontend/src/components/resources/deployment/config/components/volumes.tsx b/frontend/src/components/resources/deployment/config/components/volumes.tsx index ec030efd6..660db69a5 100644 --- a/frontend/src/components/resources/deployment/config/components/volumes.tsx +++ b/frontend/src/components/resources/deployment/config/components/volumes.tsx @@ -1,4 +1,4 @@ -import { ConfigItem, DoubleInput } from "@components/config/util"; +import { DoubleInput } from "@components/config/util"; import { Types } from "@monitor/client"; export const VolumesConfig = ({ @@ -10,19 +10,16 @@ export const VolumesConfig = ({ set: (input: Partial) => void; disabled: boolean; }) => ( - 0 ? "items-start" : undefined} - > +
{ volumes[i].local = local; set({ volumes: [...volumes] }); @@ -31,12 +28,9 @@ export const VolumesConfig = ({ volumes[i].container = container; set({ volumes: [...volumes] }); }} - onAdd={() => - set({ volumes: [...(volumes ?? []), { container: "", local: "" }] }) - } onRemove={(idx) => set({ volumes: [...volumes.filter((_, i) => i !== idx)] }) } /> - +
); diff --git a/frontend/src/components/resources/deployment/config/index.tsx b/frontend/src/components/resources/deployment/config/index.tsx index bb113106c..78fd74b8c 100644 --- a/frontend/src/components/resources/deployment/config/index.tsx +++ b/frontend/src/components/resources/deployment/config/index.tsx @@ -8,7 +8,7 @@ import { NetworkModeSelector } from "./components/network"; import { PortsConfig } from "./components/ports"; import { EnvVars } from "./components/environment"; import { VolumesConfig } from "./components/volumes"; -import { ExtraArgs } from "./components/extra-args"; +import { AddExtraArgMenu, ExtraArgs } from "./components/extra-args"; import { Config } from "@components/config"; import { DefaultTerminationSignal, @@ -17,8 +17,16 @@ import { } from "./components/term-signal"; import { LabelsConfig, ServerSelector } from "@components/resources/common"; import { TextUpdateMenu } from "@components/util"; +import { Button } from "@ui/button"; +import { PlusCircle } from "lucide-react"; -export const DeploymentConfig = ({ id, titleOther }: { id: string; titleOther: ReactNode }) => { +export const DeploymentConfig = ({ + id, + titleOther, +}: { + id: string; + titleOther: ReactNode; +}) => { const perms = useRead("GetPermissionLevel", { target: { type: "Deployment", id }, }).data; @@ -28,10 +36,10 @@ export const DeploymentConfig = ({ id, titleOther }: { id: string; titleOther: R if (!config) return null; - const show_ports = update.network - ? update.network !== "host" + const hide_ports = update.network + ? update.network === "host" || update.network === "none" : config.network - ? config.network !== "host" + ? config.network === "host" || config.network === "none" : false; const disabled = perms !== Types.PermissionLevel.Write; @@ -47,111 +55,226 @@ export const DeploymentConfig = ({ id, titleOther }: { id: string; titleOther: R await mutateAsync({ id, config: update }); }} components={{ - general: { - "": { - server_id: (value, set) => ( - - ), + general: [ + { + label: "Server Id", + labelHidden: true, + components: { + server_id: (value, set) => ( + + ), + }, }, - container: { - image: (value, set) => ( - - ), - docker_account: (value, set) => ( - set({ docker_account })} - disabled={disabled} - placeholder={ - (update.image?.type || config.image?.type) === "Build" - ? "Same as build" - : "None" + { + label: "Container", + components: { + image: (value, set) => ( + + ), + docker_account: (value, set) => ( + set({ docker_account })} + disabled={disabled} + placeholder={ + (update.image?.type || config.image?.type) === "Build" + ? "Same as build" + : "None" + } + /> + ), + restart: (value, set) => ( + + ), + network: (value, set) => ( + set({ network })} + disabled={disabled} + /> + ), + command: (value, set) => ( + + set({ command })} + triggerClassName="min-w-[300px] max-w-[400px]" + /> + + ), + }, + }, + { + label: "Ports", + hidden: hide_ports, + contentHidden: (update.ports ?? config.ports)?.length === 0, + actions: ( + ), - restart: (value, set) => ( - - ), - network: (value, set) => ( - set({ network })} - disabled={disabled} - /> - ), - ports: (value, set) => - show_ports && ( + components: { + ports: (value, set) => ( ), - volumes: (v, set) => ( - + }, + }, + { + label: "Volumes", + contentHidden: (update.volumes ?? config.volumes)?.length === 0, + actions: ( + ), - labels: (l, set) => ( - - ), - extra_args: (value, set) => ( - - ), - command: (value, set) => ( - - set({ command })} - triggerClassName="min-w-[300px] max-w-[400px]" + components: { + volumes: (v, set) => ( + - - ), + ), + }, }, - settings: { - send_alerts: true, - redeploy_on_build: - (update.image?.type || config.image?.type) === "Build", - }, - }, - environment: { - environment: { - environment: (vars, set) => ( - + set({ + extra_args: [ + ...(update.extra_args ?? config.extra_args ?? []), + suggestion, + ], + }) + } /> ), - skip_secret_interp: true, + components: { + extra_args: (value, set) => ( + + ), + }, }, - }, - termination: { - termination: { - termination_signal: (value, set) => ( - - ), - termination_timeout: (value, set) => ( - - ), - term_signal_labels: (value, set) => ( - + { + label: "Labels", + actions: ( + ), + components: { + labels: (l, set) => ( + + ), + }, }, - }, + { + label: "Settings", + components: { + send_alerts: true, + redeploy_on_build: + (update.image?.type || config.image?.type) === "Build", + }, + }, + ], + environment: [ + { + label: "Environment", + components: { + environment: (vars, set) => ( + + ), + skip_secret_interp: true, + }, + }, + ], + termination: [ + { + label: "Termination", + components: { + termination_signal: (value, set) => ( + + ), + termination_timeout: (value, set) => ( + + ), + term_signal_labels: (value, set) => ( + + ), + }, + }, + ], }} /> ); diff --git a/frontend/src/components/resources/repo/config.tsx b/frontend/src/components/resources/repo/config.tsx index 659f8baf1..7be54bc14 100644 --- a/frontend/src/components/resources/repo/config.tsx +++ b/frontend/src/components/resources/repo/config.tsx @@ -33,60 +33,74 @@ export const RepoConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: update }); }} components={{ - general: { - "": { - server_id: (value, set) => ( - - ), - }, - general: { - repo: { placeholder: "Enter repo" }, - branch: { placeholder: "Enter branch" }, - commit: { placeholder: "Enter specific commit hash. Optional." }, - github_account: (value, set) => { - const server_id = update.server_id || config.server_id; - if (server_id) { - return ( - - ); - } + general: [ + { + label: "Server Id", + labelHidden: true, + components: { + server_id: (value, set) => ( + + ), }, - on_clone: (value, set) => ( - set({ on_clone: value })} - disabled={disabled} - /> - ), - on_pull: (value, set) => ( - set({ on_pull: value })} - disabled={disabled} - /> - ), }, - github_webhooks: { - ["clone" as any]: () => ( - - - - ), - ["pull" as any]: () => ( - - - - ), - webhook_enabled: true, + { + label: "General", + components: { + repo: { placeholder: "Enter repo" }, + branch: { placeholder: "Enter branch" }, + commit: { placeholder: "Enter specific commit hash. Optional." }, + github_account: (value, set) => { + const server_id = update.server_id || config.server_id; + if (server_id) { + return ( + + ); + } + }, + on_clone: (value, set) => ( + set({ on_clone: value })} + disabled={disabled} + /> + ), + on_pull: (value, set) => ( + set({ on_pull: value })} + disabled={disabled} + /> + ), + }, }, - }, + { + label: "Github Webhooks", + components: { + ["clone" as any]: () => ( + + + + ), + ["pull" as any]: () => ( + + + + ), + webhook_enabled: true, + }, + }, + ], }} /> ); diff --git a/frontend/src/components/resources/server-template/config/aws.tsx b/frontend/src/components/resources/server-template/config/aws.tsx index e9d10d291..bbe467cf4 100644 --- a/frontend/src/components/resources/server-template/config/aws.tsx +++ b/frontend/src/components/resources/server-template/config/aws.tsx @@ -46,86 +46,91 @@ export const AwsServerTemplateConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: { type: "Aws", params: update } }); }} components={{ - general: { - general: { - region: true, - instance_type: true, - ami_id: true, - subnet_id: true, - key_pair_name: true, - assign_public_ip: true, - use_public_ip: true, - port: true, - security_group_ids: (values, set) => ( - - ), - volumes: (volumes, set) => { - return ( - 0 ? "items-start" : undefined} - > -
- {volumes.map((_, index) => ( -
- - {!disabled && ( - - )} -
- ))} - {!disabled && ( - - )} -
-
- ); - }, - user_data: (user_data, set) => ( - - set({ user_data })} - triggerClassName="min-w-[300px] max-w-[400px]" + general: [ + { + label: "General", + components: { + region: true, + instance_type: true, + ami_id: true, + subnet_id: true, + key_pair_name: true, + assign_public_ip: true, + use_public_ip: true, + port: true, + security_group_ids: (values, set) => ( + - - ), + ), + volumes: (volumes, set) => { + return ( + 0 ? "items-start" : undefined} + > +
+ {volumes.map((_, index) => ( +
+ + {!disabled && ( + + )} +
+ ))} + {!disabled && ( + + )} +
+
+ ); + }, + user_data: (user_data, set) => ( + + set({ user_data })} + triggerClassName="min-w-[300px] max-w-[400px]" + /> + + ), + }, }, - }, + ], }} /> ); diff --git a/frontend/src/components/resources/server/config.tsx b/frontend/src/components/resources/server/config.tsx index 6ce4b4ebe..e6690c9b1 100644 --- a/frontend/src/components/resources/server/config.tsx +++ b/frontend/src/components/resources/server/config.tsx @@ -30,37 +30,52 @@ export const ServerConfig = ({ id }: { id: string }) => { await mutateAsync({ id, config: update }); }} components={{ - general: { - general: { - address: true, - region: true, - enabled: true, - stats_monitoring: true, - auto_prune: true, + general: [ + { + label: "General", + components: { + address: true, + region: true, + enabled: true, + stats_monitoring: true, + auto_prune: true, + }, }, - }, - alerts: { - alerts: { - send_unreachable_alerts: true, - send_cpu_alerts: true, - send_disk_alerts: true, - send_mem_alerts: true, + ], + alerts: [ + { + label: "Alerts", + components: { + send_unreachable_alerts: true, + send_cpu_alerts: true, + send_disk_alerts: true, + send_mem_alerts: true, + }, }, - }, - warnings: { - cpu: { - cpu_warning: true, - cpu_critical: true, + ], + warnings: [ + { + label: "Cpu", + components: { + cpu_warning: true, + cpu_critical: true, + }, }, - memory: { - mem_warning: true, - mem_critical: true, + { + label: "Memory", + components: { + mem_warning: true, + mem_critical: true, + }, }, - disk: { - disk_warning: true, - disk_critical: true, + { + label: "Disk", + components: { + disk_warning: true, + disk_critical: true, + }, }, - }, + ], }} /> );