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:
Ashish Gupta 2025-04-09 18:14:36 +05:30 committed by GitHub
parent d65a05e865
commit 778d2d35d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 13 deletions

View File

@ -104,6 +104,6 @@ test.describe('API service', () => {
await deleteResponse;
await toastNotification(page, /Delete operation initiated for/);
await toastNotification(page, /deleted successfully!/);
});
});

View File

@ -257,7 +257,7 @@ test.describe('Entity Version pages', () => {
await deleteResponse;
await toastNotification(page, /Delete operation initiated for/);
await toastNotification(page, /deleted successfully!/);
await page.reload();

View File

@ -215,7 +215,7 @@ test.describe('Service Version pages', () => {
await deleteResponse;
await toastNotification(page, /Delete operation initiated for/);
await toastNotification(page, /deleted successfully!/);
await page.reload();

View File

@ -117,9 +117,10 @@ export const getEntityTypeSearchIndexMapping = (entityType: string) => {
export const toastNotification = async (
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();

View File

@ -1248,7 +1248,7 @@ export const softDeleteEntity = async (
await deleteResponse;
await toastNotification(page, /Delete operation initiated for/);
await toastNotification(page, /deleted successfully!/);
await page.reload();
@ -1313,7 +1313,7 @@ export const hardDeleteEntity = async (
await page.click('[data-testid="confirm-button"]');
await deleteResponse;
await toastNotification(page, /Delete operation initiated for/);
await toastNotification(page, /deleted successfully!/);
};
export const checkDataAssetWidget = async (page: Page, serviceType: string) => {

View File

@ -120,10 +120,7 @@ export const deleteService = async (
await deleteResponse;
// Closing the toast notification
await toastNotification(
page,
`Delete operation initiated for ${serviceName}`
);
await toastNotification(page, /deleted successfully!/, 5 * 60 * 1000); // Wait for up to 5 minutes for the toast notification to appear
await page.waitForSelector(`[data-testid="service-name-${serviceName}"]`, {
state: 'hidden',

View File

@ -57,8 +57,8 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => {
deleteType === DeleteType.HARD_DELETE
);
// In case of recursive delete if false and entity has data.
// sometime socket throw the error before the response
// In case of recursive delete if false and the deleting entity has data.
// sometime socket throw the error before the API response
if (asyncDeleteJobRef.current?.status === 'FAILED') {
showErrorToast(
asyncDeleteJobRef.current.error ??
@ -92,6 +92,23 @@ const AsyncDeleteProvider = ({ children }: AsyncDeleteProviderProps) => {
};
setAsyncDeleteJob(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(() => {