mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
E2C: Show latest migration run instead of the first (#85666)
* running a new migration should only invalidate the list of migration runs * correctly select the last migration result, not the first
This commit is contained in:
parent
45c56d208f
commit
040966220e
@ -4,7 +4,7 @@ import { BaseQueryFn, QueryDefinition } from '@reduxjs/toolkit/dist/query';
|
||||
import { generatedAPI } from './endpoints.gen';
|
||||
|
||||
export const cloudMigrationAPI = generatedAPI.enhanceEndpoints({
|
||||
addTagTypes: ['cloud-migration-config', 'cloud-migration-run'],
|
||||
addTagTypes: ['cloud-migration-config', 'cloud-migration-run', 'cloud-migration-run-list'],
|
||||
endpoints: {
|
||||
// List Cloud Configs
|
||||
getMigrationList: {
|
||||
@ -27,7 +27,7 @@ export const cloudMigrationAPI = generatedAPI.enhanceEndpoints({
|
||||
},
|
||||
|
||||
getCloudMigrationRunList: {
|
||||
providesTags: ['cloud-migration-run'] /* should this be a -list? */,
|
||||
providesTags: ['cloud-migration-run-list'],
|
||||
},
|
||||
|
||||
getCloudMigrationRun: {
|
||||
@ -35,7 +35,7 @@ export const cloudMigrationAPI = generatedAPI.enhanceEndpoints({
|
||||
},
|
||||
|
||||
runCloudMigration: {
|
||||
invalidatesTags: ['cloud-migration-run'],
|
||||
invalidatesTags: ['cloud-migration-run-list'],
|
||||
},
|
||||
|
||||
getDashboardByUid(endpoint) {
|
||||
|
@ -33,7 +33,7 @@ import { ResourcesTable } from './ResourcesTable';
|
||||
|
||||
function useGetLatestMigrationDestination() {
|
||||
const result = useGetMigrationListQuery();
|
||||
const latestMigration = result.data?.migrations?.[0];
|
||||
const latestMigration = result.data?.migrations?.at(-1);
|
||||
|
||||
return {
|
||||
...result,
|
||||
@ -43,7 +43,7 @@ function useGetLatestMigrationDestination() {
|
||||
|
||||
function useGetLatestMigrationRun(migrationId?: number) {
|
||||
const listResult = useGetCloudMigrationRunListQuery(migrationId ? { id: migrationId } : skipToken);
|
||||
const latestMigrationRun = listResult.data?.runs?.[0];
|
||||
const latestMigrationRun = listResult.data?.runs?.at(-1);
|
||||
|
||||
const runResult = useGetCloudMigrationRunQuery(
|
||||
latestMigrationRun?.id && migrationId ? { runId: latestMigrationRun.id, id: migrationId } : skipToken
|
||||
|
Loading…
Reference in New Issue
Block a user