From 7afb6fa3e3d91cd28060874a261376554d8f553e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Apr 2016 11:20:03 -0400 Subject: [PATCH] ux(ds edit): combine save and test connection buttons, closes #4658 --- public/app/features/plugins/ds_edit_ctrl.ts | 13 ++++++++++--- public/app/features/plugins/partials/ds_edit.html | 8 ++------ public/sass/_variables.dark.scss | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/public/app/features/plugins/ds_edit_ctrl.ts b/public/app/features/plugins/ds_edit_ctrl.ts index b76407a90e8..e7e8014ed10 100644 --- a/public/app/features/plugins/ds_edit_ctrl.ts +++ b/public/app/features/plugins/ds_edit_ctrl.ts @@ -16,6 +16,8 @@ var defaults = { jsonData: {} }; +var datasourceCreated = false; + export class DataSourceEditCtrl { isNew: boolean; datasources: any[]; @@ -66,6 +68,11 @@ export class DataSourceEditCtrl { this.backendSrv.get('/api/datasources/' + id).then(ds => { this.isNew = false; this.current = ds; + + if (datasourceCreated) { + datasourceCreated = false; + this.testDatasource(); + } return this.typeChanged(); }); } @@ -123,14 +130,14 @@ export class DataSourceEditCtrl { if (this.current.id) { return this.backendSrv.put('/api/datasources/' + this.current.id, this.current).then(() => { this.updateFrontendSettings().then(() => { - if (test) { - this.testDatasource(); - } + this.testDatasource(); }); }); } else { return this.backendSrv.post('/api/datasources', this.current).then(result => { this.updateFrontendSettings(); + + datasourceCreated = true; this.$location.path('datasources/edit/' + result.id); }); } diff --git a/public/app/features/plugins/partials/ds_edit.html b/public/app/features/plugins/partials/ds_edit.html index 9ff82027abf..54254169b0b 100644 --- a/public/app/features/plugins/partials/ds_edit.html +++ b/public/app/features/plugins/partials/ds_edit.html @@ -25,7 +25,7 @@
-
+
@@ -55,7 +55,6 @@
Testing....
-
Test results
{{ctrl.testing.title}}
@@ -64,10 +63,7 @@
- - + diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index f0b55dbf381..75d7a67c547 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -27,7 +27,7 @@ $white: #fff; // ------------------------- $blue: #33B5E5; $blue-dark: #005f81; -$green: #669900; +$green: #609000; $red: #CC3900; $yellow: #ECBB13; $pink: #FF4444;