From 999a78353c4ad28ab4e4fd06b9629bb5744d8a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20=C3=81ngel?= Date: Wed, 24 Oct 2018 10:11:12 +0200 Subject: [PATCH] Refreshing the scope even if the request failed --- public/directives/wz-table/lib/data.js | 4 ++-- public/directives/wz-table/lib/init.js | 4 ++-- public/directives/wz-table/lib/pagination.js | 2 +- public/directives/wz-table/lib/sort.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public/directives/wz-table/lib/data.js b/public/directives/wz-table/lib/data.js index 1f0a0feff..efecdf5da 100644 --- a/public/directives/wz-table/lib/data.js +++ b/public/directives/wz-table/lib/data.js @@ -29,7 +29,7 @@ export async function searchData( } catch (error) { $scope.wazuh_table_loading = false; $scope.error = `Error searching - ${error.message || - error} - Please refresh your browser.`; + error}.`; errorHandler.handle( `Error searching. ${error.message || error}`, 'Data factory' @@ -65,7 +65,7 @@ export async function filterData( $scope.wazuh_table_loading = false; $scope.error = `Error filtering by ${ filter ? filter.value : 'undefined' - } - ${error.message || error} - Please refresh your browser.`; + } - ${error.message || error}.`; errorHandler.handle( `Error filtering by ${ filter ? filter.value : 'undefined' diff --git a/public/directives/wz-table/lib/init.js b/public/directives/wz-table/lib/init.js index 5f541e100..8f087396f 100644 --- a/public/directives/wz-table/lib/init.js +++ b/public/directives/wz-table/lib/init.js @@ -50,15 +50,15 @@ export async function initTable( await fetch(); wzTableFilter.set(instance.filters); $scope.wazuh_table_loading = false; - if (!$scope.$$phase) $scope.$digest(); } catch (error) { $scope.wazuh_table_loading = false; $scope.error = `Error while init table - ${error.message || - error} - Please refresh your browser.`; + error}.`; errorHandler.handle( `Error while init table. ${error.message || error}`, 'Data factory' ); } + if (!$scope.$$phase) $scope.$digest(); return; } diff --git a/public/directives/wz-table/lib/pagination.js b/public/directives/wz-table/lib/pagination.js index 462f9dc53..741934ba1 100644 --- a/public/directives/wz-table/lib/pagination.js +++ b/public/directives/wz-table/lib/pagination.js @@ -28,7 +28,7 @@ export async function nextPage(currentPage, $scope, errorHandler, fetch) { } catch (error) { $scope.wazuh_table_loading = false; $scope.error = `Error paginating table - ${error.message || - error} - Please refresh your browser.`; + error}.`; errorHandler.handle( `Error paginating table due to ${error.message || error}`, 'Data factory' diff --git a/public/directives/wz-table/lib/sort.js b/public/directives/wz-table/lib/sort.js index 140531186..cb56c2667 100644 --- a/public/directives/wz-table/lib/sort.js +++ b/public/directives/wz-table/lib/sort.js @@ -19,12 +19,11 @@ export async function sort(field, $scope, instance, fetch, errorHandler) { $scope.sortDir = instance.sortDir; await fetch(); $scope.wazuh_table_loading = false; - if (!$scope.$$phase) $scope.$digest(); } catch (error) { $scope.wazuh_table_loading = false; $scope.error = `Error sorting table by ${ field ? field.value : 'undefined' - } - ${error.message || error} - Please refresh your browser.`; + } - ${error.message || error}.`; errorHandler.handle( `Error sorting table by ${ field ? field.value : 'undefined' @@ -32,5 +31,6 @@ export async function sort(field, $scope, instance, fetch, errorHandler) { 'Data factory' ); } + if (!$scope.$$phase) $scope.$digest(); return; }