From 78b9c3004a713681b61837b0d2b1c819e0e75e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Thu, 10 Mar 2016 14:28:31 +0100 Subject: [PATCH] feat(plugins): minor progress on dashboard imports --- public/app/core/routes/routes.ts | 1 + .../dashboard/import_list/import_list.ts | 23 +++-- public/app/features/datasources/edit_ctrl.ts | 5 + .../features/datasources/partials/edit.html | 91 ++++++++++--------- .../plugins/datasource/graphite/plugin.json | 3 +- 5 files changed, 71 insertions(+), 52 deletions(-) diff --git a/public/app/core/routes/routes.ts b/public/app/core/routes/routes.ts index 2b035650c76..91ef4cd8b25 100644 --- a/public/app/core/routes/routes.ts +++ b/public/app/core/routes/routes.ts @@ -63,6 +63,7 @@ function setupAngularRoutes($routeProvider, $locationProvider) { .when('/datasources/new', { templateUrl: 'public/app/features/datasources/partials/edit.html', controller : 'DataSourceEditCtrl', + controllerAs: 'ctrl', resolve: loadOrgBundle, }) .when('/org', { diff --git a/public/app/features/dashboard/import_list/import_list.ts b/public/app/features/dashboard/import_list/import_list.ts index d8333bec4fa..b4fe3c36352 100644 --- a/public/app/features/dashboard/import_list/import_list.ts +++ b/public/app/features/dashboard/import_list/import_list.ts @@ -31,14 +31,21 @@ export class DashImportListCtrl { var template = `
-

Dashboards

-
- - - -
+ + + + + + + +
+ + + {{dash.name}} + + +
`; diff --git a/public/app/features/datasources/edit_ctrl.ts b/public/app/features/datasources/edit_ctrl.ts index eafee0d427a..b766d6cda84 100644 --- a/public/app/features/datasources/edit_ctrl.ts +++ b/public/app/features/datasources/edit_ctrl.ts @@ -22,6 +22,8 @@ export class DataSourceEditCtrl { types: any; testing: any; datasourceMeta: any; + tabIndex: number; + hasDashboards: boolean; /** @ngInject */ constructor( @@ -34,6 +36,7 @@ export class DataSourceEditCtrl { this.isNew = true; this.datasources = []; + this.tabIndex = 0; this.loadDatasourceTypes().then(() => { if (this.$routeParams.id) { @@ -66,8 +69,10 @@ export class DataSourceEditCtrl { } typeChanged() { + this.hasDashboards = false; return this.backendSrv.get('/api/org/plugins/' + this.current.type + '/settings').then(pluginInfo => { this.datasourceMeta = pluginInfo; + this.hasDashboards = _.findWhere(pluginInfo.includes, {type: 'dashboard'}); }); } diff --git a/public/app/features/datasources/partials/edit.html b/public/app/features/datasources/partials/edit.html index c8840321f40..fa1e0cee104 100644 --- a/public/app/features/datasources/partials/edit.html +++ b/public/app/features/datasources/partials/edit.html @@ -11,12 +11,12 @@