From 7f94bfc4c5c6516a99702a42a1cd47ee2f628955 Mon Sep 17 00:00:00 2001 From: Alan Greene Date: Wed, 18 May 2022 14:32:29 +0100 Subject: [PATCH] Support custom tooltips for PipelineRun display name By default the tooltip displayed when hovering on the PipelineRun display name will be the same content returned by `getPipelineRunDisplayName`. However, if consumers are providing rich content for this the tooltip will be displayed incorrectly as `[object Object]`. To support these cases, add an extra `getPipelineRunDisplayNameTooltip` prop which can be used to override the default behaviour and provide a plain text value for the tooltip. --- .../components/src/components/PipelineRuns/PipelineRuns.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/components/src/components/PipelineRuns/PipelineRuns.js b/packages/components/src/components/PipelineRuns/PipelineRuns.js index f1269ade5..c10e9e820 100644 --- a/packages/components/src/components/PipelineRuns/PipelineRuns.js +++ b/packages/components/src/components/PipelineRuns/PipelineRuns.js @@ -51,6 +51,7 @@ const PipelineRuns = ({ pipelineRun.metadata.creationTimestamp, getPipelineRunDisplayName = ({ pipelineRunMetadata }) => pipelineRunMetadata.name, + getPipelineRunDisplayNameTooltip = getPipelineRunDisplayName, getPipelineRunDuration = pipelineRun => { const creationTimestamp = getPipelineRunCreatedTime(pipelineRun); const { lastTransitionTime, status } = getStatus(pipelineRun); @@ -170,6 +171,9 @@ const PipelineRuns = ({ const pipelineRunName = getPipelineRunDisplayName({ pipelineRunMetadata: pipelineRun.metadata }); + const pipelineRunNameTooltip = getPipelineRunDisplayNameTooltip({ + pipelineRunMetadata: pipelineRun.metadata + }); const pipelineRefName = pipelineRun.spec.pipelineRef && pipelineRun.spec.pipelineRef.name; const { reason, status } = getStatus(pipelineRun); @@ -208,7 +212,7 @@ const PipelineRuns = ({ {pipelineRunName}