diff --git a/public/app/core/time_series2.ts b/public/app/core/time_series2.ts index 5d9963977de..3e02b1ec939 100644 --- a/public/app/core/time_series2.ts +++ b/public/app/core/time_series2.ts @@ -28,9 +28,10 @@ export function updateLegendValues(data: TimeSeries[], panel) { for (let i = 0; i < data.length; i++) { let series = data[i]; let yaxes = panel.yaxes; - let axis = yaxes[series.yaxis - 1]; + const seriesYAxis = series.yaxis || 1; + let axis = yaxes[seriesYAxis - 1]; let { tickDecimals, scaledDecimals } = getFlotTickDecimals(data, axis); - let formater = kbn.valueFormats[panel.yaxes[series.yaxis - 1].format]; + let formater = kbn.valueFormats[panel.yaxes[seriesYAxis - 1].format]; // decimal override if (_.isNumber(panel.decimals)) { diff --git a/public/app/features/dashboard/dashboard_loader_srv.ts b/public/app/features/dashboard/dashboard_loader_srv.ts index d429d7f0a7d..e4def4385e1 100644 --- a/public/app/features/dashboard/dashboard_loader_srv.ts +++ b/public/app/features/dashboard/dashboard_loader_srv.ts @@ -20,7 +20,7 @@ export class DashboardLoaderSrv { private $rootScope ) {} - _dashboardLoadFailed(title, snapshot) { + _dashboardLoadFailed(title, snapshot?) { snapshot = snapshot || false; return { meta: { @@ -74,9 +74,9 @@ export class DashboardLoaderSrv { var url = 'public/dashboards/' + file.replace(/\.(?!js)/, '/') + '?' + new Date().getTime(); return this.$http({ url: url, method: 'GET' }) - .then(this._executeScript) + .then(this._executeScript.bind(this)) .then( - function(result) { + result => { return { meta: { fromScript: true, @@ -87,7 +87,7 @@ export class DashboardLoaderSrv { dashboard: result.data, }; }, - function(err) { + err => { console.log('Script dashboard error ' + err); this.$rootScope.appEvent('alert-error', [ 'Script Error', diff --git a/public/app/features/dashboard/dashboard_srv.ts b/public/app/features/dashboard/dashboard_srv.ts index d822e020afe..298dfc2966c 100644 --- a/public/app/features/dashboard/dashboard_srv.ts +++ b/public/app/features/dashboard/dashboard_srv.ts @@ -80,6 +80,8 @@ export class DashboardSrv { this.$rootScope.appEvent('dashboard-saved', this.dash); this.$rootScope.appEvent('alert-success', ['Dashboard saved']); + + return this.dash; } save(clone, options) { diff --git a/public/app/features/dashboard/dashnav/dashnav.html b/public/app/features/dashboard/dashnav/dashnav.html index 9ebf6d4ef67..269d4b0bada 100644 --- a/public/app/features/dashboard/dashnav/dashnav.html +++ b/public/app/features/dashboard/dashnav/dashnav.html @@ -29,7 +29,7 @@ - diff --git a/public/app/features/dashboard/save_modal.ts b/public/app/features/dashboard/save_modal.ts index 69419b88cd1..5b1730c0135 100644 --- a/public/app/features/dashboard/save_modal.ts +++ b/public/app/features/dashboard/save_modal.ts @@ -4,47 +4,47 @@ import coreModule from 'app/core/core_module'; const template = ` `; diff --git a/public/app/features/dashboard/settings/settings.ts b/public/app/features/dashboard/settings/settings.ts index 4abec3714a5..e68b771bcb2 100644 --- a/public/app/features/dashboard/settings/settings.ts +++ b/public/app/features/dashboard/settings/settings.ts @@ -69,8 +69,8 @@ export class SettingsCtrl { if (this.dashboard.meta.canMakeEditable) { this.sections.push({ - title: 'Make Editable', - icon: 'fa fa-fw fa-edit', + title: 'General', + icon: 'gicon gicon-preferences', id: 'make_editable', }); } @@ -128,11 +128,15 @@ export class SettingsCtrl { makeEditable() { this.dashboard.editable = true; + this.dashboard.meta.canMakeEditable = false; + this.dashboard.meta.canEdit = true; + this.dashboard.meta.canSave = true; + this.canDelete = true; + this.viewId = 'settings'; + this.buildSectionList(); - return this.dashboardSrv.saveDashboard({ makeEditable: true, overwrite: false }).then(() => { - // force refresh whole page - window.location.href = window.location.href; - }); + const currentSection = _.find(this.sections, { id: this.viewId }); + this.$location.url(currentSection.url); } deleteDashboard() { diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 2a19e95f88c..6f383aaf826 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -39,7 +39,7 @@
- + Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region. diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index 95f40fad02a..a4ddeec7777 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -13,7 +13,7 @@ import _ from 'lodash'; import moment from 'moment'; import kbn from 'app/core/utils/kbn'; import { tickStep } from 'app/core/utils/ticks'; -import { appEvents, coreModule } from 'app/core/core'; +import { appEvents, coreModule, updateLegendValues } from 'app/core/core'; import GraphTooltip from './graph_tooltip'; import { ThresholdManager } from './threshold_manager'; import { EventManager } from 'app/features/annotations/all'; @@ -62,6 +62,8 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) { } annotations = ctrl.annotations || []; buildFlotPairs(data); + updateLegendValues(data, panel); + ctrl.events.emit('render-legend'); }); diff --git a/public/app/plugins/panel/graph/legend.ts b/public/app/plugins/panel/graph/legend.ts index 0ded048f8d6..5db0a122b31 100644 --- a/public/app/plugins/panel/graph/legend.ts +++ b/public/app/plugins/panel/graph/legend.ts @@ -2,7 +2,6 @@ import angular from 'angular'; import _ from 'lodash'; import $ from 'jquery'; import PerfectScrollbar from 'perfect-scrollbar'; -import { updateLegendValues } from 'app/core/core'; var module = angular.module('grafana.directives'); @@ -31,10 +30,6 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { ctrl.events.emit('legend-rendering-complete'); }); - function updateLegendDecimals() { - updateLegendValues(data, panel); - } - function getSeriesIndexForElement(el) { return el.parents('[data-series-index]').data('series-index'); } @@ -166,10 +161,7 @@ module.directive('graphLegend', function(popoverSrv, $timeout) { // render first time for getting proper legend height if (!panel.legend.rightSide) { renderLegendElement(tableHeaderElem); - updateLegendDecimals(); elem.empty(); - } else { - updateLegendDecimals(); } renderLegendElement(tableHeaderElem);