Skip to content

Commit 000edde

Browse files
feat: display deployment in Run Detail (#919)
1 parent 6701b07 commit 000edde

File tree

3 files changed

+740
-48
lines changed

3 files changed

+740
-48
lines changed

src/components/runs/detail-tabs/Overview/Details.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
} from "@zenml-io/react-component-library";
2828
import { useEffect, useState } from "react";
2929
import { useNavigate, useSearchParams } from "react-router-dom";
30+
import { DeploymentTag } from "./deployment-tag";
3031

3132
type Props = {
3233
runId: string;
@@ -57,6 +58,7 @@ export function Details({ runId }: Props) {
5758
const executionMode = data.metadata?.config.execution_mode;
5859

5960
const sourceSnapshot = data.resources?.source_snapshot;
61+
const deploymentId = data.metadata?.trigger_info?.deployment_id;
6062
const schedule = data.resources?.schedule;
6163

6264
return (
@@ -128,6 +130,11 @@ export function Details({ runId }: Props) {
128130
)
129131
}
130132
/>
133+
134+
<KeyValue
135+
label="Deployment"
136+
value={deploymentId ? <DeploymentTag deploymentId={deploymentId} /> : "Not available"}
137+
/>
131138
<Key>Execution Mode</Key>
132139
<Value>{executionMode ? snakeCaseToTitleCase(executionMode) : "Not available"}</Value>
133140
<Key>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { DeploymentStatusTag } from "@/components/deployments/deployment-status-tag";
2+
import { deploymentQueries } from "@/data/deployments";
3+
import { routes } from "@/router/routes";
4+
import { useQuery } from "@tanstack/react-query";
5+
import { Skeleton } from "@zenml-io/react-component-library";
6+
import { Link } from "react-router-dom";
7+
8+
type Props = {
9+
deploymentId: string;
10+
};
11+
12+
export function DeploymentTag({ deploymentId }: Props) {
13+
const deploymentQuery = useQuery(deploymentQueries.detail(deploymentId));
14+
15+
if (deploymentQuery.isPending) return <Skeleton className="h-6 w-[100px]" />;
16+
if (deploymentQuery.isError) return "Not available";
17+
18+
const deployment = deploymentQuery.data;
19+
20+
return (
21+
<Link to={routes.projects.deployments.detail.overview(deploymentId)}>
22+
<DeploymentStatusTag size="sm" status={deployment.body?.status ?? undefined} />
23+
</Link>
24+
);
25+
}

0 commit comments

Comments
 (0)