mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fixed scope conflict between schedules_list and parent scope.
This commit is contained in:
@@ -330,7 +330,8 @@ angular.module('GroupsHelper', ['RestServices', 'Utilities', 'ListGenerator', 'G
|
|||||||
function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Rest, PageRangeSetup, Wait, ProcessErrors, Find) {
|
function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Rest, PageRangeSetup, Wait, ProcessErrors, Find) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var parent_scope = params.scope,
|
var parent_scope = params.scope,
|
||||||
scope, url, list;
|
schedule_scope = parent_scope.$new(),
|
||||||
|
url, list;
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
$('#schedules-list').hide().empty();
|
$('#schedules-list').hide().empty();
|
||||||
@@ -348,11 +349,12 @@ function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Re
|
|||||||
delete list.fields.dtend;
|
delete list.fields.dtend;
|
||||||
delete list.actions.stream;
|
delete list.actions.stream;
|
||||||
list.well = false;
|
list.well = false;
|
||||||
scope = GenerateList.inject(list, {
|
GenerateList.inject(list, {
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
id: 'schedules-list',
|
id: 'schedules-list',
|
||||||
breadCrumbs: false,
|
breadCrumbs: false,
|
||||||
searchSize: 'col-lg-6 col-md-5 col-sm-5 col-xs-5'
|
searchSize: 'col-lg-6 col-md-5 col-sm-5 col-xs-5',
|
||||||
|
scope: schedule_scope
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#schedules-list').show();
|
$('#schedules-list').show();
|
||||||
@@ -360,13 +362,13 @@ function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Re
|
|||||||
// Change later to use GetBasePath(base)
|
// Change later to use GetBasePath(base)
|
||||||
url = '/static/sample/data/schedules/inventory/data.json';
|
url = '/static/sample/data/schedules/inventory/data.json';
|
||||||
SearchInit({
|
SearchInit({
|
||||||
scope: scope,
|
scope: schedule_scope,
|
||||||
set: 'schedules',
|
set: 'schedules',
|
||||||
list: SchedulesList,
|
list: SchedulesList,
|
||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
PaginateInit({
|
PaginateInit({
|
||||||
scope: scope,
|
scope: schedule_scope,
|
||||||
list: SchedulesList,
|
list: SchedulesList,
|
||||||
url: url
|
url: url
|
||||||
});
|
});
|
||||||
@@ -375,34 +377,33 @@ function(ScheduleEdit, SchedulesList, GenerateList, SearchInit, PaginateInit, Re
|
|||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
var i, modifier;
|
var i, modifier;
|
||||||
PageRangeSetup({
|
PageRangeSetup({
|
||||||
scope: scope,
|
scope: schedule_scope,
|
||||||
count: data.count,
|
count: data.count,
|
||||||
next: data.next,
|
next: data.next,
|
||||||
previous: data.previous,
|
previous: data.previous,
|
||||||
iterator: SchedulesList.iterator
|
iterator: SchedulesList.iterator
|
||||||
});
|
});
|
||||||
scope[SchedulesList.iterator + 'Loading'] = false;
|
schedule_scope[SchedulesList.iterator + 'Loading'] = false;
|
||||||
for (i = 1; i <= 3; i++) {
|
for (i = 1; i <= 3; i++) {
|
||||||
modifier = (i === 1) ? '' : i;
|
modifier = (i === 1) ? '' : i;
|
||||||
scope[SchedulesList.iterator + 'HoldInput' + modifier] = false;
|
schedule_scope[SchedulesList.iterator + 'HoldInput' + modifier] = false;
|
||||||
}
|
}
|
||||||
scope.schedules = data.results;
|
schedule_scope.schedules = data.results;
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
scope.$emit('PostRefresh');
|
schedule_scope.schedules = data.results;
|
||||||
scope.schedules = data.results;
|
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
ProcessErrors(schedule_scope, data, status, null, { hdr: 'Error!',
|
||||||
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
|
msg: 'Call to ' + url + ' failed. GET returned: ' + status });
|
||||||
});
|
});
|
||||||
|
|
||||||
scope.editSchedule = function(id) {
|
schedule_scope.editSchedule = function(id) {
|
||||||
var schedule = Find({ list: scope[SchedulesList.name], key: 'id', val: id });
|
var schedule = Find({ list: schedule_scope[SchedulesList.name], key: 'id', val: id });
|
||||||
ScheduleEdit({ scope: parent_scope, schedule: schedule, mode: 'edit' });
|
ScheduleEdit({ scope: parent_scope, schedule: schedule, mode: 'edit' });
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.addSchedule = function() {
|
schedule_scope.addSchedule = function() {
|
||||||
ScheduleEdit({ scope: parent_scope, schedule: {}, mode: 'add'});
|
ScheduleEdit({ scope: parent_scope, schedule: {}, mode: 'add'});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -854,6 +855,9 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (sources_scope.removeScopeSourceTypeOptionsReady) {
|
||||||
|
sources_scope.removeScopeSourceTypeOptionsReady();
|
||||||
|
}
|
||||||
sources_scope.removeScopeSourceTypeOptionsReady = sources_scope.$on('sourceTypeOptionsReady', function() {
|
sources_scope.removeScopeSourceTypeOptionsReady = sources_scope.$on('sourceTypeOptionsReady', function() {
|
||||||
if (mode === 'add') {
|
if (mode === 'add') {
|
||||||
sources_scope.source = Find({
|
sources_scope.source = Find({
|
||||||
@@ -861,7 +865,6 @@ function(SchedulerInit, Rest, Wait, SetSchedulesInnerDialogSize) {
|
|||||||
key: 'value',
|
key: 'value',
|
||||||
val: ''
|
val: ''
|
||||||
});
|
});
|
||||||
console.log(sources_scope.source);
|
|
||||||
parent_scope.showSourceTab = false;
|
parent_scope.showSourceTab = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user