mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03:30
show extra vars on workflow template schedules
When the workflow job template prompts for extra vars, we show the extra vars input field on the scheduler.
This commit is contained in:
parent
60fc952716
commit
311860e027
@ -235,6 +235,7 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
|
||||
}
|
||||
});
|
||||
} else if ($state.current.name === 'templates.editWorkflowJobTemplate.schedules.add'){
|
||||
$scope.parseType = 'yaml';
|
||||
let workflowJobTemplate = new WorkflowJobTemplate();
|
||||
|
||||
$q.all([workflowJobTemplate.optionsLaunch(ParentObject.id), workflowJobTemplate.getLaunch(ParentObject.id)])
|
||||
@ -247,6 +248,20 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
|
||||
});
|
||||
};
|
||||
|
||||
if (launchConf.ask_variables_on_launch) {
|
||||
$scope.noVars = false;
|
||||
$scope.extraVars = ParentObject.extra_vars === '' ? '---' : ParentObject.extra_vars;
|
||||
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
} else {
|
||||
$scope.noVars = true;
|
||||
}
|
||||
|
||||
if (!shouldShowPromptButton(launchConf)) {
|
||||
$scope.showPromptButton = false;
|
||||
} else {
|
||||
|
||||
@ -260,21 +260,20 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
||||
$scope.schedulerPurgeDays = Number(schedule.extra_data.days);
|
||||
}
|
||||
|
||||
const codeMirrorExtraVars = () => {
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
};
|
||||
|
||||
if ($state.current.name === 'templates.editJobTemplate.schedules.edit' || $scope.parentObject.type === 'job_template'){
|
||||
|
||||
let jobTemplate = new JobTemplate();
|
||||
|
||||
const codeMirrorExtraVars = () => {
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
};
|
||||
|
||||
Rest.setUrl(scheduleResolve.related.credentials);
|
||||
|
||||
$q.all([jobTemplate.optionsLaunch(ParentObject.id), jobTemplate.getLaunch(ParentObject.id), Rest.get()])
|
||||
.then((responses) => {
|
||||
let launchOptions = responses[0].data,
|
||||
@ -343,9 +342,12 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
||||
prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials);
|
||||
|
||||
// the extra vars codemirror is ONLY shown if the
|
||||
// schedule is for a JT and the JT has
|
||||
// ask_variables_on_launch = true
|
||||
$scope.noVars = !launchConf.ask_variables_on_launch;
|
||||
if (launchConf.ask_variables_on_launch) {
|
||||
$scope.noVars = false;
|
||||
} else {
|
||||
$scope.noVars = true;
|
||||
}
|
||||
|
||||
if (!shouldShowPromptButton(launchConf)) {
|
||||
$scope.showPromptButton = false;
|
||||
@ -432,6 +434,15 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
||||
currentValues: scheduleResolve
|
||||
});
|
||||
|
||||
// the extra vars codemirror is ONLY shown if the
|
||||
// ask_variables_on_launch = true
|
||||
if (launchConf.ask_variables_on_launch) {
|
||||
$scope.noVars = false;
|
||||
codeMirrorExtraVars();
|
||||
} else {
|
||||
$scope.noVars = true;
|
||||
}
|
||||
|
||||
if (!shouldShowPromptButton(launchConf)) {
|
||||
$scope.showPromptButton = false;
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user