Skip to content

Commit

Permalink
add support for expandable error message (#33189)
Browse files Browse the repository at this point in the history
  • Loading branch information
vickyyyyyyy committed Apr 23, 2021
1 parent 3bae330 commit 99a04ed
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Expand Up @@ -45,6 +45,7 @@ export enum HealthStatus {
* plugin.
*
* 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
*/
Expand Down
Expand Up @@ -139,4 +139,19 @@ describe('Render', () => {

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

0 comments on commit 99a04ed

Please sign in to comment.