mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
make Enter key navigate to next tab in launch modal
This commit is contained in:
parent
e5f48bfa62
commit
5b2f00b978
@ -7,8 +7,9 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
|
||||
let scope;
|
||||
let modal;
|
||||
let activeTab;
|
||||
|
||||
vm.init = (_scope_) => {
|
||||
vm.init = (_scope_, el) => {
|
||||
scope = _scope_;
|
||||
({ modal } = scope[scope.ns]);
|
||||
|
||||
@ -137,6 +138,7 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
_active: true,
|
||||
order: order
|
||||
};
|
||||
activeTab = activeTab || vm.steps.inventory.tab;
|
||||
order++;
|
||||
}
|
||||
if (vm.promptDataClone.launchConf.ask_credential_on_launch ||
|
||||
@ -152,6 +154,7 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
_disabled: (order === 1 || vm.readOnlyPrompts) ? false : true,
|
||||
order: order
|
||||
};
|
||||
activeTab = activeTab || vm.steps.credentials.tab;
|
||||
order++;
|
||||
}
|
||||
if(vm.promptDataClone.launchConf.ask_verbosity_on_launch || vm.promptDataClone.launchConf.ask_job_type_on_launch || vm.promptDataClone.launchConf.ask_limit_on_launch || vm.promptDataClone.launchConf.ask_tags_on_launch || vm.promptDataClone.launchConf.ask_skip_tags_on_launch || (vm.promptDataClone.launchConf.ask_variables_on_launch && !vm.promptDataClone.launchConf.ignore_ask_variables) || vm.promptDataClone.launchConf.ask_diff_mode_on_launch) {
|
||||
@ -161,6 +164,7 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
_disabled: (order === 1 || vm.readOnlyPrompts) ? false : true,
|
||||
order: order
|
||||
};
|
||||
activeTab = activeTab || vm.steps.other_prompts.tab;
|
||||
order++;
|
||||
|
||||
let codemirror = () => {
|
||||
@ -177,6 +181,7 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
_disabled: (order === 1 || vm.readOnlyPrompts) ? false : true,
|
||||
order: order
|
||||
};
|
||||
activeTab = activeTab || vm.steps.survey.tab;
|
||||
order++;
|
||||
}
|
||||
vm.steps.preview.tab.order = order;
|
||||
@ -214,6 +219,7 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
if(vm.steps[step].tab.order === currentTab.order) {
|
||||
vm.steps[step].tab._active = false;
|
||||
} else if(vm.steps[step].tab.order === currentTab.order + 1) {
|
||||
activeTab = currentTab
|
||||
vm.steps[step].tab._active = true;
|
||||
vm.steps[step].tab._disabled = false;
|
||||
scope.$broadcast('promptTabChange', { step });
|
||||
@ -222,6 +228,12 @@ export default [ 'ProcessErrors', 'CredentialTypeModel', 'TemplatesStrings', '$f
|
||||
});
|
||||
};
|
||||
|
||||
vm.keypress = (event) => {
|
||||
if (event.key === 'Enter') {
|
||||
vm.next(activeTab);
|
||||
}
|
||||
};
|
||||
|
||||
vm.finish = () => {
|
||||
// Disable the action button to prevent double clicking
|
||||
vm.actionButtonClicked = true;
|
||||
|
||||
@ -20,7 +20,7 @@ export default [ 'templateUrl',
|
||||
scope.ns = 'launch';
|
||||
scope[scope.ns] = { modal: {} };
|
||||
|
||||
promptController.init(scope);
|
||||
promptController.init(scope, el);
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<at-tab id="prompt_survey_tab" ng-if="vm.steps.survey.tab" state="vm.steps.survey.tab">{{:: vm.strings.get('prompt.SURVEY') }}</at-tab>
|
||||
<at-tab id="prompt_preview_tab" state="vm.steps.preview.tab">{{:: vm.strings.get('prompt.PREVIEW') }}</at-tab>
|
||||
</at-tab-group>
|
||||
<div class="Prompt-step">
|
||||
<div class="Prompt-step" ng-keypress="vm.keypress($event)">
|
||||
<div ng-if="vm.steps.inventory.includeStep" ng-show="vm.steps.inventory.tab._active" id="prompt_inventory_step">
|
||||
<prompt-inventory
|
||||
prompt-data="vm.promptDataClone"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user