fix error when deleting the only item on page 2 for list page of organization, scheduler,

instance_groups, inventories, projects, jobs, template, credentials, inventory-scripts,
teams, users, credential-types and notifications
This commit is contained in:
Haokun-Chen
2018-06-11 15:56:44 -04:00
parent 769e714f71
commit 49f0a63150
15 changed files with 26 additions and 20 deletions
@@ -102,12 +102,11 @@ function ListJobsController (
let reloadListStateParams = null;
if ($scope.jobs.length === 1 && $state.params.job_search &&
!_.isEmpty($state.params.job_search.page) &&
_.has($state, 'params.job_search.page') &&
$state.params.job_search.page !== '1') {
const page = `${(parseInt(reloadListStateParams
.job_search.page, 10) - 1)}`;
reloadListStateParams = _.cloneDeep($state.params);
reloadListStateParams.job_search.page = page;
reloadListStateParams.job_search.page =
(parseInt(reloadListStateParams.job_search.page, 10) - 1).toString();
}
$state.go('.', reloadListStateParams, { reload: true });