Dashboards: Use string for `AnnoKeyDashboardIsSnapshot` (#105306)

pull/105268/head^2
Ryan McKinley 2 months ago committed by GitHub
parent c6428dfc74
commit 242cb8edbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      public/app/features/apiserver/types.ts
  2. 3
      public/app/features/dashboard-scene/serialization/transformSaveModelSchemaV2ToScene.test.ts
  3. 10
      public/app/features/dashboard/api/ResponseTransformers.ts

@ -97,7 +97,7 @@ type GrafanaClientAnnotations = {
[AnnoKeyFolderTitle]?: string;
[AnnoKeyFolderUrl]?: string;
[AnnoKeySavedFromUI]?: string;
[AnnoKeyDashboardIsSnapshot]?: boolean;
[AnnoKeyDashboardIsSnapshot]?: string;
[AnnoKeyDashboardSnapshotOriginalUrl]?: string;
[AnnoKeyGrantPermissions]?: string;
// TODO: This should be provided by the API

@ -30,6 +30,7 @@ import {
QueryVariableKind,
TextVariableKind,
} from '@grafana/schema/dist/esm/schema/dashboard/v2alpha1/types.spec.gen';
import { AnnoKeyDashboardIsSnapshot } from 'app/features/apiserver/types';
import { DashboardWithAccessInfo } from 'app/features/dashboard/api/types';
import { MIXED_DATASOURCE_NAME } from 'app/plugins/datasource/mixed/MixedDataSource';
@ -367,7 +368,7 @@ describe('transformSaveModelSchemaV2ToScene', () => {
...defaultDashboard.metadata,
annotations: {
...defaultDashboard.metadata.annotations,
'grafana.app/dashboard-is-snapshot': true,
[AnnoKeyDashboardIsSnapshot]: 'true',
},
},
};

@ -131,9 +131,15 @@ export function ensureV2Response(
[AnnoKeyUpdatedTimestamp]: dto.meta.updated,
[AnnoKeyFolder]: dto.meta.folderUid,
[AnnoKeySlug]: dto.meta.slug,
[AnnoKeyDashboardGnetId]: dashboard.gnetId ?? undefined,
[AnnoKeyDashboardIsSnapshot]: dto.meta.isSnapshot,
};
if (dashboard.gnetId) {
annotationsMeta[AnnoKeyDashboardGnetId] = dashboard.gnetId;
}
if (dto.meta.isSnapshot) {
// FIXME -- lets not put non-annotation data in annotations!
annotationsMeta[AnnoKeyDashboardIsSnapshot] = 'true';
}
creationTimestamp = dto.meta.created;
labelsMeta = {
[DeprecatedInternalId]: dashboard.id?.toString() ?? undefined,

Loading…
Cancel
Save