diff --git a/src/components/flow/flow-toolbar.tsx b/src/components/flow/flow-toolbar.tsx index 4297e2af..ddf71228 100644 --- a/src/components/flow/flow-toolbar.tsx +++ b/src/components/flow/flow-toolbar.tsx @@ -123,16 +123,6 @@ export function FlowToolbar({ const queryClient = useQueryClient(); const { data: session } = useSession(); - const healthQuery = useQuery( - trpc.pipeline.health.queryOptions( - { pipelineId: pipelineId! }, - { enabled: !!pipelineId && !isDraft && !!deployedAt, refetchInterval: 30_000 }, - ), - ); - const healthStatus = healthQuery.data?.status ?? null; - const sliTotal = healthQuery.data?.slis?.length ?? 0; - const slisBreached = healthQuery.data?.slis?.filter((s: { status: string }) => s.status === "breached").length ?? 0; - // Query pending deploy requests for this pipeline const pendingRequestsQuery = useQuery({ ...trpc.deploy.listPendingRequests.queryOptions({ pipelineId: pipelineId! }), @@ -470,19 +460,6 @@ export function FlowToolbar({ {processStatus === "CRASHED" && "Crashed"} {processStatus === "PENDING" && "Pending..."} - {/* Health SLI badge */} - {healthStatus === "healthy" && ( - - - SLIs: OK - - )} - {healthStatus === "degraded" && ( - - - SLIs: {slisBreached}/{sliTotal} breached - - )} )} diff --git a/src/components/flow/pipeline-settings.tsx b/src/components/flow/pipeline-settings.tsx index 8b874c3c..40d8f09e 100644 --- a/src/components/flow/pipeline-settings.tsx +++ b/src/components/flow/pipeline-settings.tsx @@ -331,6 +331,16 @@ function SliSettings({ pipelineId }: { pipelineId: string }) { ); const slis = slisQuery.data ?? []; + const healthQuery = useQuery( + trpc.pipeline.health.queryOptions( + { pipelineId }, + { enabled: slis.length > 0, refetchInterval: 30_000 }, + ), + ); + const sliStatuses = new Map( + (healthQuery.data?.slis ?? []).map((s: { metric: string; status: string }) => [s.metric, s.status]), + ); + const [sliOpen, setSliOpen] = useState(false); const [newMetric, setNewMetric] = useState("error_rate"); const [newCondition, setNewCondition] = useState("lt"); @@ -412,14 +422,23 @@ function SliSettings({ pipelineId }: { pipelineId: string }) { key={sli.id} className="flex items-center justify-between rounded-md border px-3 py-2 text-xs" > -
- {metricLabel(sli.metric)}{" "} - - {sli.condition === "lt" ? "<" : ">"} {sli.threshold} - {" "} - - ({sli.windowMinutes}m) - +
+ {sliStatuses.has(sli.metric) && ( + + )} +
+ {metricLabel(sli.metric)}{" "} + + {sli.condition === "lt" ? "<" : ">"} {sli.threshold} + {" "} + + ({sli.windowMinutes}m) + +
- - + + {version.changelog || "No changelog"} diff --git a/src/server/routers/pipeline.ts b/src/server/routers/pipeline.ts index a0a1d874..c1b9457d 100644 --- a/src/server/routers/pipeline.ts +++ b/src/server/routers/pipeline.ts @@ -788,7 +788,7 @@ export const pipelineRouter = router({ if (!latestVersion.nodesSnapshot || !latestVersion.edgesSnapshot) { throw new TRPCError({ code: "PRECONDITION_FAILED", - message: "Deployed version has no snapshot — deploy once more to enable discard", + message: "Deploy once more to enable discard — this version predates snapshot support", }); }