mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
More work on refactoring and changing graph axis edit view, #1331
This commit is contained in:
parent
3a27b610d5
commit
c39f9ed2f3
@ -37,7 +37,7 @@ function (angular, app, _, $) {
|
||||
|
||||
if (attrs.ngModel) {
|
||||
$scope.$watch('model', function(newValue) {
|
||||
_.each($scope.menuItems, function(item){
|
||||
_.each($scope.menuItems, function(item) {
|
||||
_.each(item.submenu, function(subItem) {
|
||||
if (subItem.value === newValue) {
|
||||
$button.html(subItem.text);
|
||||
|
@ -22,5 +22,17 @@ function (angular) {
|
||||
});
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('emptyToNull', function () {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, elm, attrs, ctrl) {
|
||||
ctrl.$parsers.push(function (viewValue) {
|
||||
if(viewValue === "") { return null; }
|
||||
return viewValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
@ -19,19 +19,24 @@
|
||||
Grid Max
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
empty-to-null ng-model="panel.grid.leftMax"
|
||||
ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Min
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
empty-to-null ng-model="panel.grid.leftMin"
|
||||
ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Label
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" value="">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
ng-model="panel.leftYAxisLabel" ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Show
|
||||
@ -56,19 +61,24 @@
|
||||
Grid Max
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
empty-to-null ng-model="panel.grid.rightMax"
|
||||
ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Min
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
empty-to-null ng-model="panel.grid.rightMin"
|
||||
ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Label
|
||||
</li>
|
||||
<li>
|
||||
<input type="text" class="input-small grafana-target-segment-input" value="">
|
||||
<input type="text" class="input-small grafana-target-segment-input" placeholder="auto"
|
||||
ng-model="panel.rightYAxisLabel" ng-change="render()" ng-model-onblur>
|
||||
</li>
|
||||
<li class="grafana-target-segment">
|
||||
Show
|
||||
|
@ -268,11 +268,6 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
|
||||
$scope.render();
|
||||
};
|
||||
|
||||
$scope.toggleGridMinMax = function(key) {
|
||||
$scope.panel.grid[key] = _.toggle($scope.panel.grid[key], null, 0);
|
||||
$scope.render();
|
||||
};
|
||||
|
||||
$scope.addSeriesOverride = function(override) {
|
||||
$scope.panel.seriesOverrides.push(override || {});
|
||||
};
|
||||
|
@ -16,15 +16,9 @@ define([
|
||||
ctx.scope.render = function() {};
|
||||
});
|
||||
|
||||
describe('Controller should init overrideMenu', function() {
|
||||
it('click should include option and value index', function() {
|
||||
expect(ctx.scope.overrideMenu[1].submenu[1].click).to.be('menuItemSelected(1,1)');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When setting an override', function() {
|
||||
beforeEach(function() {
|
||||
ctx.scope.setOverride(1, 0);
|
||||
ctx.scope.setOverride({propertyName: 'lines'}, {value: true});
|
||||
});
|
||||
|
||||
it('should set override property', function() {
|
||||
|
Loading…
Reference in New Issue
Block a user