Fixed group schedules and management jobs schedules

This commit is contained in:
Michael Abashian 2017-02-03 14:23:05 -05:00
parent 534db96a93
commit c9eccb315e
4 changed files with 41 additions and 17 deletions

View File

@ -55,11 +55,11 @@ angular.module('inventory', [
url: '/schedules',
searchPrefix: 'schedule',
ncyBreadcrumb: {
parent: 'inventoryManage.editGroup({group_id: parentObject.id})',
parent: 'inventoryManage({group_id: parentObject.id})',
label: N_('SCHEDULES')
},
resolve: {
Dataset: ['SchedulesList', 'QuerySet', '$stateParams', 'GetBasePath', 'groupData',
Dataset: ['ScheduleList', 'QuerySet', '$stateParams', 'GetBasePath', 'groupData',
function(list, qs, $stateParams, GetBasePath, groupData) {
let path = `${groupData.related.inventory_source}schedules`;
return qs.search(path, $stateParams[`${list.iterator}_search`]);
@ -79,7 +79,14 @@ angular.module('inventory', [
val.reject(data);
});
return val.promise;
}]
}],
ScheduleList: ['SchedulesList', 'groupData',
(SchedulesList, groupData) => {
let list = _.cloneDeep(SchedulesList);
list.basePath = `${groupData.related.inventory_source}schedules`;
return list;
}
]
},
views: {
// clear form template when views render in this substate
@ -88,11 +95,11 @@ angular.module('inventory', [
},
// target the un-named ui-view @ root level
'@': {
templateProvider: function(SchedulesList, generateList, ParentObject) {
templateProvider: function(ScheduleList, generateList, ParentObject) {
// include name of parent resource in listTitle
SchedulesList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>` + N_('Schedules');
ScheduleList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>` + N_('Schedules');
let html = generateList.build({
list: SchedulesList,
list: ScheduleList,
mode: 'edit'
});
html = generateList.wrapPanel(html);

View File

@ -27,11 +27,11 @@ angular.module('managementJobScheduler', [])
},
views: {
'@': {
templateProvider: function(SchedulesList, generateList, ParentObject) {
templateProvider: function(ScheduleList, generateList, ParentObject) {
// include name of parent resource in listTitle
SchedulesList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>` + N_('Schedules');
ScheduleList.listTitle = `${ParentObject.name}<div class='List-titleLockup'></div>` + N_('Schedules');
let html = generateList.build({
list: SchedulesList,
list: ScheduleList,
mode: 'edit'
});
html = generateList.wrapPanel(html);
@ -41,7 +41,7 @@ angular.module('managementJobScheduler', [])
}
},
resolve: {
Dataset: ['SchedulesList', 'QuerySet', '$stateParams', 'GetBasePath',
Dataset: ['ScheduleList', 'QuerySet', '$stateParams', 'GetBasePath',
function(list, qs, $stateParams, GetBasePath) {
let path = `${GetBasePath('system_job_templates')}${$stateParams.id}/schedules`;
return qs.search(path, $stateParams[`${list.iterator}_search`]);
@ -63,7 +63,14 @@ angular.module('managementJobScheduler', [])
val.reject(data);
});
return val.promise;
}]
}],
ScheduleList: ['SchedulesList', 'GetBasePath', '$stateParams',
(SchedulesList, GetBasePath, $stateParams) => {
let list = _.cloneDeep(SchedulesList);
list.basePath = GetBasePath('system_job_templates') + $stateParams.id + '/schedules';
return list;
}
]
}
});
$stateExtender.addState({

View File

@ -1,5 +1,5 @@
export default ['$scope', '$state', 'QuerySet', 'GetBasePath',
function($scope, $state, qs, GetBasePath) {
export default ['$scope', '$state', 'QuerySet', 'GetBasePath', '$stateParams', '$interpolate',
function($scope, $state, qs, GetBasePath, $stateParams, $interpolate) {
let queryset, path;
@ -52,7 +52,12 @@ export default ['$scope', '$state', 'QuerySet', 'GetBasePath',
else {
queryset = _.merge($state.params[`${$scope.columnIterator}_search`], { order_by: order_by });
}
path = GetBasePath($scope.basePath) || $scope.basePath;
if (GetBasePath($scope.basePath) || $scope.basePath) {
path = GetBasePath($scope.basePath) || $scope.basePath;
} else {
let interpolator = $interpolate($scope.basePath);
path = interpolator({ $stateParams: $stateParams });
}
if(!$scope.querySet) {
$state.go('.', { [$scope.columnIterator + '_search']: queryset }, {notify: false});
}

View File

@ -1,5 +1,5 @@
export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'QuerySet',
function($scope, $stateParams, $state, $filter, GetBasePath, qs) {
export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'QuerySet', '$interpolate',
function($scope, $stateParams, $state, $filter, GetBasePath, qs, $interpolate) {
let pageSize,
queryset, path;
@ -27,7 +27,12 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
if(page === 0) {
return;
}
path = GetBasePath($scope.basePath) || $scope.basePath;
if (GetBasePath($scope.basePath) || $scope.basePath) {
path = GetBasePath($scope.basePath) || $scope.basePath;
} else {
let interpolator = $interpolate($scope.basePath);
path = interpolator({ $stateParams: $stateParams });
}
if($scope.querySet) {
// merging $scope.querySet seems to destroy our initial reference which
// kills the two-way binding here. To fix that, clone the queryset first