From 3e9b49cff74db9df6cff5fe81bad9483bcd6a0dc Mon Sep 17 00:00:00 2001 From: Matej Kubinec Date: Thu, 9 Jan 2025 13:27:09 +0100 Subject: [PATCH] PMM-13633 Add migration success message --- public/app/percona/shared/core/hooks/migrator.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/app/percona/shared/core/hooks/migrator.ts b/public/app/percona/shared/core/hooks/migrator.ts index 2493f6fe1c546..8f2979fac3fd0 100644 --- a/public/app/percona/shared/core/hooks/migrator.ts +++ b/public/app/percona/shared/core/hooks/migrator.ts @@ -1,6 +1,8 @@ import { useEffect } from 'react'; import { useLocation } from 'react-router'; +import { AppEvents } from '@grafana/data'; +import { appEvents } from 'app/core/core'; import { migrateAll } from 'app/features/api-keys/state/actions'; import { useAppDispatch } from 'app/store/store'; import { useSelector } from 'app/types'; @@ -23,6 +25,15 @@ export const useMigrator = () => { dispatch(migrateAll()); }, [location.search, dispatch]); + useEffect(() => { + if (migrationResult && migrationResult.total > 0 && migrationResult.failed === 0) { + // give some time for the app to load + setTimeout(() => { + appEvents.emit(AppEvents.alertSuccess, ['All api keys successfully migrated']); + }, 1000); + } + }, [migrationResult]); + const dismissSummary = () => { dispatch(snoozeApiKeyMigrationSummary(true)); };