Skip to content

Commit d0cae98

Browse files
feat: update stack visualization (#918)
1 parent a5d6148 commit d0cae98

File tree

20 files changed

+251
-241
lines changed

20 files changed

+251
-241
lines changed

src/app/deployments/[deploymentId]/_components/code-collapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function DeploymentCodeContent({ deployment }: Props) {
6060

6161
return (
6262
<CollapsiblePanel open={open} onOpenChange={setOpen}>
63-
<CollapsibleHeader className="flex items-center gap-[10px]">
63+
<CollapsibleHeader className="flex h-9 items-center gap-[10px]">
6464
<CollapsibleTrigger className="flex w-full gap-2">
6565
<CollapsibleChevron open={open} />
6666
Invocation

src/app/deployments/[deploymentId]/_components/deployment-detail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function DeploymentDetailContent({ deployment }: Props) {
3535

3636
return (
3737
<CollapsiblePanel open={open} onOpenChange={setOpen}>
38-
<CollapsibleHeader className="flex items-center gap-[10px]">
38+
<CollapsibleHeader className="flex h-9 items-center gap-[10px]">
3939
<CollapsibleTrigger className="flex w-full gap-2">
4040
<CollapsibleChevron open={open} />
4141
Details

src/app/deployments/[deploymentId]/_components/endpoint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function EndpointCollapsibleContent({ deployment }: Props) {
2727

2828
return (
2929
<CollapsiblePanel open={open} onOpenChange={setOpen}>
30-
<CollapsibleHeader className="flex items-center gap-[10px]">
30+
<CollapsibleHeader className="flex h-9 items-center gap-[10px]">
3131
<CollapsibleTrigger className="flex w-full gap-2">
3232
<CollapsibleChevron open={open} />
3333
Endpoint

src/app/deployments/[deploymentId]/_components/stack-collapsible.tsx

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1+
import AlertCircle from "@/assets/icons/alert-circle.svg?react";
12
import { CollapsibleCard } from "@/components/CollapsibleCard";
2-
import { StackInfo } from "@/components/stacks/info";
3+
import { EmptyState } from "@/components/EmptyState";
4+
import { StackInfoFull } from "@/components/stacks/info/stack-info-full";
35
import { pipelineSnapshotQueries } from "@/data/pipeline-snapshots";
46
import { useStack } from "@/data/stacks/stack-detail-query";
57
import { Deployment } from "@/types/deployments";
68
import { PipelineSnapshot } from "@/types/pipeline-snapshots";
79
import { useQuery } from "@tanstack/react-query";
810
import { Skeleton } from "@zenml-io/react-component-library";
9-
import { AlertEmptyState } from "./common";
1011
import { DeploymentDetailWrapper } from "./fetch-wrapper";
1112

1213
type DeploymentStackCollapsibleContentProps = {
1314
deployment: Deployment;
1415
};
1516

1617
export function DeploymentStackCollapsible() {
17-
return <DeploymentDetailWrapper Component={DeploymentStackCollapsibleWrapper} />;
18-
}
19-
20-
function DeploymentStackCollapsibleWrapper({ deployment }: DeploymentStackCollapsibleContentProps) {
21-
return (
22-
<CollapsibleCard title="Stack" initialOpen={true}>
23-
<DeploymentStackCollapsibleContent deployment={deployment} />
24-
</CollapsibleCard>
25-
);
18+
return <DeploymentDetailWrapper Component={DeploymentStackCollapsibleContent} />;
2619
}
2720

2821
function DeploymentStackCollapsibleContent({ deployment }: DeploymentStackCollapsibleContentProps) {
@@ -46,7 +39,7 @@ function DeploymentStackCollapsibleWithSnapshot({ snapshotId }: { snapshotId: st
4639

4740
if (snapshotQuery.isError) {
4841
return (
49-
<AlertEmptyState
42+
<StackCollapsibleEmptyState
5043
title="Unable to get Stack"
5144
subtitle="Something went wrong fetching the deployment snapshot"
5245
/>
@@ -77,8 +70,8 @@ function DeploymentStackCollapsibleStackSection({
7770

7871
if (stackQuery.isError) {
7972
return (
80-
<AlertEmptyState
81-
title="Unable to get Stack"
73+
<StackCollapsibleEmptyState
74+
title="Failed to fetch the stack"
8275
subtitle="Something went wrong fetching the stack"
8376
/>
8477
);
@@ -88,12 +81,28 @@ function DeploymentStackCollapsibleStackSection({
8881

8982
const snapshotConfig = snapshot.metadata?.pipeline_configuration.settings || {};
9083

91-
return <StackInfo displayInfoBox={false} stack={stack} objectConfig={snapshotConfig} />;
84+
return <StackInfoFull stack={stack} objectConfig={snapshotConfig} />;
85+
}
86+
87+
function StackCollapsibleEmptyState({ title, subtitle }: { title: string; subtitle?: string }) {
88+
return (
89+
<CollapsibleCard title="Stack" initialOpen={true}>
90+
<EmptyState
91+
className="p-5"
92+
icon={<AlertCircle className="h-[60px] w-[60px] fill-neutral-300" />}
93+
>
94+
<div className="text-center">
95+
<p className="text-text-lg font-semibold">{title}</p>
96+
{subtitle && <p className="text-text-md text-theme-text-secondary">{subtitle}</p>}
97+
</div>
98+
</EmptyState>
99+
</CollapsibleCard>
100+
);
92101
}
93102

94103
function NoStackEmptyState() {
95104
return (
96-
<AlertEmptyState
105+
<StackCollapsibleEmptyState
97106
title="No Stack"
98107
subtitle="There is no stack associated with this deployment."
99108
/>

src/app/snapshots/[snapshotId]/_components/snapshot-detail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function DetailsContent({ snapshot }: Props) {
4141

4242
return (
4343
<CollapsiblePanel open={open} onOpenChange={setOpen}>
44-
<CollapsibleHeader className="flex items-center gap-[10px]">
44+
<CollapsibleHeader className="flex h-9 items-center gap-[10px]">
4545
<CollapsibleTrigger className="flex w-full gap-2">
4646
<CollapsibleChevron open={open} />
4747
Details

src/app/snapshots/[snapshotId]/_components/snapshot-stack-content.tsx

Lines changed: 0 additions & 57 deletions
This file was deleted.

src/app/snapshots/[snapshotId]/_components/snapshot-stack.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import { StackInfoFull } from "@/components/stacks/info/stack-info-full";
12
import { pipelineSnapshotQueries } from "@/data/pipeline-snapshots";
23
import { stackQueries } from "@/data/stacks";
34
import { useQuery } from "@tanstack/react-query";
45
import { Skeleton } from "@zenml-io/react-component-library/components/server";
56
import { useParams } from "react-router-dom";
6-
import { StackContent } from "./snapshot-stack-content";
77

88
export function SnapshotStack() {
99
const { snapshotId } = useParams() as {
@@ -39,5 +39,5 @@ export function SnapshotStack() {
3939
return <div>Failed to load stack.</div>;
4040
}
4141

42-
return <StackContent stack={stackQuery.data} />;
42+
return <StackInfoFull stack={stackQuery.data} objectConfig={{}} />;
4343
}

src/components/CollapsibleCard.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import ChevronDown from "@/assets/icons/chevron-down.svg?react";
21
import {
32
CollapsibleContent,
43
CollapsibleHeader,
@@ -8,6 +7,7 @@ import {
87
} from "@zenml-io/react-component-library";
98
import { cn } from "@zenml-io/react-component-library/utilities";
109
import { useState } from "react";
10+
import { CollapsibleChevron } from "./collapsible-chevron";
1111
import { CopyMetadataButton } from "./copy-metadata-button";
1212

1313
type CollapsibleCardProps = {
@@ -35,12 +35,8 @@ export function CollapsibleCard({
3535
return (
3636
<CollapsiblePanel className={className} open={open} onOpenChange={setOpen}>
3737
<CollapsibleHeader intent={intent} className={headerClassName}>
38-
<CollapsibleTrigger className="flex w-full items-center gap-[10px]">
39-
<ChevronDown
40-
className={` ${
41-
open ? "" : "-rotate-90"
42-
} h-5 w-5 rounded-md fill-neutral-500 transition-transform duration-200 hover:bg-neutral-200`}
43-
/>
38+
<CollapsibleTrigger className="flex flex-1 items-center gap-[10px]">
39+
<CollapsibleChevron open={open} />
4440
{title}
4541
</CollapsibleTrigger>
4642

@@ -59,7 +55,7 @@ export function CollapsibleCard({
5955
);
6056
}
6157

62-
type Props = Omit<CollapsibleCardProps, "headerChildren"> & {
58+
type Props = CollapsibleCardProps & {
6359
copyText: string;
6460
displayCopyButton?: boolean;
6561
};
@@ -69,6 +65,7 @@ export function CollapsibleCardWithCopy({
6965
displayCopyButton = true,
7066
headerClassName,
7167
className,
68+
headerChildren,
7269
...props
7370
}: Props) {
7471
return (
@@ -80,7 +77,9 @@ export function CollapsibleCardWithCopy({
8077
headerClassName
8178
)}
8279
headerChildren={
83-
displayCopyButton ? (
80+
headerChildren ? (
81+
headerChildren
82+
) : displayCopyButton ? (
8483
<div className="opacity-100 transition-opacity duration-200 lg:opacity-0 lg:group-hover:opacity-100">
8584
<CopyMetadataButton copyText={copyText} />
8685
</div>

src/components/NestedCollapsible.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Props = {
2323
sortKeysAlphabetically?: boolean;
2424
className?: string;
2525
schema?: JSONSchemaDefinition;
26+
headerChildren?: ReactNode;
2627
};
2728

2829
const regex = /^<class\s+'.*'>$/;
@@ -36,7 +37,8 @@ export function NestedCollapsible({
3637
className,
3738
children,
3839
isInitialOpen = false,
39-
sortKeysAlphabetically = true
40+
sortKeysAlphabetically = true,
41+
headerChildren
4042
}: PropsWithChildren<Props>) {
4143
const objects: { [key: string]: Record<string, unknown> } = {};
4244
const nonObjects: { [key: string]: unknown } = {};
@@ -62,6 +64,7 @@ export function NestedCollapsible({
6264

6365
return (
6466
<CollapsibleCardWithCopy
67+
headerChildren={headerChildren}
6568
contentClassName={contentClassName}
6669
initialOpen={isInitialOpen}
6770
intent={intent}

src/components/runs/detail-tabs/Configuration/DockerImageCollapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function DockerImageCollapsible({ data, displayCopyButton = true }: Props
2525

2626
return (
2727
<CollapsiblePanel open={open} onOpenChange={setOpen}>
28-
<CollapsibleHeader intent="primary" className="flex items-center gap-[10px]">
28+
<CollapsibleHeader intent="primary" className="flex h-9 items-center gap-[10px]">
2929
<CollapsibleTrigger className="flex w-full items-center gap-[10px]">
3030
<ChevronDown
3131
className={` ${

0 commit comments

Comments
 (0)