From bc5a216764b93ad9551830f2459194a4cea9d754 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Thu, 8 Mar 2018 15:17:45 +0530 Subject: Keep state when user click back in browser Add service to keep the filter state for every page. Filters will reload when user click back in the browser. JIRA: RELENG-349 Change-Id: I1d82b3ce6004fa41b07ffd0b87626825aa01c922 Signed-off-by: thuva4 --- .../components/deploy-results/deployResultsController.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'testapi/opnfv_testapi/ui/components/deploy-results') diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js index 5230a75..1128825 100644 --- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js +++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js @@ -20,7 +20,8 @@ .controller('DeployResultsController', DeployResultsController); DeployResultsController.$inject = [ - '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert' + '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert', + 'keepState' ]; /** @@ -29,7 +30,7 @@ * a listing of community uploaded results. */ function DeployResultsController($scope, $http, $filter, $state, testapiApiUrl, - raiseAlert) { + raiseAlert, keepState) { var ctrl = this; ctrl.open = open; @@ -122,6 +123,15 @@ function filterList(){ if(ctrl.filter && ctrl.filterText!="" && ctrl.filterText!=undefined){ ctrl.tagArray[ctrl.filter] = ctrl.filterText; + if(!keepState.filter.deployResultFilter){ + keepState.filter.deployResultFilter = {} + } + keepState.filter.deployResultFilter[ctrl.filter] = ctrl.filterText + } + else if(Object.keys(ctrl.tagArray).length==0){ + if(keepState.filter.deployResultFilter){ + ctrl.tagArray = keepState.filter.deployResultFilter + } } ctrl.showError = false; var content_url = testapiApiUrl + '/deployresults' + -- cgit 1.2.3-korg