Skip to content

Commit

Permalink
PMM-13633 Add migration success message
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkubinec committed Jan 9, 2025
1 parent 64ddbff commit 3e9b49c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions public/app/percona/shared/core/hooks/migrator.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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));
};
Expand Down

0 comments on commit 3e9b49c

Please sign in to comment.