diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-03-08 15:17:45 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-03-08 15:17:45 +0530 |
commit | bc5a216764b93ad9551830f2459194a4cea9d754 (patch) | |
tree | de285f30e3faf77242e52dc9e07d26225852789d /testapi/opnfv_testapi/ui/components/deploy-results | |
parent | f3a5531761a38cf40d0469209145394b31af2088 (diff) |
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 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/deploy-results')
-rw-r--r-- | testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js | 14 |
1 files changed, 12 insertions, 2 deletions
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' + |