add support for expandable error message (#33189)

This commit is contained in:
Vicky Lee
2021-04-23 10:37:47 +01:00
committed by GitHub
parent 3bae330286
commit 99a04ed612
3 changed files with 19 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ export enum HealthStatus {
* plugin. * plugin.
* *
* If the 'message' key exists, this will be displayed in the error message in DataSourceSettingsPage * If the 'message' key exists, this will be displayed in the error message in DataSourceSettingsPage
* If the 'verboseMessage' key exists, this will be displayed in the expandable details in the error message in DataSourceSettingsPage
* *
* @public * @public
*/ */

View File

@@ -139,4 +139,19 @@ describe('Render', () => {
expect(screen.getByText(mockProps.testingStatus.message)).toBeInTheDocument(); expect(screen.getByText(mockProps.testingStatus.message)).toBeInTheDocument();
}); });
it('should render verbose error message with detailed verbose error message', () => {
const mockProps = {
...getProps(),
testingStatus: {
message: 'message',
status: 'error',
details: { message: 'detailed message', verboseMessage: 'verbose message' },
},
};
render(<DataSourceSettingsPage {...mockProps} />);
expect(screen.getByText(mockProps.testingStatus.details.verboseMessage)).toBeInTheDocument();
});
}); });

View File

@@ -241,6 +241,9 @@ export class DataSourceSettingsPage extends PureComponent<Props> {
aria-label={selectors.pages.DataSource.alert} aria-label={selectors.pages.DataSource.alert}
> >
{testingStatus.details?.message ?? null} {testingStatus.details?.message ?? null}
{testingStatus.details?.verboseMessage ? (
<details style={{ whiteSpace: 'pre-wrap' }}>{testingStatus.details?.verboseMessage}</details>
) : null}
</Alert> </Alert>
)} )}
</div> </div>