mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Storage: rename uid to name and name to title (#79418)
rename uid to name and name to title
This commit is contained in:
@@ -51,6 +51,7 @@ const annoKeyUpdatedBy = "grafana.app/updatedBy"
|
||||
// The folder identifier
|
||||
const annoKeyFolder = "grafana.app/folder"
|
||||
const annoKeySlug = "grafana.app/slug"
|
||||
const annoKeyTitle = "grafana.app/title"
|
||||
|
||||
// Identify where values came from
|
||||
const annoKeyOriginName = "grafana.app/originName"
|
||||
@@ -71,6 +72,13 @@ func (m *GrafanaResourceMetadata) set(key string, val string) {
|
||||
m.Annotations[key] = val
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) get(key string) string {
|
||||
if m.Annotations == nil {
|
||||
return ""
|
||||
}
|
||||
return m.Annotations[key]
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) GetUpdatedTimestamp() *time.Time {
|
||||
v, ok := m.Annotations[annoKeyUpdatedTimestamp]
|
||||
if ok {
|
||||
@@ -124,13 +132,21 @@ func (m *GrafanaResourceMetadata) SetFolder(uid string) {
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) GetSlug() string {
|
||||
return m.Annotations[annoKeySlug]
|
||||
return m.get(annoKeySlug)
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) SetSlug(v string) {
|
||||
m.set(annoKeySlug, v)
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) GetTitle() string {
|
||||
return m.get(annoKeyTitle)
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) SetTitle(v string) {
|
||||
m.set(annoKeyTitle, v)
|
||||
}
|
||||
|
||||
func (m *GrafanaResourceMetadata) SetOriginInfo(info *ResourceOriginInfo) {
|
||||
delete(m.Annotations, annoKeyOriginName)
|
||||
delete(m.Annotations, annoKeyOriginPath)
|
||||
@@ -196,6 +212,8 @@ type GrafanaResourceMetaAccessor interface {
|
||||
SetFolder(uid string)
|
||||
GetSlug() string
|
||||
SetSlug(v string)
|
||||
GetTitle() string
|
||||
SetTitle(v string)
|
||||
GetOriginInfo() *ResourceOriginInfo
|
||||
SetOriginInfo(info *ResourceOriginInfo)
|
||||
GetOriginName() string
|
||||
@@ -294,7 +312,13 @@ func (m *grafanaResourceMetaAccessor) GetSlug() string {
|
||||
func (m *grafanaResourceMetaAccessor) SetSlug(v string) {
|
||||
m.set(annoKeySlug, v)
|
||||
}
|
||||
func (m *grafanaResourceMetaAccessor) GetTitle() string {
|
||||
return m.get(annoKeyTitle)
|
||||
}
|
||||
|
||||
func (m *grafanaResourceMetaAccessor) SetTitle(v string) {
|
||||
m.set(annoKeyTitle, v)
|
||||
}
|
||||
func (m *grafanaResourceMetaAccessor) SetOriginInfo(info *ResourceOriginInfo) {
|
||||
anno := m.obj.GetAnnotations()
|
||||
if anno == nil {
|
||||
|
||||
Reference in New Issue
Block a user