mirror of
https://github.com/ansible/awx.git
synced 2026-05-15 21:37:42 -02:30
add 'other prompt' fields to launch API call
This commit is contained in:
@@ -39,6 +39,30 @@ function LaunchPrompt({ config, resource, onLaunch, onCancel, i18n }) {
|
||||
config.ask_scm_branch_on_launch ||
|
||||
config.ask_diff_mode_on_launch
|
||||
) {
|
||||
if (config.ask_job_type_on_launch) {
|
||||
initialValues.job_type = resource.job_type || '';
|
||||
}
|
||||
if (config.ask_limit_on_launch) {
|
||||
initialValues.limit = resource.limit || '';
|
||||
}
|
||||
if (config.ask_verbosity_on_launch) {
|
||||
initialValues.verbosity = resource.verbosity || 0;
|
||||
}
|
||||
if (config.ask_tags_on_launch) {
|
||||
initialValues.job_tags = resource.job_tags || '';
|
||||
}
|
||||
if (config.ask_skip_tags_on_launch) {
|
||||
initialValues.skip_tags = resource.skip_tags || '';
|
||||
}
|
||||
if (config.ask_variables_on_launch) {
|
||||
initialValues.extra_vars = resource.extra_vars || '---';
|
||||
}
|
||||
if (config.ask_scm_branch_on_launch) {
|
||||
initialValues.scm_branch = resource.scm_branch || '';
|
||||
}
|
||||
if (config.ask_diff_mode_on_launch) {
|
||||
initialValues.diff_mode = resource.diff_mode || false;
|
||||
}
|
||||
steps.push({
|
||||
name: i18n._(t`Other Prompts`),
|
||||
component: <OtherPromptsStep config={config} />,
|
||||
@@ -58,12 +82,18 @@ function LaunchPrompt({ config, resource, onLaunch, onCancel, i18n }) {
|
||||
|
||||
const submit = values => {
|
||||
const postValues = {};
|
||||
if (values.inventory) {
|
||||
postValues.inventory_id = values.inventory.id;
|
||||
}
|
||||
if (values.credentials) {
|
||||
postValues.credentials = values.credentials.map(c => c.id);
|
||||
}
|
||||
const setValue = (key, value) => {
|
||||
if (typeof value !== 'undefined' && value !== null) {
|
||||
postValues[key] = value;
|
||||
}
|
||||
};
|
||||
setValue('inventory_id', values.inventory?.id);
|
||||
setValue('credentials', values.credentials?.map(c => c.id));
|
||||
setValue('job_type', values.job_type);
|
||||
setValue('limit', values.limit);
|
||||
setValue('job_tags', values.job_tags);
|
||||
setValue('skip_tags', values.skip_tags);
|
||||
setValue('extra_vars', values.extra_vars);
|
||||
onLaunch(postValues);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user