diff --git a/ui-v2/src/components/deployments/deployment-configuration.tsx b/ui-v2/src/components/deployments/deployment-configuration.tsx new file mode 100644 index 0000000000000..79128a9ad1133 --- /dev/null +++ b/ui-v2/src/components/deployments/deployment-configuration.tsx @@ -0,0 +1,26 @@ +import { Deployment } from "@/api/deployments"; +import { JsonInput } from "../ui/json-input"; +import { Typography } from "../ui/typography"; + +type DeploymentConfigurationProps = { + deployment: Deployment; +}; + +export const DeploymentConfiguration = ({ + deployment, +}: DeploymentConfigurationProps) => { + const jobVariablesDisplay = JSON.stringify( + deployment.job_variables ?? {}, + null, + 2, + ); + const pullStepsDisplay = JSON.stringify(deployment.pull_steps ?? [], null, 2); + return ( +
+ Job Variables + + Pull Steps + +
+ ); +}; diff --git a/ui-v2/src/components/deployments/deployment-details-tabs.tsx b/ui-v2/src/components/deployments/deployment-details-tabs.tsx index 8eda492f694a9..9a7afb26e6b60 100644 --- a/ui-v2/src/components/deployments/deployment-details-tabs.tsx +++ b/ui-v2/src/components/deployments/deployment-details-tabs.tsx @@ -4,6 +4,7 @@ import type { DeploymentDetailsTabOptions } from "@/routes/deployments/deploymen import { Link, getRouteApi } from "@tanstack/react-router"; import { type JSX } from "react"; +import { DeploymentConfiguration } from "./deployment-configuration"; import { DeploymentDescription } from "./deployment-description"; const routeApi = getRouteApi("/deployments/deployment/$id"); @@ -71,7 +72,7 @@ export const DeploymentDetailsTabs = ({ ), ViewComponent: () => ( -
{""}
+
), }, diff --git a/ui-v2/src/components/ui/icons/constants.ts b/ui-v2/src/components/ui/icons/constants.ts index 2edf06019b091..53c626a478a53 100644 --- a/ui-v2/src/components/ui/icons/constants.ts +++ b/ui-v2/src/components/ui/icons/constants.ts @@ -15,6 +15,7 @@ import { CircleArrowOutUpRight, CircleCheck, Clock, + Copy, Cpu, EllipsisVertical, ExternalLink, @@ -54,6 +55,7 @@ export const ICONS = { CircleArrowOutUpRight, CircleCheck, Clock, + Copy, Cpu, EllipsisVertical, ExternalLink, diff --git a/ui-v2/src/components/ui/json-input.tsx b/ui-v2/src/components/ui/json-input.tsx index 3dcf668b83e04..b231aaed9f5c0 100644 --- a/ui-v2/src/components/ui/json-input.tsx +++ b/ui-v2/src/components/ui/json-input.tsx @@ -1,5 +1,6 @@ import React, { useRef, useEffect } from "react"; +import { useToast } from "@/hooks/use-toast"; import { cn } from "@/lib/utils"; import { json } from "@codemirror/lang-json"; import { @@ -7,6 +8,8 @@ import { EditorView, useCodeMirror, } from "@uiw/react-codemirror"; +import { Button } from "./button"; +import { Icon } from "./icons"; const extensions = [json(), EditorView.lineWrapping]; @@ -17,6 +20,7 @@ type JsonInputProps = React.ComponentProps<"div"> & { disabled?: boolean; className?: string; hideLineNumbers?: boolean; + copy?: boolean; }; export const JsonInput = React.forwardRef( @@ -25,6 +29,7 @@ export const JsonInput = React.forwardRef( className, value, onChange, + copy = false, onBlur, disabled, hideLineNumbers = false, @@ -32,6 +37,7 @@ export const JsonInput = React.forwardRef( }, forwardedRef, ) => { + const { toast } = useToast(); const editor = useRef(null); // Setting `basicSetup` messes up the tab order. We only change the basic setup // if the input is disabled, so we leave it undefined to maintain the tab order. @@ -61,10 +67,15 @@ export const JsonInput = React.forwardRef( } }, [setContainer]); + const handleCopy = (_value: string) => { + toast({ title: "Copied to clipboard" }); + void navigator.clipboard.writeText(_value); + }; + return (
{ @@ -76,7 +87,19 @@ export const JsonInput = React.forwardRef( } }} {...props} - /> + > + {copy && value && ( + + )} +
); }, );