Skip to content

Commit 963a13a

Browse files
committed
made setpaginationtotal a function
1 parent 26ebeab commit 963a13a

File tree

1 file changed

+9
-8
lines changed
  • flask_monitoringdashboard/frontend/js/controllers

1 file changed

+9
-8
lines changed

flask_monitoringdashboard/frontend/js/controllers/exception.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
2121
const getQueryString = function () {
2222
removeUnwelcomeParameters();
2323
let query = decodeURI(window.location.search);
24-
if (query.includes("?")){
24+
if (query.length > 0 && query[0] === "?"){
2525
query = query.slice(1);
2626
}
2727
if (query.includes("genericSearch=")){
@@ -41,9 +41,13 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
4141
});
4242

4343
paginationService.init('exceptions');
44-
$http.get('api/num_exceptions'+window.location.search).then(function (response) {
45-
paginationService.setTotal(response.data);
46-
});
44+
45+
const setPaginationTotal = function() {
46+
$http.get('api/num_exceptions'+window.location.search).then(function (response) {
47+
paginationService.setTotal(response.data);
48+
});
49+
}
50+
setPaginationTotal();
4751

4852
$scope.getEndpoint = function () {
4953
return 'api/exception_info/' + paginationService.getLeft() + '/' + paginationService.perPage;
@@ -79,15 +83,12 @@ export function ExceptionController($scope, $http, $location, menuService, pagin
7983
$scope.query = function (){
8084
if ($scope.queryString === $scope.oldQuery) return;
8185
$scope.buildQueryString($scope.queryString);
82-
paginationService.onReload();
86+
setPaginationTotal();
8387
}
8488

8589
paginationService.onReload = function () {
8690
$http.get($scope.getEndpoint()+window.location.search).then(function (response) {
8791
$scope.table = response.data;
8892
});
89-
$http.get('api/num_exceptions'+window.location.search).then(function (response) {
90-
paginationService.total = response.data;
91-
});
9293
};
9394
};

0 commit comments

Comments
 (0)