From 947d8b283ae2b2e8abbd2c2b8a494e3317e5fa16 Mon Sep 17 00:00:00 2001 From: Nitin Dhevar <46418326+nitin-dhevar@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:20:37 -0500 Subject: [PATCH] ACM-14718: Render internal line breaks in hive's ProvisionFailed status condition message (#4235) * adding formatting for hive ProvisionFailed Status Signed-off-by: Nitin Dhevar * pushing prow check fix Signed-off-by: Nitin Dhevar * fixing display lines count in hive log Signed-off-by: Nitin Dhevar --------- Signed-off-by: Nitin Dhevar --- .../ManagedClusters/components/HiveNotification.tsx | 12 +++++++++++- frontend/src/ui-components/AcmAlert/AcmAlert.tsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/HiveNotification.tsx b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/HiveNotification.tsx index ccd3d3b507b..2eefd9cb958 100644 --- a/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/HiveNotification.tsx +++ b/frontend/src/routes/Infrastructure/Clusters/ManagedClusters/components/HiveNotification.tsx @@ -91,7 +91,7 @@ export function HiveNotification() { } - message={clusterProvisionStatus} + message={formatHiveLogText(clusterProvisionStatus)} /> ) @@ -124,3 +124,13 @@ export function launchToYaml(cluster: Cluster, configMaps: ConfigMap[]) { const openShiftConsoleUrl = openShiftConsoleConfig?.data?.consoleURL window.open(`${openShiftConsoleUrl}/k8s/ns/${namespace}/hive.openshift.io~v1~${kind}/${name}/yaml`) } + +export function formatHiveLogText(message: string | undefined) { + if (typeof message === 'string') { + const messageArray = message.split('\n') + if (messageArray.length > 9) { + message = `${messageArray.slice(0, 9).join('\n')}...` + } + } + return message +} diff --git a/frontend/src/ui-components/AcmAlert/AcmAlert.tsx b/frontend/src/ui-components/AcmAlert/AcmAlert.tsx index 274506906a2..4f228d1d128 100644 --- a/frontend/src/ui-components/AcmAlert/AcmAlert.tsx +++ b/frontend/src/ui-components/AcmAlert/AcmAlert.tsx @@ -135,7 +135,7 @@ export function AcmAlert(props: { style={props.style} className={props.className} > - {alertInfo?.message || props.message || props.subtitle} +

{alertInfo?.message || props.message || props.subtitle}

)