mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 02:30:01 -03:30
Re-initialize tag options before calling to create select2 on those fields in prompt modal
This commit is contained in:
@@ -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.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.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.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.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.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);
|
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;
|
return prompts;
|
||||||
|
|||||||
@@ -55,6 +55,16 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(scope.promptData.launchConf.ask_tags_on_launch) {
|
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({
|
CreateSelect2({
|
||||||
element: '#job_launch_job_tags',
|
element: '#job_launch_job_tags',
|
||||||
multiple: true,
|
multiple: true,
|
||||||
@@ -63,6 +73,16 @@ export default
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(scope.promptData.launchConf.ask_skip_tags_on_launch) {
|
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({
|
CreateSelect2({
|
||||||
element: '#job_launch_skip_tags',
|
element: '#job_launch_skip_tags',
|
||||||
multiple: true,
|
multiple: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user