mirror of https://github.com/portainer/portainer
feat(services): bind enter key when scaling a service (#1560)
parent
f52ac8fb12
commit
46da85c8cf
|
@ -1,11 +1,10 @@
|
||||||
angular
|
angular.module('portainer')
|
||||||
.module('portainer')
|
|
||||||
.directive('autoFocus', ['$timeout', function porAutoFocus($timeout) {
|
.directive('autoFocus', ['$timeout', function porAutoFocus($timeout) {
|
||||||
var directive = {
|
var directive = {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function($scope, $element) {
|
link: function(scope, element) {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$element[0].focus();
|
element[0].focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
angular.module('portainer')
|
||||||
|
.directive('onEnterKey', [function porOnEnterKey() {
|
||||||
|
var directive = {
|
||||||
|
restrict: 'A',
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
element.bind('keydown keypress', function (e) {
|
||||||
|
if ( e.which === 13 ) {
|
||||||
|
e.preventDefault();
|
||||||
|
scope.$apply(function () {
|
||||||
|
scope.$eval(attrs.onEnterKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return directive;
|
||||||
|
}]);
|
|
@ -108,7 +108,7 @@
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<span ng-if="item.Mode === 'replicated' && item.Scale">
|
<span ng-if="item.Mode === 'replicated' && item.Scale">
|
||||||
<input class="input-sm" type="number" ng-model="item.Replicas" />
|
<input class="input-sm" type="number" ng-model="item.Replicas" on-enter-key="$ctrl.scaleAction(item)" />
|
||||||
<a class="interactive" ng-click="item.Scale = false;"><i class="fa fa-times"></i></a>
|
<a class="interactive" ng-click="item.Scale = false;"><i class="fa fa-times"></i></a>
|
||||||
<a class="interactive" ng-click="$ctrl.scaleAction(item)"><i class="fa fa-check-square-o"></i></a>
|
<a class="interactive" ng-click="$ctrl.scaleAction(item)"><i class="fa fa-check-square-o"></i></a>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in New Issue