mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-24 08:58:06 +00:00
MINOR: added alert notification for async delete process completion (#20514)
* added alert notification for async delete process completion * support alert notification in case of delete failed * minor code improvement * fix the playwright test * increase the timer around the service ingestion delete to verify the message * remove the config to check only one test
This commit is contained in:
parent
d65a05e865
commit
778d2d35d5
@ -104,6 +104,6 @@ test.describe('API service', () => {
|
|||||||
|
|
||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
await toastNotification(page, /Delete operation initiated for/);
|
await toastNotification(page, /deleted successfully!/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -257,7 +257,7 @@ test.describe('Entity Version pages', () => {
|
|||||||
|
|
||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
await toastNotification(page, /Delete operation initiated for/);
|
await toastNotification(page, /deleted successfully!/);
|
||||||
|
|
||||||
await page.reload();
|
await page.reload();
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ test.describe('Service Version pages', () => {
|
|||||||
|
|
||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
await toastNotification(page, /Delete operation initiated for/);
|
await toastNotification(page, /deleted successfully!/);
|
||||||
|
|
||||||
await page.reload();
|
await page.reload();
|
||||||
|
|
||||||
|
@ -117,9 +117,10 @@ export const getEntityTypeSearchIndexMapping = (entityType: string) => {
|
|||||||
|
|
||||||
export const toastNotification = async (
|
export const toastNotification = async (
|
||||||
page: Page,
|
page: Page,
|
||||||
message: string | RegExp
|
message: string | RegExp,
|
||||||
|
timeout: number
|
||||||
) => {
|
) => {
|
||||||
await expect(page.getByTestId('alert-bar')).toHaveText(message);
|
await expect(page.getByTestId('alert-bar')).toHaveText(message, { timeout });
|
||||||
|
|
||||||
await expect(page.getByTestId('alert-icon')).toBeVisible();
|
await expect(page.getByTestId('alert-icon')).toBeVisible();
|
||||||
|
|
||||||
|
@ -1248,7 +1248,7 @@ export const softDeleteEntity = async (
|
|||||||
|
|
||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
await toastNotification(page, /Delete operation initiated for/);
|
await toastNotification(page, /deleted successfully!/);
|
||||||
|
|
||||||
await page.reload();
|
await page.reload();
|
||||||
|
|
||||||
@ -1313,7 +1313,7 @@ export const hardDeleteEntity = async (
|
|||||||
await page.click('[data-testid="confirm-button"]');
|
await page.click('[data-testid="confirm-button"]');
|
||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
await toastNotification(page, /Delete operation initiated for/);
|
await toastNotification(page, /deleted successfully!/);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkDataAssetWidget = async (page: Page, serviceType: string) => {
|
export const checkDataAssetWidget = async (page: Page, serviceType: string) => {
|
||||||
|
@ -120,10 +120,7 @@ export const deleteService = async (
|
|||||||
await deleteResponse;
|
await deleteResponse;
|
||||||
|
|
||||||
// Closing the toast notification
|
// Closing the toast notification
|
||||||
await toastNotification(
|
await toastNotification(page, /deleted successfully!/, 5 * 60 * 1000); // Wait for up to 5 minutes for the toast notification to appear
|
||||||
page,
|
|
||||||
`Delete operation initiated for ${serviceName}`
|
|
||||||
);
|
|
||||||
|
|
||||||
await page.waitForSelector(`[data-testid="service-name-${serviceName}"]`, {
|
await page.waitForSelector(`[data-testid="service-name-${serviceName}"]`, {
|
||||||
state: 'hidden',
|
state: 'hidden',
|
||||||
|
@ -57,8 +57,8 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => {
|
|||||||
deleteType === DeleteType.HARD_DELETE
|
deleteType === DeleteType.HARD_DELETE
|
||||||
);
|
);
|
||||||
|
|
||||||
// In case of recursive delete if false and entity has data.
|
// In case of recursive delete if false and the deleting entity has data.
|
||||||
// sometime socket throw the error before the response
|
// sometime socket throw the error before the API response
|
||||||
if (asyncDeleteJobRef.current?.status === 'FAILED') {
|
if (asyncDeleteJobRef.current?.status === 'FAILED') {
|
||||||
showErrorToast(
|
showErrorToast(
|
||||||
asyncDeleteJobRef.current.error ??
|
asyncDeleteJobRef.current.error ??
|
||||||
@ -92,6 +92,23 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => {
|
|||||||
};
|
};
|
||||||
setAsyncDeleteJob(updatedAsyncDeleteJob);
|
setAsyncDeleteJob(updatedAsyncDeleteJob);
|
||||||
asyncDeleteJobRef.current = updatedAsyncDeleteJob;
|
asyncDeleteJobRef.current = updatedAsyncDeleteJob;
|
||||||
|
|
||||||
|
if (response.status === 'FAILED') {
|
||||||
|
showErrorToast(
|
||||||
|
response.error ??
|
||||||
|
t('server.delete-entity-error', {
|
||||||
|
entity: response.entityName,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.status === 'COMPLETED') {
|
||||||
|
showSuccessToast(
|
||||||
|
t('server.entity-deleted-successfully', {
|
||||||
|
entity: response.entityName,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const activityFeedContextValues = useMemo(() => {
|
const activityFeedContextValues = useMemo(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user