mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 05:02:35 +08:00
Service accounts: API key migration refactoring to parse as json object of the results (#69771)
refactoring to parse as json object of the results
This commit is contained in:
@ -38,11 +38,11 @@ var (
|
||||
)
|
||||
|
||||
type MigrationResult struct {
|
||||
Total int
|
||||
Migrated int
|
||||
Failed int
|
||||
FailedApikeyIDs []int64
|
||||
FailedDetails []string
|
||||
Total int `json:"total"`
|
||||
Migrated int `json:"migrated"`
|
||||
Failed int `json:"failed"`
|
||||
FailedApikeyIDs []int64 `json:"failedApikeyIDs"`
|
||||
FailedDetails []string `json:"failedDetails"`
|
||||
}
|
||||
|
||||
type ServiceAccount struct {
|
||||
|
@ -36,7 +36,7 @@ export function migrateAll(): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
try {
|
||||
const payload = await getBackendSrv().post('/api/serviceaccounts/migrate');
|
||||
dispatch(setMigrationResult({ payload }));
|
||||
dispatch(setMigrationResult(payload));
|
||||
} finally {
|
||||
dispatch(loadApiKeys());
|
||||
}
|
||||
|
@ -39,8 +39,7 @@ const apiKeysSlice = createSlice({
|
||||
return { ...state, hasFetched: false };
|
||||
},
|
||||
setMigrationResult: (state, action): ApiKeysState => {
|
||||
const { migrationResult } = action.payload;
|
||||
return { ...state, migrationResult: migrationResult };
|
||||
return { ...state, migrationResult: action.payload };
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user