Procházet zdrojové kódy

dashfolders: Add a helper for creating a dashboard folder

Marcus Efraimsson před 8 roky
rodič
revize
a335150ad1
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  1. 9 0
      pkg/models/dashboards.go

+ 9 - 0
pkg/models/dashboards.go

@@ -68,6 +68,15 @@ func NewDashboard(title string) *Dashboard {
 	return dash
 }
 
+// NewDashboardFolder creates a new dashboard folder
+func NewDashboardFolder(title string) *Dashboard {
+	folder := NewDashboard(title)
+	folder.Data.Set("schemaVersion", 16)
+	folder.Data.Set("editable", true)
+	folder.Data.Set("hideControls", true)
+	return folder
+}
+
 // GetTags turns the tags in data json into go string array
 func (dash *Dashboard) GetTags() []string {
 	return dash.Data.Get("tags").MustStringArray()