Service accounts
diff --git a/public/app/features/serviceaccounts/state/actions.ts b/public/app/features/serviceaccounts/state/actions.ts
index 2448de4b901..aeebfa4e6ac 100644
--- a/public/app/features/serviceaccounts/state/actions.ts
+++ b/public/app/features/serviceaccounts/state/actions.ts
@@ -15,6 +15,7 @@ import {
serviceAccountsFetchBegin,
serviceAccountsFetched,
serviceAccountsFetchEnd,
+ apiKeysMigrationStatusLoaded,
stateFilterChanged,
} from './reducers';
@@ -41,6 +42,13 @@ export function fetchACOptions(): ThunkResult {
};
}
+export function getApiKeysMigrationStatus(): ThunkResult {
+ return async (dispatch) => {
+ const result = await getBackendSrv().get('/api/serviceaccounts/migrationstatus');
+ dispatch(apiKeysMigrationStatusLoaded(!!result?.migrated));
+ };
+}
+
interface FetchServiceAccountsParams {
withLoadingIndicator: boolean;
}
diff --git a/public/app/features/serviceaccounts/state/reducers.ts b/public/app/features/serviceaccounts/state/reducers.ts
index fc672060286..571ec2b40d7 100644
--- a/public/app/features/serviceaccounts/state/reducers.ts
+++ b/public/app/features/serviceaccounts/state/reducers.ts
@@ -51,6 +51,7 @@ export const initialStateList: ServiceAccountsState = {
totalPages: 1,
showPaging: false,
serviceAccountStateFilter: ServiceAccountStateFilter.All,
+ apiKeysMigrated: false,
};
interface ServiceAccountsFetched {
@@ -89,6 +90,9 @@ const serviceAccountsSlice = createSlice({
builtInRolesLoaded: (state, action: PayloadAction>): ServiceAccountsState => {
return { ...state, builtInRoles: action.payload };
},
+ apiKeysMigrationStatusLoaded: (state, action): ServiceAccountsState => {
+ return { ...state, apiKeysMigrated: action.payload };
+ },
queryChanged: (state, action: PayloadAction) => {
return {
...state,
@@ -114,6 +118,7 @@ export const {
serviceAccountsFetched,
acOptionsLoaded,
builtInRolesLoaded,
+ apiKeysMigrationStatusLoaded,
pageChanged,
stateFilterChanged,
queryChanged,
diff --git a/public/app/types/apiKeys.ts b/public/app/types/apiKeys.ts
index e024de1da1e..727d42783dc 100644
--- a/public/app/types/apiKeys.ts
+++ b/public/app/types/apiKeys.ts
@@ -25,4 +25,5 @@ export interface ApiKeysState {
keysIncludingExpired: ApiKey[];
searchQuery: string;
hasFetched: boolean;
+ apiKeysMigrated: boolean;
}
diff --git a/public/app/types/serviceaccount.ts b/public/app/types/serviceaccount.ts
index ba0989251fa..836bdaaf8f1 100644
--- a/public/app/types/serviceaccount.ts
+++ b/public/app/types/serviceaccount.ts
@@ -66,6 +66,7 @@ export interface ServiceAccountsState {
isLoading: boolean;
roleOptions: Role[];
builtInRoles: Record;
+ apiKeysMigrated: boolean;
// search / filtering
query: string;
@@ -75,3 +76,7 @@ export interface ServiceAccountsState {
showPaging: boolean;
serviceAccountStateFilter: ServiceAccountStateFilter;
}
+
+export interface ServiceAccountsUpgradeStatus {
+ upgraded: boolean;
+}