auto-focus first input in jt launch modal

This commit is contained in:
Keith Grant
2019-04-01 15:49:41 -04:00
parent 7b16931658
commit e943ae59b7
2 changed files with 9 additions and 2 deletions

View File

@@ -12,7 +12,7 @@ export default
let scope; let scope;
vm.init = (_scope_) => { vm.init = (_scope_, controller, el) => {
scope = _scope_; scope = _scope_;
scope.parseType = 'yaml'; scope.parseType = 'yaml';
@@ -102,6 +102,13 @@ export default
return ToJSON(scope.parseType, scope.extraVariables, true); return ToJSON(scope.parseType, scope.extraVariables, true);
} }
scope.validate = validate; scope.validate = validate;
angular.element(el).ready(() => {
const inputs = el.find('input, select');
if (inputs.length) {
inputs.get(0).focus();
}
});
}; };

View File

@@ -28,7 +28,7 @@ export default [ 'templateUrl',
const launchController = controllers[0]; const launchController = controllers[0];
const promptOtherPromptsController = controllers[1]; const promptOtherPromptsController = controllers[1];
promptOtherPromptsController.init(scope, launchController); promptOtherPromptsController.init(scope, launchController, el);
} }
}; };
}]; }];