mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
AC-216 Added page logic to the back button. If user clicks the 'back' button (not browser back button), Jobs page will be presented and user will be returned to the previous page. Accomplished by appending 'page' parameter to API request.
This commit is contained in:
parent
520ca8d70b
commit
79657fc80b
@ -130,7 +130,9 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
});
|
||||
|
||||
SearchInit({ scope: scope, set: 'jobevents', list: list, url: defaultUrl });
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl });
|
||||
|
||||
var page = ($routeParams.page) ? parseInt($routeParams.page) - 1 : null;
|
||||
PaginateInit({ scope: scope, list: list, url: defaultUrl, page: page });
|
||||
|
||||
// Called from Inventories tab, host failed events link:
|
||||
if ($routeParams.host) {
|
||||
@ -139,7 +141,7 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
scope[list.iterator + 'SearchFieldLabel'] = list.fields['host'].label;
|
||||
}
|
||||
|
||||
scope.search(list.iterator);
|
||||
scope.search(list.iterator, $routeParams.page);
|
||||
|
||||
scope.toggleChildren = function(id, children) {
|
||||
ToggleChildren({
|
||||
@ -153,7 +155,11 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
||||
LoadBreadCrumbs();
|
||||
|
||||
scope.viewJobEvent = function(id) {
|
||||
$location.path('/jobs/' + $routeParams.id + '/job_events/' + id);
|
||||
var url = '/jobs/' + $routeParams.id + '/job_events/' + id;
|
||||
if (scope['jobeventPage']) {
|
||||
url += '?&page=' + (scope['jobeventPage'] + 1);
|
||||
}
|
||||
$location.url(url);
|
||||
}
|
||||
|
||||
scope.refresh = function() {
|
||||
@ -260,7 +266,11 @@ function JobEventsEdit ($scope, $rootScope, $compile, $location, $log, $routePar
|
||||
});
|
||||
|
||||
scope.navigateBack = function() {
|
||||
window.history.back();
|
||||
var url = '/jobs/' + $routeParams.job_id + '/job_events';
|
||||
if ($routeParams.page) {
|
||||
url += '?page=' + $routeParams.page;
|
||||
}
|
||||
$location.url(url);
|
||||
}
|
||||
|
||||
scope.rawView = function() {
|
||||
|
||||
@ -25,8 +25,13 @@ angular.module('PaginateHelper', ['RefreshHelper', 'ngCookies'])
|
||||
var mode = (params.mode) ? params.mode : null;
|
||||
var cookieSize = $cookieStore.get(iterator + 'PageSize');
|
||||
|
||||
scope[iterator + 'Page'] = 0;
|
||||
|
||||
if (params.page) {
|
||||
scope[iterator + 'Page'] = params.page;
|
||||
}
|
||||
else {
|
||||
scope[iterator + 'Page'] = 0;
|
||||
}
|
||||
|
||||
if (cookieSize && mode != 'lookup') {
|
||||
// use the size found in session cookie, when available
|
||||
scope[iterator + 'PageSize'] = cookieSize;
|
||||
|
||||
@ -106,7 +106,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
scope.search(iterator);
|
||||
}
|
||||
|
||||
scope.search = function(iterator) {
|
||||
scope.search = function(iterator, page) {
|
||||
// Page is optional. Added to accomodate back function on Job Events detail.
|
||||
|
||||
scope[iterator + 'SearchSpin'] = true;
|
||||
scope[iterator + 'Loading'] = true;
|
||||
scope[iterator + 'SearchParms'] = '';
|
||||
@ -155,7 +157,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
else {
|
||||
scope[iterator + 'SearchParams'] = (sort_order) ? 'order_by=' + escape(sort_order) : "";
|
||||
}
|
||||
scope[iterator + 'Page'] = 0;
|
||||
scope[iterator + 'Page'] = (page) ? parseInt(page) - 1 : 0;
|
||||
if (/\/$/.test(url)) {
|
||||
url += '?' + scope[iterator + 'SearchParams'];
|
||||
}
|
||||
@ -164,6 +166,9 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
|
||||
}
|
||||
url = url.replace(/\&\&/,'&');
|
||||
url += (scope[iterator + 'PageSize']) ? '&page_size=' + scope[iterator + 'PageSize'] : "";
|
||||
if (page) {
|
||||
url += '&page=' + page;
|
||||
}
|
||||
Refresh({ scope: scope, set: set, iterator: iterator, url: url });
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user