mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 03:45:01 -02:30
Fixing extra vars for inv-sync schedules and projects
This commit is contained in:
@@ -245,7 +245,7 @@ export default
|
|||||||
url = params.url;
|
url = params.url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (base == 'system_job_templates') {
|
else if (base === 'system_job_templates') {
|
||||||
url = GetBasePath(base) + $stateParams.id + '/schedules/';
|
url = GetBasePath(base) + $stateParams.id + '/schedules/';
|
||||||
if($stateParams.id == 4){
|
if($stateParams.id == 4){
|
||||||
scope.isFactCleanup = true;
|
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) {
|
return function(params) {
|
||||||
var scope = params.scope,
|
var scope = params.scope,
|
||||||
url = params.url,
|
url = params.url,
|
||||||
@@ -357,6 +359,10 @@ export default
|
|||||||
else if (scope.serializedExtraVars){
|
else if (scope.serializedExtraVars){
|
||||||
schedule.extra_data = scope.serializedExtraVars;
|
schedule.extra_data = scope.serializedExtraVars;
|
||||||
}
|
}
|
||||||
|
else if(scope.extraVars){
|
||||||
|
schedule.extra_data = ToJSON(scope.parseType,
|
||||||
|
scope.extraVars, false);
|
||||||
|
}
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
if (mode === 'add') {
|
if (mode === 'add') {
|
||||||
Rest.post(schedule)
|
Rest.post(schedule)
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
|||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
var defaultUrl = GetBasePath('job_templates') + $stateParams.id + '/';
|
var defaultUrl = GetBasePath('job_templates') + $stateParams.id + '/';
|
||||||
Rest.setUrl(defaultUrl);
|
Rest.setUrl(defaultUrl);
|
||||||
Rest.get().then(function(res){
|
Rest.get().then(function(res){
|
||||||
// sanitize
|
// sanitize
|
||||||
var data = JSON.parse(JSON.stringify(res.data.extra_vars));
|
var data = JSON.parse(JSON.stringify(res.data.extra_vars));
|
||||||
$scope.extraVars = data === '' ? '---' : data;
|
$scope.extraVars = data === '' ? '---' : data;
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
variable: 'extraVars',
|
variable: 'extraVars',
|
||||||
parse_variable: 'parseType',
|
parse_variable: 'parseType',
|
||||||
field_id: 'SchedulerForm-extraVars'
|
field_id: 'SchedulerForm-extraVars'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$scope.$watch('extraVars', function(){
|
$scope.$watch('extraVars', function(){
|
||||||
@@ -98,6 +98,16 @@ export default ['$compile', '$state', '$stateParams', 'AddSchedule', 'Wait',
|
|||||||
field_id: 'SchedulerForm-extraVars'
|
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({
|
AddSchedule({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
|
|||||||
Reference in New Issue
Block a user