diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-03-31 10:58:08 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-03-31 10:58:08 +0530 |
commit | 8d6380265299c36f6356c746460baa0cfd2ad4e1 (patch) | |
tree | c7f70dd55350b5d78ba8c240dcc4660fe6f878cc /testapi/opnfv_testapi/ui/components/pods/pod/podController.js | |
parent | c20c8286d72ca64751162b1932e0e3f680f0e32f (diff) |
Remove code duplication in pod page
Create a service to map the object field with
the data label.
Change-Id: I0c3e96dca01a27ec4785c1426d82e115afb6c1df
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/pods/pod/podController.js')
-rw-r--r-- | testapi/opnfv_testapi/ui/components/pods/pod/podController.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/testapi/opnfv_testapi/ui/components/pods/pod/podController.js b/testapi/opnfv_testapi/ui/components/pods/pod/podController.js index a2e18e8..39ba599 100644 --- a/testapi/opnfv_testapi/ui/components/pods/pod/podController.js +++ b/testapi/opnfv_testapi/ui/components/pods/pod/podController.js @@ -21,7 +21,7 @@ PodController.$inject = [ '$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert', - 'confirmModal' + 'confirmModal', 'dataFieldService' ]; /** @@ -30,11 +30,12 @@ * through pod declared in TestAPI. */ function PodController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl, - raiseAlert, confirmModal) { + raiseAlert, confirmModal, dataFieldService) { var ctrl = this; ctrl.url = testapiApiUrl + '/pods'; ctrl.name = $state.params['name']; - ctrl.loadDetails = loadDetails + ctrl.loadDetails = loadDetails; + ctrl.data_field = {}; /** *Contact the testapi and retrevie the pod details @@ -45,6 +46,7 @@ ctrl.podsRequest = $http.get(podUrl).success(function (data) { ctrl.data = data; + ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field) }).catch(function (error) { ctrl.data = null; ctrl.showError = true; |