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:
parent
0ac460f322
commit
e0cb958e29
|
@ -94,6 +94,11 @@ function monAlarmExpressionsDirective(staticPath){
|
||||||
applyConnectable();
|
applyConnectable();
|
||||||
touch();
|
touch();
|
||||||
|
|
||||||
|
if (vm.subExpressions.length === 0) {
|
||||||
|
vm.expression = '';
|
||||||
|
vm.subExpressions.push({});
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +247,6 @@ function monAlarmSubExpressionDirective(staticPath) {
|
||||||
|
|
||||||
vm.updateExpression = updateExpression;
|
vm.updateExpression = updateExpression;
|
||||||
vm.resetExpression = resetExpression;
|
vm.resetExpression = resetExpression;
|
||||||
vm.updateExpression = updateExpression;
|
|
||||||
|
|
||||||
// init
|
// init
|
||||||
$scope.$on('$destroy', destroyerFactory());
|
$scope.$on('$destroy', destroyerFactory());
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
role="button"
|
role="button"
|
||||||
title="{$ 'Remove'|translate $}"
|
title="{$ 'Remove'|translate $}"
|
||||||
ng-class="{'btn-block': !expr.preview}"
|
ng-class="{'btn-block': !expr.preview}"
|
||||||
ng-disabled="vm.subExpressions.length === 1"
|
ng-disabled="!expr.$valid"
|
||||||
ng-click="vm.removeExpression($event, $index)">
|
ng-click="vm.removeExpression($event, $index)">
|
||||||
<span class="fa fa-minus"
|
<span class="fa fa-minus"
|
||||||
aria-hidden="true"></span>
|
aria-hidden="true"></span>
|
||||||
|
|
Loading…
Reference in New Issue