mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 15:21:13 +03:00
Re-initialize tag options before calling to create select2 on those fields in prompt modal
This commit is contained in:
parent
b6e246f65a
commit
069c60abf7
@ -38,8 +38,8 @@ function PromptService (Empty, $filter) {
|
||||
prompts.jobType.choices = _.get(params, 'launchOptions.actions.POST.job_type.choices', []).map(c => ({label: c[1], value: c[0]}));
|
||||
prompts.jobType.value = _.has(params, 'currentValues.job_type') && params.currentValues.job_type ? _.find(prompts.jobType.choices, item => item.value === params.currentValues.job_type) : _.find(prompts.jobType.choices, item => item.value === params.launchConf.defaults.job_type);
|
||||
prompts.limit.value = _.has(params, 'currentValues.limit') && params.currentValues.limit ? params.currentValues.limit : (_.has(params, 'launchConf.defaults.limit') ? params.launchConf.defaults.limit : "");
|
||||
prompts.tags.options = prompts.tags.value = (jobTags && jobTags !== "") ? jobTags.split(',').map((i) => ({name: i, label: i, value: i})) : [];
|
||||
prompts.skipTags.options = prompts.skipTags.value = (skipTags && skipTags !== "") ? skipTags.split(',').map((i) => ({name: i, label: i, value: i})) : [];
|
||||
prompts.tags.value = (jobTags && jobTags !== "") ? jobTags.split(',').map((i) => ({name: i, label: i, value: i})) : [];
|
||||
prompts.skipTags.value = (skipTags && skipTags !== "") ? skipTags.split(',').map((i) => ({name: i, label: i, value: i})) : [];
|
||||
prompts.diffMode.value = _.has(params, 'currentValues.diff_mode') && typeof params.currentValues.diff_mode === 'boolean' ? params.currentValues.diff_mode : (_.has(params, 'launchConf.defaults.diff_mode') ? params.launchConf.defaults.diff_mode : null);
|
||||
|
||||
return prompts;
|
||||
|
@ -55,6 +55,16 @@ export default
|
||||
}
|
||||
|
||||
if(scope.promptData.launchConf.ask_tags_on_launch) {
|
||||
// Ensure that the options match the currently selected tags. These two things
|
||||
// might get out of sync if the user re-opens the prompts before saving the
|
||||
// schedule/wf node
|
||||
scope.promptData.prompts.tags.options = _.map(scope.promptData.prompts.tags.value, function(tag){
|
||||
return {
|
||||
value: tag.value,
|
||||
name: tag.name,
|
||||
label: tag.label
|
||||
};
|
||||
});
|
||||
CreateSelect2({
|
||||
element: '#job_launch_job_tags',
|
||||
multiple: true,
|
||||
@ -63,6 +73,16 @@ export default
|
||||
}
|
||||
|
||||
if(scope.promptData.launchConf.ask_skip_tags_on_launch) {
|
||||
// Ensure that the options match the currently selected tags. These two things
|
||||
// might get out of sync if the user re-opens the prompts before saving the
|
||||
// schedule/wf node
|
||||
scope.promptData.prompts.skipTags.options = _.map(scope.promptData.prompts.skipTags.value, function(tag){
|
||||
return {
|
||||
value: tag.value,
|
||||
name: tag.name,
|
||||
label: tag.label
|
||||
};
|
||||
});
|
||||
CreateSelect2({
|
||||
element: '#job_launch_skip_tags',
|
||||
multiple: true,
|
||||
|
Loading…
Reference in New Issue
Block a user