From 122b81a8a3df6664916a46246a9b13896c2038ca Mon Sep 17 00:00:00 2001 From: Remington Breeze Date: Thu, 30 Nov 2023 14:00:45 -0800 Subject: [PATCH] fix(ui): display proper available freight for promote-subscribers (#1200) Signed-off-by: Remington Breeze --- ui/src/features/common/freight-label.tsx | 4 +++- ui/src/features/freightline/freightline.tsx | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ui/src/features/common/freight-label.tsx b/ui/src/features/common/freight-label.tsx index 1ad01b750..925487771 100644 --- a/ui/src/features/common/freight-label.tsx +++ b/ui/src/features/common/freight-label.tsx @@ -14,5 +14,7 @@ export const FreightLabel = ({ freight }: { freight?: Freight }) => { setId(freight?.metadata?.name?.substring(0, 7) || 'N/A'); }, [freight]); - return <>{alias ? {alias} : <>{id}}; + return ( + {alias ? {alias} : <>{id}} + ); }; diff --git a/ui/src/features/freightline/freightline.tsx b/ui/src/features/freightline/freightline.tsx index 407afc629..fb14dd741 100644 --- a/ui/src/features/freightline/freightline.tsx +++ b/ui/src/features/freightline/freightline.tsx @@ -97,11 +97,15 @@ export const Freightline = (props: { }, [promotingStage, freight, promotionType]); useEffect(() => { - if (!isLoading) { + if (!isLoading && promotingStage !== undefined) { + const initFreight = availableFreightData?.groups['']?.freight || []; const availableFreight = promotionType === 'default' - ? availableFreightData?.groups['']?.freight || [] - : promotingStage?.status?.history || []; + ? initFreight + : initFreight.filter( + (f) => !!f?.status?.verifiedIn[promotingStage?.metadata?.name || ''] + ); + const pe: { [key: string]: boolean } = {}; ((availableFreight as Freight[]) || []).map((f: Freight) => { const name = promotionType === 'default' ? f?.metadata?.name : f?.id; @@ -373,7 +377,7 @@ const FreightItem = (props: {