From cfa775e0128053028d5b17627beea480128aa8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 18 Jan 2018 18:17:58 +0100 Subject: [PATCH] ds: updated ds nav --- pkg/api/index.go | 2 +- public/app/features/plugins/ds_dashboards_ctrl.ts | 6 ++++++ public/app/features/plugins/ds_edit_ctrl.ts | 15 ++++++--------- .../features/plugins/partials/ds_dashboards.html | 7 ++----- public/app/routes/routes.ts | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkg/api/index.go b/pkg/api/index.go index 1a086f5fe0d..5beecefab88 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -261,7 +261,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { if c.IsGrafanaAdmin { cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{ - Divider: true, HideFromTabs: true, + Divider: true, HideFromTabs: true, Id: "admin-divider", Text: "Text", }) cfgNode.Children = append(cfgNode.Children, &dtos.NavLink{ Text: "Server Admin", diff --git a/public/app/features/plugins/ds_dashboards_ctrl.ts b/public/app/features/plugins/ds_dashboards_ctrl.ts index 950fe2a04bd..ed7800698b7 100644 --- a/public/app/features/plugins/ds_dashboards_ctrl.ts +++ b/public/app/features/plugins/ds_dashboards_ctrl.ts @@ -9,6 +9,12 @@ export class DataSourceDashboardsCtrl { /** @ngInject */ constructor(private backendSrv, private $routeParams) { + if (store.nav.main === null) { + store.nav.load('cfg', 'datasources'); + } + + this.navModel = toJS(store.nav); + if (this.$routeParams.id) { this.getDatasourceById(this.$routeParams.id); } diff --git a/public/app/features/plugins/ds_edit_ctrl.ts b/public/app/features/plugins/ds_edit_ctrl.ts index b3de80d8bba..b98f0f48910 100644 --- a/public/app/features/plugins/ds_edit_ctrl.ts +++ b/public/app/features/plugins/ds_edit_ctrl.ts @@ -29,15 +29,12 @@ export class DataSourceEditCtrl { navModel: any; /** @ngInject */ - constructor( - private $q, - private backendSrv, - private $routeParams, - private $location, - private datasourceSrv, - navModelSrv - ) { - this.navModel = navModelSrv.getNav('cfg', 'datasources', 0); + constructor(private $q, private backendSrv, private $routeParams, private $location, private datasourceSrv) { + if (store.nav.main === null) { + store.nav.load('cfg', 'datasources'); + } + + this.navModel = toJS(store.nav); this.datasources = []; this.loadDatasourceTypes().then(() => { diff --git a/public/app/features/plugins/partials/ds_dashboards.html b/public/app/features/plugins/partials/ds_dashboards.html index 50be10819b5..a442e37d1f6 100644 --- a/public/app/features/plugins/partials/ds_dashboards.html +++ b/public/app/features/plugins/partials/ds_dashboards.html @@ -1,10 +1,7 @@ -
+
-

Bundled Plugin Dashboards

-
- -
+
diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index 917c80c0e7a..57908bd50cb 100644 --- a/public/app/routes/routes.ts +++ b/public/app/routes/routes.ts @@ -50,7 +50,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { }) .when('/datasources/edit/:id/dashboards', { templateUrl: 'public/app/features/plugins/partials/ds_dashboards.html', - controller: 'DataSourceEditCtrl', + controller: 'DataSourceDashboardsCtrl', controllerAs: 'ctrl', }) .when('/datasources/new', {