From ce4eccc5136ace099bb4ac7923f50b7c1b6f8b2f Mon Sep 17 00:00:00 2001 From: gconsidine Date: Mon, 24 Jul 2017 14:27:40 -0400 Subject: [PATCH] Add assignment of on list change --- .../credentials/list/credentials-list.controller.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/src/credentials/list/credentials-list.controller.js b/awx/ui/client/src/credentials/list/credentials-list.controller.js index 244afe6cc5..a160bfa40e 100644 --- a/awx/ui/client/src/credentials/list/credentials-list.controller.js +++ b/awx/ui/client/src/credentials/list/credentials-list.controller.js @@ -21,16 +21,14 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', ' $scope.canAdd = params.canAdd; }); + $scope.$watch(list.name, assignCredentialKinds); + // search init $scope.list = list; $scope[`${list.iterator}_dataset`] = Dataset.data; $scope[list.name] = $scope[`${list.iterator}_dataset`].results; $scope.selected = []; - - $scope[list.name].forEach(credential => { - credential.kind = credentialType.getById(credential.credential_type).name; - }); } $scope.$on(`${list.iterator}_options`, function(event, data){ @@ -42,6 +40,12 @@ export default ['$scope', 'Rest', 'CredentialList', 'Prompt', 'ProcessErrors', ' optionsRequestDataProcessing(); }); + function assignCredentialKinds () { + $scope[list.name].forEach(credential => { + credential.kind = credentialType.getById(credential.credential_type).name; + }); + } + // iterate over the list and add fields like type label, after the // OPTIONS request returns, or the list is sorted/paginated/searched function optionsRequestDataProcessing(){