diff --git a/public/app/features/dashboard/dashboard_srv.ts b/public/app/features/dashboard/dashboard_srv.ts
index 1890323da29..b1419df7376 100644
--- a/public/app/features/dashboard/dashboard_srv.ts
+++ b/public/app/features/dashboard/dashboard_srv.ts
@@ -100,7 +100,7 @@ export class DashboardSrv {
.catch(this.handleSaveDashboardError.bind(this, clone, options));
}
- saveDashboard(options, clone) {
+ saveDashboard(options?, clone?) {
if (clone) {
this.setCurrent(this.create(clone, this.dash.meta));
}
@@ -124,6 +124,10 @@ export class DashboardSrv {
return this.save(this.dash.getSaveModelClone(), options);
}
+ saveJSONDashboard(json: string) {
+ return this.save(JSON.parse(json), {});
+ }
+
showDashboardProvisionedModal() {
this.$rootScope.appEvent('show-modal', {
templateHtml: '',
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 @@
-
-
+
diff --git a/public/app/features/dashboard/settings/settings.ts b/public/app/features/dashboard/settings/settings.ts
index 68fd20a3b91..0d24dc7c7cf 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',
});
@@ -137,6 +144,12 @@ export class SettingsCtrl {
this.dashboardSrv.saveDashboard();
}
+ saveDashboardJson() {
+ this.dashboardSrv.saveJSONDashboard(this.json).then(() => {
+ this.$route.reload();
+ });
+ }
+
onPostSave() {
this.hasUnsavedFolderChange = false;
}
diff --git a/public/sass/components/_dashboard_settings.scss b/public/sass/components/_dashboard_settings.scss
index 2c709f1ddf9..49154b0b485 100644
--- a/public/sass/components/_dashboard_settings.scss
+++ b/public/sass/components/_dashboard_settings.scss
@@ -85,3 +85,7 @@
margin-bottom: 10px;
}
}
+
+.dashboard-settings__json-save-button {
+ margin-top: $spacer;
+}