diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index d599dd10735..384dd7f0ea1 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -127,6 +127,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro "name": panel.Name, "id": panel.Id, "info": panel.Info, + "sort": getPanelSort(panel.Id), } } @@ -150,6 +151,25 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro return jsonObj, nil } +func getPanelSort(id string) int { + sort := 100 + switch id { + case "graph": + sort = 1 + case "singlestat": + sort = 2 + case "table": + sort = 3 + case "text": + sort = 4 + case "alertlist": + sort = 5 + case "dashlist": + sort = 6 + } + return sort +} + func GetFrontendSettings(c *middleware.Context) { settings, err := getFrontendSettingsMap(c) if err != nil { diff --git a/public/app/core/routes/dashboard_loaders.js b/public/app/core/routes/dashboard_loaders.js index 3c16b15c9c3..8a5ce7ad7ed 100644 --- a/public/app/core/routes/dashboard_loaders.js +++ b/public/app/core/routes/dashboard_loaders.js @@ -31,7 +31,14 @@ function (coreModule) { meta: { canStar: false, canShare: false }, dashboard: { title: "New dashboard", - rows: [{title: 'Dashboard Row', height: '250px', panels:[] }] + rows: [ + { + title: 'Dashboard Row', + height: '250px', + panels:[], + isNew: true, + } + ] }, }, $scope); }); diff --git a/public/app/features/dashboard/dashboard_ctrl.ts b/public/app/features/dashboard/dashboard_ctrl.ts index 1dfe54c6636..8845717659d 100644 --- a/public/app/features/dashboard/dashboard_ctrl.ts +++ b/public/app/features/dashboard/dashboard_ctrl.ts @@ -107,6 +107,7 @@ export class DashboardCtrl { title: 'New row', panels: [], height: '250px', + isNew: true, }); }; diff --git a/public/app/features/dashboard/row/options.html b/public/app/features/dashboard/row/options.html index 19d3b92aeed..d30ffb78dc0 100644 --- a/public/app/features/dashboard/row/options.html +++ b/public/app/features/dashboard/row/options.html @@ -1,42 +1,77 @@