From e943ae59b7f6932bc38ade07709bd144f0d4ccf8 Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Mon, 1 Apr 2019 15:49:41 -0400 Subject: [PATCH] auto-focus first input in jt launch modal --- .../other-prompts/prompt-other-prompts.controller.js | 9 ++++++++- .../other-prompts/prompt-other-prompts.directive.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js index 32ab75c786..b4b4fa4337 100644 --- a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js +++ b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.controller.js @@ -12,7 +12,7 @@ export default let scope; - vm.init = (_scope_) => { + vm.init = (_scope_, controller, el) => { scope = _scope_; scope.parseType = 'yaml'; @@ -102,6 +102,13 @@ export default return ToJSON(scope.parseType, scope.extraVariables, true); } scope.validate = validate; + + angular.element(el).ready(() => { + const inputs = el.find('input, select'); + if (inputs.length) { + inputs.get(0).focus(); + } + }); }; diff --git a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js index 361f60e145..38ac48ef6b 100644 --- a/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js +++ b/awx/ui/client/src/templates/prompt/steps/other-prompts/prompt-other-prompts.directive.js @@ -28,7 +28,7 @@ export default [ 'templateUrl', const launchController = controllers[0]; const promptOtherPromptsController = controllers[1]; - promptOtherPromptsController.init(scope, launchController); + promptOtherPromptsController.init(scope, launchController, el); } }; }];