From 9c35d3f87c3c5ca5f8d9db4f6e3dbdb6dc2d09cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E5=AD=90=E5=AE=BD?= Date: Fri, 19 May 2017 11:38:28 +0800 Subject: [PATCH 001/130] Add kibana like readable label to elasticsearch query builder --- .../datasource/elasticsearch/partials/bucket_agg.html | 2 ++ public/app/plugins/datasource/elasticsearch/query_builder.js | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html index f1e650f6830..ea60ac76958 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html +++ b/public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html @@ -96,6 +96,8 @@
+ +
+ + +
+
+
+ + +
+
+ + Fetching changes… +
+ +
+ +   Restore to version {{new}} + +

+ Comparing Version {{ctrl.selected[0]}} + + Version {{ctrl.selected[1]}} + (Current) +

+
+

+ Version {{new}} updated by + {{ctrl.getMeta(new, 'createdBy')}} + {{ctrl.formatBasicDate(ctrl.getMeta(new, 'created'))}} + - {{ctrl.getMeta(new, 'message')}} +

+

+ Version {{original}} updated by + {{ctrl.getMeta(original, 'createdBy')}} + {{ctrl.formatBasicDate(ctrl.getMeta(original, 'created'))}} + - {{ctrl.getMeta(original, 'message')}} +

+
+
+
+
+
+
+
+
+
+
+ +
+
diff --git a/public/app/features/dashboard/audit/partials/link-json.html b/public/app/features/dashboard/audit/partials/link-json.html new file mode 100644 index 00000000000..0ad398486c8 --- /dev/null +++ b/public/app/features/dashboard/audit/partials/link-json.html @@ -0,0 +1,4 @@ + + Line {{ line }} + + diff --git a/public/app/features/dashboard/dashboard_srv.ts b/public/app/features/dashboard/dashboard_srv.ts index 5939ff83a15..b075af7352e 100644 --- a/public/app/features/dashboard/dashboard_srv.ts +++ b/public/app/features/dashboard/dashboard_srv.ts @@ -23,32 +23,7 @@ export class DashboardSrv { return this.dash; } - saveDashboard(options) { - if (!this.dash.meta.canSave && options.makeEditable !== true) { - return Promise.resolve(); - } - - if (this.dash.title === 'New dashboard') { - return this.saveDashboardAs(); - } - - var clone = this.dash.getSaveModelClone(); - - return this.backendSrv.saveDashboard(clone, options).then(data => { - this.dash.version = data.version; - - this.$rootScope.appEvent('dashboard-saved', this.dash); - - var dashboardUrl = '/dashboard/db/' + data.slug; - if (dashboardUrl !== this.$location.path()) { - this.$location.url(dashboardUrl); - } - - this.$rootScope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + clone.title]); - }).catch(this.handleSaveDashboardError.bind(this)); - } - - handleSaveDashboardError(err) { + handleSaveDashboardError(clone, err) { if (err.data && err.data.status === "version-mismatch") { err.isHandled = true; @@ -59,7 +34,7 @@ export class DashboardSrv { yesText: "Save & Overwrite", icon: "fa-warning", onConfirm: () => { - this.saveDashboard({overwrite: true}); + this.saveDashboard({overwrite: true}, clone); } }); } @@ -74,7 +49,7 @@ export class DashboardSrv { yesText: "Save & Overwrite", icon: "fa-warning", onConfirm: () => { - this.saveDashboard({overwrite: true}); + this.saveDashboard({overwrite: true}, clone); } }); } @@ -93,12 +68,50 @@ export class DashboardSrv { this.saveDashboardAs(); }, onConfirm: () => { - this.saveDashboard({overwrite: true}); + this.saveDashboard({overwrite: true}, clone); } }); } } + postSave(clone, data) { + this.dash.version = data.version; + + var dashboardUrl = '/dashboard/db/' + data.slug; + if (dashboardUrl !== this.$location.path()) { + this.$location.url(dashboardUrl); + } + + this.$rootScope.appEvent('dashboard-saved', this.dash); + this.$rootScope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + clone.title]); + } + + save(clone, options) { + return this.backendSrv.saveDashboard(clone, options) + .then(this.postSave.bind(this, clone)) + .catch(this.handleSaveDashboardError.bind(this, clone)); + } + + saveDashboard(options, clone) { + if (clone) { + this.setCurrent(this.create(clone, this.dash.meta)); + } + + if (!this.dash.meta.canSave && options.makeEditable !== true) { + return Promise.resolve(); + } + + if (this.dash.title === 'New dashboard') { + return this.saveDashboardAs(); + } + + if (this.dash.version > 0) { + return this.saveDashboardMessage(); + } + + return this.save(this.dash.getSaveModelClone(), options); + } + saveDashboardAs() { var newScope = this.$rootScope.$new(); newScope.clone = this.dash.getSaveModelClone(); @@ -112,6 +125,16 @@ export class DashboardSrv { }); } + saveDashboardMessage() { + var newScope = this.$rootScope.$new(); + newScope.clone = this.dash.getSaveModelClone(); + + this.$rootScope.appEvent('show-modal', { + src: 'public/app/features/dashboard/partials/saveDashboardMessage.html', + scope: newScope, + modalClass: 'modal--narrow' + }); + } } coreModule.service('dashboardSrv', DashboardSrv); diff --git a/public/app/features/dashboard/dashnav/dashnav.html b/public/app/features/dashboard/dashnav/dashnav.html index 7deb46931c2..36e523cd189 100644 --- a/public/app/features/dashboard/dashnav/dashnav.html +++ b/public/app/features/dashboard/dashnav/dashnav.html @@ -56,7 +56,8 @@
  • - + +
  • @@ -66,6 +67,7 @@