diff --git a/client/core/ts/src/types.ts b/client/core/ts/src/types.ts index 4094d1360..0ca2c983e 100644 --- a/client/core/ts/src/types.ts +++ b/client/core/ts/src/types.ts @@ -127,6 +127,7 @@ export interface BuildConfig { build_path: string; dockerfile_path: string; build_args?: EnvironmentVar[]; + labels?: EnvironmentVar[]; extra_args?: string[]; use_buildx?: boolean; } @@ -228,6 +229,7 @@ export interface DeploymentConfig { ports?: Conversion[]; volumes?: Conversion[]; environment?: EnvironmentVar[]; + labels?: EnvironmentVar[]; network: string; restart?: RestartMode; process_args?: string; @@ -515,6 +517,7 @@ export interface ContainerSummary { name: string; id: string; image: string; + labels: Record; state: DockerContainerState; status?: string; } diff --git a/frontend/src/components/resources/build/config.tsx b/frontend/src/components/resources/build/config.tsx index e4948195a..f7f8cd3bb 100644 --- a/frontend/src/components/resources/build/config.tsx +++ b/frontend/src/components/resources/build/config.tsx @@ -19,7 +19,7 @@ import { import { Textarea } from "@ui/textarea"; import { MinusCircle, PlusCircle } from "lucide-react"; import { useEffect, useState } from "react"; -import { ResourceSelector } from "../common"; +import { LabelsConfig, ResourceSelector } from "../common"; export const BuildConfig = ({ id }: { id: string }) => { const config = useRead("GetBuild", { build: id }).data?.config; @@ -117,7 +117,7 @@ export const BuildConfig = ({ id }: { id: string }) => { ), use_buildx: true, - // docker_organization, + labels: (l, set) => , extra_args: (value, set) => ( ), diff --git a/frontend/src/components/resources/common.tsx b/frontend/src/components/resources/common.tsx index 261b5bf7a..ae1d7f89a 100644 --- a/frontend/src/components/resources/common.tsx +++ b/frontend/src/components/resources/common.tsx @@ -39,6 +39,8 @@ import { ResourceComponents } from "."; import { Input } from "@ui/input"; import { useToast } from "@ui/use-toast"; import { NewLayout } from "@components/layouts"; +import { Types } from "@monitor/client"; +import { ConfigItem, DoubleInput } from "@components/config/util"; export const ResourceDescription = ({ type, @@ -293,3 +295,36 @@ export const DeleteResource = ({ ); }; + +export const LabelsConfig = ({ + labels, + set, +}: { + labels: Types.EnvironmentVar[]; + set: (input: Partial) => void; +}) => ( + + { + labels[i].variable = variable; + set({ labels: [...labels] }); + }} + onRightChange={(value, i) => { + labels[i].value = value; + set({ labels: [...labels] }); + }} + onAdd={() => + set({ labels: [...(labels ?? []), { variable: "", value: "" }] }) + } + onRemove={(idx) => + set({ labels: [...labels.filter((_, i) => i !== idx)] }) + } + /> + +); \ No newline at end of file diff --git a/frontend/src/components/resources/deployment/config/index.tsx b/frontend/src/components/resources/deployment/config/index.tsx index 13783a577..d60740e28 100644 --- a/frontend/src/components/resources/deployment/config/index.tsx +++ b/frontend/src/components/resources/deployment/config/index.tsx @@ -19,7 +19,7 @@ import { TermSignalLabels, TerminationTimeout, } from "./components/term-signal"; -import { ResourceSelector } from "@components/resources/common"; +import { LabelsConfig, ResourceSelector } from "@components/resources/common"; export const ServerSelector = ({ selected, @@ -94,13 +94,15 @@ export const DeploymentConfig = ({ id }: { id: string }) => { ports: (value, set) => show_ports && , volumes: (v, set) => , + labels: (l, set) => , extra_args: (value, set) => ( ), }, settings: { send_alerts: true, - redeploy_on_build: (update.image?.type || config.image?.type) === "Build", + redeploy_on_build: + (update.image?.type || config.image?.type) === "Build", }, }, environment: {