mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 18:21:12 +03:00
Fixing extra vars for inv-sync schedules and projects
This commit is contained in:
parent
f1545860f0
commit
90c6e1ca36
@ -245,7 +245,7 @@ export default
|
||||
url = params.url;
|
||||
}
|
||||
}
|
||||
else if (base == 'system_job_templates') {
|
||||
else if (base === 'system_job_templates') {
|
||||
url = GetBasePath(base) + $stateParams.id + '/schedules/';
|
||||
if($stateParams.id == 4){
|
||||
scope.isFactCleanup = true;
|
||||
@ -325,7 +325,9 @@ export default
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('SchedulePost', ['Rest', 'ProcessErrors', 'RRuleToAPI', 'Wait', function(Rest, ProcessErrors, RRuleToAPI, Wait) {
|
||||
.factory('SchedulePost', ['Rest', 'ProcessErrors', 'RRuleToAPI', 'Wait',
|
||||
'ToJSON',
|
||||
function(Rest, ProcessErrors, RRuleToAPI, Wait, ToJSON) {
|
||||
return function(params) {
|
||||
var scope = params.scope,
|
||||
url = params.url,
|
||||
@ -357,6 +359,10 @@ export default
|
||||
else if (scope.serializedExtraVars){
|
||||
schedule.extra_data = scope.serializedExtraVars;
|
||||
}
|
||||
else if(scope.extraVars){
|
||||
schedule.extra_data = ToJSON(scope.parseType,
|
||||
scope.extraVars, false);
|
||||
}
|
||||
Rest.setUrl(url);
|
||||
if (mode === 'add') {
|
||||
Rest.post(schedule)
|
||||
|
@ -62,15 +62,15 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
||||
$scope.parseType = 'yaml';
|
||||
var defaultUrl = GetBasePath('job_templates') + $stateParams.id + '/';
|
||||
Rest.setUrl(defaultUrl);
|
||||
Rest.get().then(function(res){
|
||||
Rest.get().then(function(res){
|
||||
// sanitize
|
||||
var data = JSON.parse(JSON.stringify(res.data.extra_vars));
|
||||
$scope.extraVars = data === '' ? '---' : data;
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
});
|
||||
$scope.$watch('extraVars', function(){
|
||||
@ -98,6 +98,16 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
}
|
||||
else if ($state.current.name === 'inventoryManageSchedules.add'){
|
||||
$scope.extraVars = '---';
|
||||
$scope.parseType = 'yaml';
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'extraVars',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'SchedulerForm-extraVars'
|
||||
});
|
||||
}
|
||||
|
||||
AddSchedule({
|
||||
scope: $scope,
|
||||
|
Loading…
Reference in New Issue
Block a user