Skip to content

Commit

Permalink
ACM-14718: Render internal line breaks in hive's ProvisionFailed stat…
Browse files Browse the repository at this point in the history
…us condition message (#4235)

* adding formatting for hive ProvisionFailed Status

Signed-off-by: Nitin Dhevar <[email protected]>

* pushing prow check fix

Signed-off-by: Nitin Dhevar <[email protected]>

* fixing display lines count in hive log

Signed-off-by: Nitin Dhevar <[email protected]>

---------

Signed-off-by: Nitin Dhevar <[email protected]>
  • Loading branch information
nitin-dhevar authored Jan 30, 2025
1 parent 9fa286b commit 947d8b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function HiveNotification() {
</AcmButton>
</Fragment>
}
message={clusterProvisionStatus}
message={formatHiveLogText(clusterProvisionStatus)}
/>
</div>
)
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion frontend/src/ui-components/AcmAlert/AcmAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function AcmAlert(props: {
style={props.style}
className={props.className}
>
{alertInfo?.message || props.message || props.subtitle}
<p style={{ whiteSpace: 'pre-wrap' }}>{alertInfo?.message || props.message || props.subtitle}</p>
</Alert>
</Collapse>
)
Expand Down

0 comments on commit 947d8b2

Please sign in to comment.