align alert (#33919)

This commit is contained in:
Vicky Lee 2021-05-11 12:56:48 +01:00 committed by GitHub
parent 10a25ba4e5
commit ac44a679a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -200,6 +200,19 @@ export class DataSourceSettingsPage extends PureComponent<Props> {
return <div>Page not found: {page}</div>;
}
renderAlertDetails() {
const { testingStatus } = this.props;
return (
<>
{testingStatus?.details?.message}
{testingStatus?.details?.verboseMessage ? (
<details style={{ whiteSpace: 'pre-wrap' }}>{testingStatus?.details?.verboseMessage}</details>
) : null}
</>
);
}
renderSettings() {
const { dataSourceMeta, setDataSourceName, setIsDefault, dataSource, plugin, testingStatus } = this.props;
@ -233,20 +246,17 @@ export class DataSourceSettingsPage extends PureComponent<Props> {
/>
)}
<div className="gf-form-group p-t-2">
{testingStatus?.message && (
{testingStatus?.message && (
<div className="gf-form-group p-t-2">
<Alert
severity={testingStatus.status === 'error' ? 'error' : 'success'}
title={testingStatus.message}
aria-label={selectors.pages.DataSource.alert}
>
{testingStatus.details?.message ?? null}
{testingStatus.details?.verboseMessage ? (
<details style={{ whiteSpace: 'pre-wrap' }}>{testingStatus.details?.verboseMessage}</details>
) : null}
{testingStatus.details && this.renderAlertDetails()}
</Alert>
)}
</div>
</div>
)}
<ButtonRow
onSubmit={(event) => this.onSubmit(event)}