Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACM-14718: Render internal line breaks in hive's ProvisionFailed status condition message #4235

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, 8).join('\n')}...`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a slight off-by-one error here. Other than that, it looks great. Good job.

}
}
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