From bff174dba90a5467ecef62961d49fdd13b53f512 Mon Sep 17 00:00:00 2001 From: Andrzej Ressel Date: Wed, 11 Apr 2018 22:59:29 +0200 Subject: [PATCH] PR comments --- .../features/dashboard/settings/settings.html | 8 ++++-- .../features/dashboard/settings/settings.ts | 27 ++++++++++++------- .../sass/components/_dashboard_settings.scss | 4 +++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/public/app/features/dashboard/settings/settings.html b/public/app/features/dashboard/settings/settings.html index 5103fab8b75..3e9796239dc 100644 --- a/public/app/features/dashboard/settings/settings.html +++ b/public/app/features/dashboard/settings/settings.html @@ -87,12 +87,16 @@ -
-

View JSON

+
+

Dashboard JSON

+ +
diff --git a/public/app/features/dashboard/settings/settings.ts b/public/app/features/dashboard/settings/settings.ts index 9949b52dd45..0f940c422e1 100755 --- a/public/app/features/dashboard/settings/settings.ts +++ b/public/app/features/dashboard/settings/settings.ts @@ -17,7 +17,14 @@ export class SettingsCtrl { hasUnsavedFolderChange: boolean; /** @ngInject */ - constructor(private $scope, private $location, private $rootScope, private backendSrv, private dashboardSrv) { + constructor( + private $scope, + private $route, + private $location, + private $rootScope, + private backendSrv, + private dashboardSrv + ) { // temp hack for annotations and variables editors // that rely on inherited scope $scope.dashboard = this.dashboard; @@ -93,8 +100,8 @@ export class SettingsCtrl { } this.sections.push({ - title: 'View JSON', - id: 'view_json', + title: 'Dashboard JSON', + id: 'dashboard_json', icon: 'gicon gicon-json', }); @@ -134,13 +141,13 @@ export class SettingsCtrl { } saveDashboard() { - if (this.viewId === 'view_json') { - this.dashboardSrv.saveJSONDashboard(this.json).then(() => { - window.location.reload(); - }); - } else { - this.dashboardSrv.saveDashboard(); - } + this.dashboardSrv.saveDashboard(); + } + + saveDashboardJson() { + this.dashboardSrv.saveJSONDashboard(this.json).then(() => { + this.$route.reload(); + }); } onPostSave() { diff --git a/public/sass/components/_dashboard_settings.scss b/public/sass/components/_dashboard_settings.scss index 11d943eb13c..873da7f4935 100644 --- a/public/sass/components/_dashboard_settings.scss +++ b/public/sass/components/_dashboard_settings.scss @@ -80,3 +80,7 @@ margin-bottom: 10px; } } + +.dashboard-settings__json-save-button { + margin-top: $spacer; +}