Commit c39f9ed2 by Torkel Ödegaard

More work on refactoring and changing graph axis edit view, #1331

parent 3a27b610
......@@ -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 @@
&nbsp;&nbsp; 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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment