chore: refactor Alert-related components (#31858)

This commit is contained in:
Maxime Beauchemin
2025-01-24 08:39:09 -08:00
committed by GitHub
parent 5fe6ef268e
commit 6eb87e04c0
51 changed files with 590 additions and 753 deletions

View File

@@ -455,7 +455,7 @@ test('should show missing params state', () => {
expect(screen.getByText(/missing url parameters/i)).toBeVisible();
expect(
screen.getByText(
/the url is missing the dataset_id or slice_id parameters\./i,
/the url is missing the dataset_id or slice_id parameters/i,
),
).toBeVisible();
});

View File

@@ -430,17 +430,10 @@ class DatasourceControl extends PureComponent {
<div className="error-alert">
<ErrorAlert
level="warning"
title={t('Missing URL parameters')}
source="explore"
subtitle={
<>
<p>
{t(
'The URL is missing the dataset_id or slice_id parameters.',
)}
</p>
</>
}
errorType={t('Missing URL parameters')}
description={t(
'The URL is missing the dataset_id or slice_id parameters.',
)}
/>
</div>
)}
@@ -448,25 +441,18 @@ class DatasourceControl extends PureComponent {
<div className="error-alert">
<ErrorAlert
level="warning"
title={t('Missing dataset')}
source="explore"
subtitle={
errorType={t('Missing dataset')}
description={
<>
<p>
{t(
'The dataset linked to this chart may have been deleted.',
)}
</p>
<p>
<Button
buttonStyle="primary"
onClick={() =>
this.handleMenuItemClick({ key: CHANGE_DATASET })
}
>
{t('Swap dataset')}
</Button>
</p>
{t('The dataset linked to this chart may have been deleted.')}
<Button
buttonStyle="primary"
onClick={() =>
this.handleMenuItemClick({ key: CHANGE_DATASET })
}
>
{t('Swap dataset')}
</Button>
</>
}
/>