From 13f899bad8ac8994ef49da6bc33936134e0e99f2 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 19 Jul 2017 12:46:54 -0400 Subject: [PATCH] only show cloud and network in select for custom cred types --- .../client/src/credential-types/add/add.controller.js | 11 ++++++++++- .../src/credential-types/edit/edit.controller.js | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/credential-types/add/add.controller.js b/awx/ui/client/src/credential-types/add/add.controller.js index c8d2d3d38f..4b9770689d 100644 --- a/awx/ui/client/src/credential-types/add/add.controller.js +++ b/awx/ui/client/src/credential-types/add/add.controller.js @@ -17,6 +17,14 @@ export default ['Rest', 'Wait', init(); function init() { + + // for add, don't show ssh + $scope.$on('loadCredentialKindOptions', function() { + $scope.credential_kind_options = $scope.credential_kind_options + .filter(val => val.value === 'net' || + val.value === 'cloud'); + }); + // Load the list of options for Kind $scope.$parent.optionsDefer.promise .then(function(options) { @@ -25,7 +33,8 @@ export default ['Rest', 'Wait', url: url, field: 'kind', variable: 'credential_kind_options', - options: options + options: options, + callback: 'loadCredentialKindOptions' }); if (!options.actions.POST) { diff --git a/awx/ui/client/src/credential-types/edit/edit.controller.js b/awx/ui/client/src/credential-types/edit/edit.controller.js index 2808ef3249..775ebe6ce3 100644 --- a/awx/ui/client/src/credential-types/edit/edit.controller.js +++ b/awx/ui/client/src/credential-types/edit/edit.controller.js @@ -43,6 +43,11 @@ export default ['Rest', 'Wait', } $scope.removeChoicesReady = $scope.$on('choicesReadyCredentialTypes', function() { + if (!resourceData.data.managed_by_tower) { + $scope.credential_kind_options = $scope.credential_kind_options + .filter(val => val.value === 'net' || + val.value === 'cloud'); + } $scope.credential_type = credential_typeData;