diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-03-15 16:42:44 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-03-15 16:42:44 +0530 |
commit | 09a3a12526622154d570668cd2be850f6cfbb1e8 (patch) | |
tree | f5e8bcd640bf31819cf708ba2074982e04f0f2d5 /testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js | |
parent | 5e75c8f4882a64efe80640a770f8a256b150eada (diff) |
Add sort in scenarios page + tests
Change-Id: I1b1e4c9cc3739c4ed13fe4c76562b8c35fed4531
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js')
-rw-r--r-- | testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js index 98e4089..240287c 100644 --- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js +++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js @@ -21,7 +21,7 @@ ScenariosController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl', - 'raiseAlert', 'confirmModal' + 'raiseAlert', 'confirmModal', 'sortService' ]; /** @@ -30,7 +30,7 @@ * through projects declared in TestAPI. */ function ScenariosController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal) { + raiseAlert, confirmModal, sortService) { var ctrl = this; ctrl.url = testapiApiUrl + '/scenarios'; @@ -44,8 +44,9 @@ ctrl.deleteScenario = deleteScenario; ctrl.openBatchDeleteModal = openBatchDeleteModal; ctrl.deleteBatchScenario = deleteBatchScenario - + ctrl.sortBy = sortBy ctrl.checkBox = []; + ctrl.sortName = false function openUpdateModal(name){ $uibModal.open({ @@ -68,6 +69,11 @@ confirmModal("Delete", 'scenarios', ctrl.deleteScenario,name); } + function sortBy(){ + ctrl.data.scenarios = sortService.sortFunction(ctrl.data.scenarios, 'name' , ctrl.sortName) + ctrl.sortName=!ctrl.sortName + } + function deleteScenario(name){ var scenarioURL = ctrl.url+"/"+name; ctrl.scenarioRequest = @@ -142,6 +148,7 @@ ctrl.resultsRequest = $http.get(ctrl.url).success(function (data) { ctrl.data = data; + ctrl.sortBy() }).catch(function (data) { ctrl.data = null; ctrl.showError = true; |