From c0fde4ac57a5a280d7335dd7baa504190b4cb1d2 Mon Sep 17 00:00:00 2001 From: Pietocha Date: Fri, 10 Jan 2025 13:59:35 +0100 Subject: [PATCH] PR Correction --- .../Extensibility/components/Badge.js | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/components/Extensibility/components/Badge.js b/src/components/Extensibility/components/Badge.js index 2d5c8f1eb2..0405c5d1cf 100644 --- a/src/components/Extensibility/components/Badge.js +++ b/src/components/Extensibility/components/Badge.js @@ -38,17 +38,6 @@ export function Badge({ arrayItems, }); - const getLatestStatusMessage = (resource, defaultValue) => { - const getTime = date => new Date(date)?.getTime(); - const latestStatus = resource?.status?.conditions?.reduce((prev, current) => - prev && - getTime(prev.lastTransitionTime) > getTime(current.lastTransitionTime) - ? prev - : current, - ); - return latestStatus?.message ?? defaultValue; - }; - const [tooltip, tooltipError] = jsonata(structure?.description); let type = null; @@ -82,17 +71,23 @@ export function Badge({ type = TYPE_FALLBACK.get(type) || type; + const getTooltipContent = description => { + if (tooltip && !tooltipError) { + return tooltip; + } + if (!tooltip && !tooltipError) { + return ''; + } + return description; + }; + return isNil(value) ? ( emptyLeafPlaceholder ) : structure?.description ? ( {tExt(value)}