diff --git a/public/app/features/migrate-to-cloud/api/endpoints.gen.ts b/public/app/features/migrate-to-cloud/api/endpoints.gen.ts index cd533d124aa..890138028b4 100644 --- a/public/app/features/migrate-to-cloud/api/endpoints.gen.ts +++ b/public/app/features/migrate-to-cloud/api/endpoints.gen.ts @@ -143,7 +143,7 @@ export type ErrorResponseBody = { /** a human readable version of the error */ message: string; /** Status An optional status to denote the cause of the error. - + For example, a 412 Precondition Failed error may include additional information of why that error happened. */ status?: string; }; @@ -159,11 +159,21 @@ export type MigrateDataResponseItemDto = { status: 'OK' | 'ERROR' | 'PENDING' | 'UNKNOWN'; type: 'DASHBOARD' | 'DATASOURCE' | 'FOLDER'; }; +export type SnapshotResourceStats = { + statuses?: { + [key: string]: number; + }; + total?: number; + types?: { + [key: string]: number; + }; +}; export type GetSnapshotResponseDto = { created?: string; finished?: string; results?: MigrateDataResponseItemDto[]; sessionUid?: string; + stats?: SnapshotResourceStats; status?: | 'INITIALIZING' | 'CREATING' @@ -172,6 +182,7 @@ export type GetSnapshotResponseDto = { | 'PENDING_PROCESSING' | 'PROCESSING' | 'FINISHED' + | 'CANCELED' | 'ERROR' | 'UNKNOWN'; uid?: string; @@ -188,6 +199,7 @@ export type SnapshotDto = { | 'PENDING_PROCESSING' | 'PROCESSING' | 'FINISHED' + | 'CANCELED' | 'ERROR' | 'UNKNOWN'; uid?: string; diff --git a/public/app/features/migrate-to-cloud/onprem/MigrationSummary.tsx b/public/app/features/migrate-to-cloud/onprem/MigrationSummary.tsx index 19405d42be1..22742acd860 100644 --- a/public/app/features/migrate-to-cloud/onprem/MigrationSummary.tsx +++ b/public/app/features/migrate-to-cloud/onprem/MigrationSummary.tsx @@ -1,5 +1,6 @@ import { Box, Button, Space, Stack, Text } from '@grafana/ui'; import { Trans, t } from 'app/core/internationalization'; +import { formatDate } from 'app/core/internationalization/dates'; import { GetSessionApiResponse, GetSnapshotResponseDto } from '../api'; @@ -24,6 +25,11 @@ interface MigrationSummaryProps { showRebuildSnapshot: boolean; } +const DATE_FORMAT: Intl.DateTimeFormatOptions = { + dateStyle: 'medium', + timeStyle: 'short', +}; + export function MigrationSummary(props: MigrationSummaryProps) { const { session, @@ -43,9 +49,9 @@ export function MigrationSummary(props: MigrationSummaryProps) { showRebuildSnapshot, } = props; - const totalCount = 0; - const errorCount = 0; - const successCount = 0; + const totalCount = snapshot?.stats?.total ?? 0; + const errorCount = snapshot?.stats?.statuses?.['ERROR'] ?? 0; + const successCount = snapshot?.stats?.statuses?.['OK'] ?? 0; return ( {snapshot?.created ? ( - snapshot?.created + formatDate(snapshot.created, DATE_FORMAT) ) : ( Not yet created