mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Merge pull request #4727 from jakemcdermott/fix-4726
show extra vars on workflow template schedules Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
@@ -235,6 +235,7 @@ export default ['$filter', '$state', '$stateParams', '$http', 'Wait',
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if ($state.current.name === 'templates.editWorkflowJobTemplate.schedules.add'){
|
} else if ($state.current.name === 'templates.editWorkflowJobTemplate.schedules.add'){
|
||||||
|
$scope.parseType = 'yaml';
|
||||||
let workflowJobTemplate = new WorkflowJobTemplate();
|
let workflowJobTemplate = new WorkflowJobTemplate();
|
||||||
|
|
||||||
$q.all([workflowJobTemplate.optionsLaunch(ParentObject.id), workflowJobTemplate.getLaunch(ParentObject.id)])
|
$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)) {
|
if (!shouldShowPromptButton(launchConf)) {
|
||||||
$scope.showPromptButton = false;
|
$scope.showPromptButton = false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -260,21 +260,20 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
$scope.schedulerPurgeDays = Number(schedule.extra_data.days);
|
$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'){
|
if ($state.current.name === 'templates.editJobTemplate.schedules.edit' || $scope.parentObject.type === 'job_template'){
|
||||||
|
|
||||||
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()])
|
||||||
.then((responses) => {
|
.then((responses) => {
|
||||||
let launchOptions = responses[0].data,
|
let launchOptions = responses[0].data,
|
||||||
@@ -343,9 +342,12 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials);
|
prompts.credentials.value = defaultCredsWithoutOverrides.concat(scheduleCredentials);
|
||||||
|
|
||||||
// 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
|
|
||||||
// ask_variables_on_launch = true
|
// 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)) {
|
if (!shouldShowPromptButton(launchConf)) {
|
||||||
$scope.showPromptButton = false;
|
$scope.showPromptButton = false;
|
||||||
@@ -432,6 +434,15 @@ function($filter, $state, $stateParams, Wait, $scope, moment,
|
|||||||
currentValues: scheduleResolve
|
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)) {
|
if (!shouldShowPromptButton(launchConf)) {
|
||||||
$scope.showPromptButton = false;
|
$scope.showPromptButton = false;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user