diff --git a/public/app/core/services/backend_srv.ts b/public/app/core/services/backend_srv.ts index 73269403312..1e351054b6d 100644 --- a/public/app/core/services/backend_srv.ts +++ b/public/app/core/services/backend_srv.ts @@ -235,42 +235,54 @@ export class BackendSrv { createDashboardFolder(name) { const dash = { + schemaVersion: 16, title: name, editable: true, hideControls: true, - rows: [ + panels: [ { - panels: [ - { - folderId: 0, - headings: false, - limit: 1000, - links: [], - query: '', - recent: false, - search: true, - span: 4, - starred: false, - tags: [], - title: 'Dashboards in this folder', - type: 'dashlist' - }, - { - onlyAlertsOnDashboard: true, - span: 4, - title: 'Alerts in this folder', - type: 'alertlist' - }, - { - span: 4, - title: 'Permissions for this folder', - type: 'permissionlist', - folderId: 0 - } - ], - showTitle: true, - title: name, - titleSize: 'h1' + id: 1, + folderId: 0, + headings: false, + limit: 1000, + links: [], + query: '', + recent: false, + search: true, + starred: false, + tags: [], + title: 'Dashboards in this folder', + type: 'dashlist', + gridPos: { + x: 0, + y: 0, + w: 4, + h: 10 + } + }, + { + id: 2, + onlyAlertsOnDashboard: true, + title: 'Alerts in this folder', + type: 'alertlist', + gridPos: { + x: 4, + y: 0, + w: 4, + h: 10 + } + }, + { + id: 3, + title: 'Permissions for this folder', + type: 'permissionlist', + folderId: 0, + gridPos: { + x: 8, + y: 0, + w: 4, + h: 10 + } } ] }; @@ -280,8 +292,8 @@ export class BackendSrv { return this.getDashboard('db', res.slug); }) .then(res => { - res.dashboard.rows[0].panels[0].folderId = res.dashboard.id; - res.dashboard.rows[0].panels[2].folderId = res.dashboard.id; + res.dashboard.panels[0].folderId = res.dashboard.id; + res.dashboard.panels[2].folderId = res.dashboard.id; return this.saveDashboard(res.dashboard, {overwrite: false}); }); } diff --git a/public/app/features/dashboard/PanelModel.ts b/public/app/features/dashboard/PanelModel.ts index 8ad04f9f220..de086170b20 100644 --- a/public/app/features/dashboard/PanelModel.ts +++ b/public/app/features/dashboard/PanelModel.ts @@ -18,6 +18,7 @@ export class PanelModel { gridPos: GridPos; type: string; title: string; + alert?: any; // non persisted fullscreen: boolean; diff --git a/public/app/features/dashboard/dashnav/dashnav.ts b/public/app/features/dashboard/dashnav/dashnav.ts index d729d4f88bd..4b2587d8ed3 100644 --- a/public/app/features/dashboard/dashnav/dashnav.ts +++ b/public/app/features/dashboard/dashnav/dashnav.ts @@ -92,16 +92,16 @@ export class DashNavCtrl { } deleteDashboard() { - var confirmText = ""; + var confirmText = ''; var text2 = this.dashboard.title; - var alerts = this.dashboard.rows.reduce((memo, row) => { - memo += row.panels.filter(panel => panel.alert).length; - return memo; - }, 0); + + const alerts = _.sumBy(this.dashboard.panels, panel => { + return panel.alert ? 1 : 0; + }); if (alerts > 0) { confirmText = 'DELETE'; - text2 = `This dashboard contains ${alerts} alerts. Deleting this dashboad will also delete those alerts`; + text2 = `This dashboard contains ${alerts} alerts. Deleting this dashboard will also delete those alerts`; } appEvents.emit('confirm-modal', { diff --git a/scripts/webpack/webpack.dev.js b/scripts/webpack/webpack.dev.js index 037212c26de..1ed9a412fdf 100644 --- a/scripts/webpack/webpack.dev.js +++ b/scripts/webpack/webpack.dev.js @@ -10,7 +10,7 @@ const WebpackCleanupPlugin = require('webpack-cleanup-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; module.exports = merge(common, { - devtool: "eval-source-map", + devtool: "cheap-module-source-map", entry: { dark: './public/sass/grafana.dark.scss',