Merge pull request #7161 from jlmitch5/credTypeSelectUpdates

only show cloud and network in select for custom cred types
This commit is contained in:
jlmitch5
2017-07-19 15:42:41 -04:00
committed by GitHub
2 changed files with 15 additions and 1 deletions

View File

@@ -17,6 +17,14 @@ export default ['Rest', 'Wait',
init(); init();
function 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 // Load the list of options for Kind
$scope.$parent.optionsDefer.promise $scope.$parent.optionsDefer.promise
.then(function(options) { .then(function(options) {
@@ -25,7 +33,8 @@ export default ['Rest', 'Wait',
url: url, url: url,
field: 'kind', field: 'kind',
variable: 'credential_kind_options', variable: 'credential_kind_options',
options: options options: options,
callback: 'loadCredentialKindOptions'
}); });
if (!options.actions.POST) { if (!options.actions.POST) {

View File

@@ -43,6 +43,11 @@ export default ['Rest', 'Wait',
} }
$scope.removeChoicesReady = $scope.$on('choicesReadyCredentialTypes', $scope.removeChoicesReady = $scope.$on('choicesReadyCredentialTypes',
function() { 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; $scope.credential_type = credential_typeData;