Allow removing single subexpression

Previously removing subexpression was disabled when only one
subexpression existed.

Closes-Bug: #1638826

Change-Id: I7fd4c85f36c3392fe442bded68c1a5192fa15e65
This commit is contained in:
Dobroslaw Zybort 2016-11-08 10:14:15 +01:00
parent 0ac460f322
commit e0cb958e29
2 changed files with 10 additions and 6 deletions

View File

@ -94,6 +94,11 @@ function monAlarmExpressionsDirective(staticPath){
applyConnectable();
touch();
if (vm.subExpressions.length === 0) {
vm.expression = '';
vm.subExpressions.push({});
}
return true;
}
@ -242,7 +247,6 @@ function monAlarmSubExpressionDirective(staticPath) {
vm.updateExpression = updateExpression;
vm.resetExpression = resetExpression;
vm.updateExpression = updateExpression;
// init
$scope.$on('$destroy', destroyerFactory());

View File

@ -78,7 +78,7 @@
role="button"
title="{$ 'Remove'|translate $}"
ng-class="{'btn-block': !expr.preview}"
ng-disabled="vm.subExpressions.length === 1"
ng-disabled="!expr.$valid"
ng-click="vm.removeExpression($event, $index)">
<span class="fa fa-minus"
aria-hidden="true"></span>