mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 00:38:45 -03:30
Merge pull request #3035 from mabashian/3010-extra-vars
Fixes bug where schedule extra vars were not being displayed in the edit form
This commit is contained in:
@@ -243,6 +243,15 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
|
|
||||||
let jobTemplate = new JobTemplate();
|
let jobTemplate = new JobTemplate();
|
||||||
|
|
||||||
|
const codeMirrorExtraVars = () => {
|
||||||
|
ParseTypeChange({
|
||||||
|
scope: $scope,
|
||||||
|
variable: 'extraVars',
|
||||||
|
parse_variable: 'parseType',
|
||||||
|
field_id: 'SchedulerForm-extraVars'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Rest.setUrl(scheduleResolve.related.credentials);
|
Rest.setUrl(scheduleResolve.related.credentials);
|
||||||
|
|
||||||
$q.all([jobTemplate.optionsLaunch(ParentObject.id), jobTemplate.getLaunch(ParentObject.id), Rest.get()])
|
$q.all([jobTemplate.optionsLaunch(ParentObject.id), jobTemplate.getLaunch(ParentObject.id), Rest.get()])
|
||||||
@@ -312,21 +321,10 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
|
|
||||||
prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials);
|
prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials);
|
||||||
|
|
||||||
if (launchConf.ask_variables_on_launch) {
|
// the extra vars codemirror is ONLY shown if the
|
||||||
// the extra vars codemirror is ONLY shown if the
|
// schedule is for a JT and the JT has
|
||||||
// schedule is for a JT and the JT has
|
// ask_variables_on_launch = true
|
||||||
// ask_variables_on_launch = true.
|
$scope.noVars = !launchConf.ask_variables_on_launch;
|
||||||
$scope.extraVars = ParentObject.extra_vars === '' ? '---' : ParentObject.extra_vars;
|
|
||||||
$scope.noVars = false;
|
|
||||||
ParseTypeChange({
|
|
||||||
scope: $scope,
|
|
||||||
variable: 'extraVars',
|
|
||||||
parse_variable: 'parseType',
|
|
||||||
field_id: 'SchedulerForm-extraVars'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$scope.noVars = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!launchConf.survey_enabled &&
|
if (!launchConf.survey_enabled &&
|
||||||
!launchConf.ask_inventory_on_launch &&
|
!launchConf.ask_inventory_on_launch &&
|
||||||
@@ -343,6 +341,10 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
launchConf.passwords_needed_to_start.length === 0 &&
|
launchConf.passwords_needed_to_start.length === 0 &&
|
||||||
launchConf.variables_needed_to_start.length === 0) {
|
launchConf.variables_needed_to_start.length === 0) {
|
||||||
$scope.showPromptButton = false;
|
$scope.showPromptButton = false;
|
||||||
|
|
||||||
|
if (launchConf.ask_variables_on_launch) {
|
||||||
|
codeMirrorExtraVars();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$scope.showPromptButton = true;
|
$scope.showPromptButton = true;
|
||||||
|
|
||||||
@@ -368,13 +370,7 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
|
|
||||||
$scope.extraVars = (processed.extra_data === '' || _.isEmpty(processed.extra_data)) ? '---' : '---\n' + jsyaml.safeDump(processed.extra_data);
|
$scope.extraVars = (processed.extra_data === '' || _.isEmpty(processed.extra_data)) ? '---' : '---\n' + jsyaml.safeDump(processed.extra_data);
|
||||||
|
|
||||||
ParseTypeChange({
|
codeMirrorExtraVars();
|
||||||
scope: $scope,
|
|
||||||
variable: 'extraVars',
|
|
||||||
parse_variable: 'parseType',
|
|
||||||
field_id: 'SchedulerForm-extraVars',
|
|
||||||
readOnly: !$scope.schedule_obj.summary_fields.user_capabilities.edit
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.promptData = {
|
$scope.promptData = {
|
||||||
launchConf: launchConf,
|
launchConf: launchConf,
|
||||||
@@ -397,6 +393,7 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
watchForPromptChanges();
|
watchForPromptChanges();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
codeMirrorExtraVars();
|
||||||
$scope.promptData = {
|
$scope.promptData = {
|
||||||
launchConf: launchConf,
|
launchConf: launchConf,
|
||||||
launchOptions: launchOptions,
|
launchOptions: launchOptions,
|
||||||
|
|||||||
Reference in New Issue
Block a user