From d4a2ea0dcc2f48ef044ab3d110793dad66fb4616 Mon Sep 17 00:00:00 2001 From: Remington Breeze Date: Tue, 6 Aug 2024 14:56:00 -0700 Subject: [PATCH] chore(ui): remove references to legacy fields from pre 0.8 Signed-off-by: Remington Breeze --- .../features/project/pipelines/pipelines.tsx | 12 ++------ .../pipelines/utils/use-pipeline-graph.ts | 28 ++----------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/ui/src/features/project/pipelines/pipelines.tsx b/ui/src/features/project/pipelines/pipelines.tsx index 136cf0265..711e71b74 100644 --- a/ui/src/features/project/pipelines/pipelines.tsx +++ b/ui/src/features/project/pipelines/pipelines.tsx @@ -133,7 +133,6 @@ export const Pipelines = ({ project }: { project: Project }) => { allFreight.forEach((f) => { if ( !selectedWarehouse || - f.warehouse === selectedWarehouse || (f?.origin?.kind === 'Warehouse' && f?.origin.name === selectedWarehouse) ) { filteredFreight.push(f); @@ -192,12 +191,6 @@ export const Pipelines = ({ project }: { project: Project }) => { } stagesPerFreight[f.name || ''].push(stage); }); - stage?.spec?.subscriptions?.upstreamStages.forEach((item) => { - if (!subscribersByStage[item.name || '']) { - subscribersByStage[item.name || ''] = new Set(); - } - subscribersByStage[item.name || ''].add(stage?.metadata?.name || ''); - }); stage?.spec?.requestedFreight?.forEach((item) => { if (!item.sources?.direct) { (item?.sources?.stages || []).forEach((name) => { @@ -414,11 +407,10 @@ export const Pipelines = ({ project }: { project: Project }) => { (acc, cur) => acc || cur?.origin?.kind === 'Warehouse', false ); - let currentWarehouse = currentFreight[0]?.warehouse || ''; - if (currentWarehouse === '' && isWarehouseKind) { + let currentWarehouse = ''; + if (isWarehouseKind) { currentWarehouse = currentFreight[0]?.origin?.name || - node.data?.spec?.subscriptions?.warehouse || node.data?.spec?.requestedFreight[0]?.origin?.name || ''; } diff --git a/ui/src/features/project/pipelines/utils/use-pipeline-graph.ts b/ui/src/features/project/pipelines/utils/use-pipeline-graph.ts index 20222b280..4fdc490e9 100644 --- a/ui/src/features/project/pipelines/utils/use-pipeline-graph.ts +++ b/ui/src/features/project/pipelines/utils/use-pipeline-graph.ts @@ -2,7 +2,7 @@ import { graphlib, layout } from 'dagre'; import { useMemo } from 'react'; import { ColorMap, getColors } from '@ui/features/stage/utils'; -import { FreightRequest, Stage, Warehouse } from '@ui/gen/v1alpha1/generated_pb'; +import { Stage, Warehouse } from '@ui/gen/v1alpha1/generated_pb'; import { AnyNodeType, @@ -35,22 +35,7 @@ const initializeNodes = ( const nodes = stages.slice().flatMap((stage) => { const n = initNodeArray(stage); - let requestedFreight = stage.spec?.requestedFreight; - const legacySubscription = stage.spec?.subscriptions?.warehouse; - if (!requestedFreight || (stage.spec?.requestedFreight?.length === 0 && legacySubscription)) { - requestedFreight = [ - { - origin: { - kind: 'Warehouse', - name: legacySubscription - }, - sources: { - direct: true - } - } - ] as FreightRequest[]; - } - + const requestedFreight = stage.spec?.requestedFreight; (requestedFreight || []).forEach((f) => { if (f?.origin?.kind === 'Warehouse' && f?.sources?.direct) { const warehouseName = f.origin?.name; @@ -145,15 +130,6 @@ export const usePipelineGraph = ( }); } }); - - (stage?.spec?.subscriptions?.upstreamStages || []).forEach((upstreamStage, i) => { - g.setEdge( - String(subscriberIndexCache.get(upstreamStage.name || '', myNodes)), - String(index), - {}, - String(`${upstreamStage.name || ''} ${curStageName} ${i}`) - ); - }); } else if (item.type === NodeType.WAREHOUSE) { // this is a warehouse node let i = 0;