mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' into react-mobx
This commit is contained in:
commit
8aff969f70
@ -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)) {
|
||||
|
@ -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',
|
||||
|
@ -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) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
<i class="fa fa-share-square-o"></i></a>
|
||||
</button>
|
||||
|
||||
<button class="btn navbar-button navbar-button--save" ng-show="::ctrl.dashboard.meta.canSave" ng-click="ctrl.saveDashboard()" bs-tooltip="'Save dashboard <br> CTRL+S'" data-placement="bottom">
|
||||
<button class="btn navbar-button navbar-button--save" ng-show="ctrl.dashboard.meta.canSave" ng-click="ctrl.saveDashboard()" bs-tooltip="'Save dashboard <br> CTRL+S'" data-placement="bottom">
|
||||
<i class="fa fa-save"></i>
|
||||
</button>
|
||||
|
||||
|
@ -4,47 +4,47 @@ import coreModule from 'app/core/core_module';
|
||||
|
||||
const template = `
|
||||
<div class="modal-body">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-header-title">
|
||||
<i class="fa fa-save"></i>
|
||||
<span class="p-l-1">Save changes</span>
|
||||
</h2>
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-header-title">
|
||||
<i class="fa fa-save"></i>
|
||||
<span class="p-l-1">Save changes</span>
|
||||
</h2>
|
||||
|
||||
<a class="modal-header-close" ng-click="ctrl.dismiss();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
</div>
|
||||
<a class="modal-header-close" ng-click="ctrl.dismiss();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<form name="ctrl.saveForm" ng-submit="ctrl.save()" class="modal-content" novalidate>
|
||||
<h6 class="text-center">Add a note to describe your changes</h6>
|
||||
<div class="p-t-2">
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-hint">
|
||||
<input
|
||||
type="text"
|
||||
name="message"
|
||||
class="gf-form-input"
|
||||
placeholder="Updates to …"
|
||||
give-focus="true"
|
||||
ng-model="ctrl.message"
|
||||
ng-model-options="{allowInvalid: true}"
|
||||
ng-maxlength="this.max"
|
||||
autocomplete="off" />
|
||||
<small class="gf-form-hint-text muted" ng-cloak>
|
||||
<span ng-class="{'text-error': ctrl.saveForm.message.$invalid && ctrl.saveForm.message.$dirty }">
|
||||
{{ctrl.message.length || 0}}
|
||||
</span>
|
||||
/ {{ctrl.max}} characters
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<form name="ctrl.saveForm" ng-submit="ctrl.save()" class="modal-content" novalidate>
|
||||
<h6 class="text-center">Add a note to describe your changes</h6>
|
||||
<div class="p-t-2">
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-hint">
|
||||
<input
|
||||
type="text"
|
||||
name="message"
|
||||
class="gf-form-input"
|
||||
placeholder="Updates to …"
|
||||
give-focus="true"
|
||||
ng-model="ctrl.message"
|
||||
ng-model-options="{allowInvalid: true}"
|
||||
ng-maxlength="this.max"
|
||||
autocomplete="off" />
|
||||
<small class="gf-form-hint-text muted" ng-cloak>
|
||||
<span ng-class="{'text-error': ctrl.saveForm.message.$invalid && ctrl.saveForm.message.$dirty }">
|
||||
{{ctrl.message.length || 0}}
|
||||
</span>
|
||||
/ {{ctrl.max}} characters
|
||||
</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-button-row text-center">
|
||||
<button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Save</button>
|
||||
<button class="btn btn-inverse" ng-click="ctrl.dismiss();">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="gf-form-button-row text-center">
|
||||
<button type="submit" class="btn btn-success" ng-disabled="ctrl.saveForm.$invalid">Save</button>
|
||||
<button class="btn btn-inverse" ng-click="ctrl.dismiss();">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
`;
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -39,7 +39,7 @@
|
||||
<div class="gf-form">
|
||||
<label class="gf-form-label width-13">Default Region</label>
|
||||
<div class="gf-form-select-wrapper max-width-18 gf-form-select-wrapper--has-help-icon">
|
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultRegion" ng-options="region for region in ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'ca-central-1', 'cn-north-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-west-1', 'us-west-1', 'us-west-2']"></select>
|
||||
<select class="gf-form-input" ng-model="ctrl.current.jsonData.defaultRegion" ng-options="region for region in ['ap-northeast-1', 'ap-northeast-2', 'ap-southeast-1', 'ap-southeast-2', 'ap-south-1', 'ca-central-1', 'cn-north-1', 'cn-northwest-1', 'eu-central-1', 'eu-west-1', 'eu-west-2', 'sa-east-1', 'us-east-1', 'us-east-2', 'us-gov-west-1', 'us-west-1', 'us-west-2']"></select>
|
||||
<info-popover mode="right-absolute">
|
||||
Specify the region, such as for US West (Oregon) use ` us-west-2 ` as the region.
|
||||
</info-popover>
|
||||
|
@ -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');
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user