From a335150ad1bcad53437506d39d0ccd6e871df232 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 28 Nov 2017 12:49:37 +0100 Subject: [PATCH] dashfolders: Add a helper for creating a dashboard folder --- pkg/models/dashboards.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/models/dashboards.go b/pkg/models/dashboards.go index eadf4cd15e5..1d84d8250a6 100644 --- a/pkg/models/dashboards.go +++ b/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()