K8s/Dashboards: Remove slug annotation (#102270)
This commit is contained in:
@@ -35,7 +35,6 @@ const AnnoKeyCreatedBy = "grafana.app/createdBy"
|
|||||||
const AnnoKeyUpdatedTimestamp = "grafana.app/updatedTimestamp"
|
const AnnoKeyUpdatedTimestamp = "grafana.app/updatedTimestamp"
|
||||||
const AnnoKeyUpdatedBy = "grafana.app/updatedBy"
|
const AnnoKeyUpdatedBy = "grafana.app/updatedBy"
|
||||||
const AnnoKeyFolder = "grafana.app/folder"
|
const AnnoKeyFolder = "grafana.app/folder"
|
||||||
const AnnoKeySlug = "grafana.app/slug"
|
|
||||||
const AnnoKeyBlob = "grafana.app/blob"
|
const AnnoKeyBlob = "grafana.app/blob"
|
||||||
const AnnoKeyMessage = "grafana.app/message"
|
const AnnoKeyMessage = "grafana.app/message"
|
||||||
|
|
||||||
@@ -88,9 +87,6 @@ type GrafanaMetaAccessor interface {
|
|||||||
SetMessage(msg string)
|
SetMessage(msg string)
|
||||||
SetAnnotation(key string, val string)
|
SetAnnotation(key string, val string)
|
||||||
|
|
||||||
GetSlug() string
|
|
||||||
SetSlug(v string)
|
|
||||||
|
|
||||||
SetBlob(v *BlobInfo)
|
SetBlob(v *BlobInfo)
|
||||||
GetBlob() *BlobInfo
|
GetBlob() *BlobInfo
|
||||||
|
|
||||||
@@ -270,14 +266,6 @@ func (m *grafanaMetaAccessor) SetMessage(uid string) {
|
|||||||
m.SetAnnotation(AnnoKeyMessage, uid)
|
m.SetAnnotation(AnnoKeyMessage, uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *grafanaMetaAccessor) GetSlug() string {
|
|
||||||
return m.get(AnnoKeySlug)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *grafanaMetaAccessor) SetSlug(v string) {
|
|
||||||
m.SetAnnotation(AnnoKeySlug, v)
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will be removed in Grafana 13. Do not add any new usage of it.
|
// This will be removed in Grafana 13. Do not add any new usage of it.
|
||||||
func (m *grafanaMetaAccessor) GetDeprecatedInternalID() int64 {
|
func (m *grafanaMetaAccessor) GetDeprecatedInternalID() int64 {
|
||||||
labels := m.obj.GetLabels()
|
labels := m.obj.GetLabels()
|
||||||
|
|||||||
@@ -1949,11 +1949,12 @@ func (dr *DashboardServiceImpl) UnstructuredToLegacyDashboard(ctx context.Contex
|
|||||||
dashVersion := obj.GetGeneration()
|
dashVersion := obj.GetGeneration()
|
||||||
spec["version"] = dashVersion
|
spec["version"] = dashVersion
|
||||||
|
|
||||||
|
title, _, _ := unstructured.NestedString(spec, "title")
|
||||||
out := dashboards.Dashboard{
|
out := dashboards.Dashboard{
|
||||||
OrgID: orgID,
|
OrgID: orgID,
|
||||||
ID: obj.GetDeprecatedInternalID(), // nolint:staticcheck
|
ID: obj.GetDeprecatedInternalID(), // nolint:staticcheck
|
||||||
UID: uid,
|
UID: uid,
|
||||||
Slug: obj.GetSlug(),
|
Slug: slugify.Slugify(title),
|
||||||
FolderUID: obj.GetFolder(),
|
FolderUID: obj.GetFolder(),
|
||||||
Version: int(dashVersion),
|
Version: int(dashVersion),
|
||||||
Data: simplejson.NewFromAny(spec),
|
Data: simplejson.NewFromAny(spec),
|
||||||
|
|||||||
@@ -37,11 +37,7 @@ export const AnnoKeyCreatedBy = 'grafana.app/createdBy';
|
|||||||
export const AnnoKeyUpdatedTimestamp = 'grafana.app/updatedTimestamp';
|
export const AnnoKeyUpdatedTimestamp = 'grafana.app/updatedTimestamp';
|
||||||
export const AnnoKeyUpdatedBy = 'grafana.app/updatedBy';
|
export const AnnoKeyUpdatedBy = 'grafana.app/updatedBy';
|
||||||
export const AnnoKeyFolder = 'grafana.app/folder';
|
export const AnnoKeyFolder = 'grafana.app/folder';
|
||||||
export const AnnoKeyFolderTitle = 'grafana.app/folderTitle';
|
|
||||||
export const AnnoKeyFolderId = 'grafana.app/folderId';
|
|
||||||
export const AnnoKeyFolderUrl = 'grafana.app/folderUrl';
|
|
||||||
export const AnnoKeyMessage = 'grafana.app/message';
|
export const AnnoKeyMessage = 'grafana.app/message';
|
||||||
export const AnnoKeySlug = 'grafana.app/slug';
|
|
||||||
|
|
||||||
export enum ManagerKind {
|
export enum ManagerKind {
|
||||||
Repo = 'repo',
|
Repo = 'repo',
|
||||||
@@ -56,12 +52,25 @@ export const AnnoKeySourcePath = 'grafana.app/sourcePath';
|
|||||||
export const AnnoKeySourceChecksum = 'grafana.app/sourceChecksum';
|
export const AnnoKeySourceChecksum = 'grafana.app/sourceChecksum';
|
||||||
export const AnnoKeySourceTimestamp = 'grafana.app/sourceTimestamp';
|
export const AnnoKeySourceTimestamp = 'grafana.app/sourceTimestamp';
|
||||||
|
|
||||||
|
// for auditing... when saving from the UI, mark which version saved it from where
|
||||||
export const AnnoKeySavedFromUI = 'grafana.app/saved-from-ui';
|
export const AnnoKeySavedFromUI = 'grafana.app/saved-from-ui';
|
||||||
export const AnnoKeyDashboardNotFound = 'grafana.app/dashboard-not-found';
|
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
|
export const AnnoKeySlug = 'grafana.app/slug';
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
export const AnnoKeyDashboardIsSnapshot = 'grafana.app/dashboard-is-snapshot';
|
export const AnnoKeyDashboardIsSnapshot = 'grafana.app/dashboard-is-snapshot';
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
export const AnnoKeyDashboardSnapshotOriginalUrl = 'grafana.app/dashboard-snapshot-original-url';
|
export const AnnoKeyDashboardSnapshotOriginalUrl = 'grafana.app/dashboard-snapshot-original-url';
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
export const AnnoKeyDashboardGnetId = 'grafana.app/dashboard-gnet-id';
|
export const AnnoKeyDashboardGnetId = 'grafana.app/dashboard-gnet-id';
|
||||||
|
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
|
export const AnnoKeyFolderTitle = 'grafana.app/folderTitle';
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
|
export const AnnoKeyFolderId = 'grafana.app/folderId';
|
||||||
|
/** @deprecated NOT A REAL annotation -- this is just a shim */
|
||||||
|
export const AnnoKeyFolderUrl = 'grafana.app/folderUrl';
|
||||||
|
|
||||||
// labels
|
// labels
|
||||||
export const DeprecatedInternalId = 'grafana.app/deprecatedInternalID';
|
export const DeprecatedInternalId = 'grafana.app/deprecatedInternalID';
|
||||||
|
|
||||||
@@ -71,7 +80,6 @@ type GrafanaAnnotations = {
|
|||||||
[AnnoKeyUpdatedTimestamp]?: string;
|
[AnnoKeyUpdatedTimestamp]?: string;
|
||||||
[AnnoKeyUpdatedBy]?: string;
|
[AnnoKeyUpdatedBy]?: string;
|
||||||
[AnnoKeyFolder]?: string;
|
[AnnoKeyFolder]?: string;
|
||||||
[AnnoKeySlug]?: string;
|
|
||||||
|
|
||||||
[AnnoKeyManagerKind]?: ManagerKind;
|
[AnnoKeyManagerKind]?: ManagerKind;
|
||||||
[AnnoKeyManagerIdentity]?: string;
|
[AnnoKeyManagerIdentity]?: string;
|
||||||
@@ -83,6 +91,8 @@ type GrafanaAnnotations = {
|
|||||||
// Annotations provided by the front-end client
|
// Annotations provided by the front-end client
|
||||||
type GrafanaClientAnnotations = {
|
type GrafanaClientAnnotations = {
|
||||||
[AnnoKeyMessage]?: string;
|
[AnnoKeyMessage]?: string;
|
||||||
|
|
||||||
|
[AnnoKeySlug]?: string;
|
||||||
[AnnoKeyFolderTitle]?: string;
|
[AnnoKeyFolderTitle]?: string;
|
||||||
[AnnoKeyFolderUrl]?: string;
|
[AnnoKeyFolderUrl]?: string;
|
||||||
[AnnoKeyFolderId]?: number;
|
[AnnoKeyFolderId]?: number;
|
||||||
|
|||||||
Reference in New Issue
Block a user