diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 7f486bcd5d..7f295596dc 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1659,6 +1659,7 @@ class CredentialSerializer(BaseSerializer): for user in obj.owner_role.members.all(): summary_dict['owners'].append({ 'id': user.pk, + 'type': 'user', 'name': user.username, 'description': ' '.join([user.first_name, user.last_name]), 'url': reverse('api:user_detail', args=(user.pk,)), @@ -1667,6 +1668,7 @@ class CredentialSerializer(BaseSerializer): for parent in obj.owner_role.parents.exclude(object_id__isnull=True).all(): summary_dict['owners'].append({ 'id': parent.content_object.pk, + 'type': camelcase_to_underscore(parent.content_object.__class__.__name__), 'name': parent.content_object.name, 'description': parent.content_object.description, 'url': parent.content_object.get_absolute_url(), diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index 80bff7b50d..c98714b353 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -52,6 +52,7 @@ import activityStream from './activity-stream/main'; import standardOut from './standard-out/main'; import JobTemplates from './job-templates/main'; import search from './search/main'; +import credentials from './credentials/main'; import {ProjectsList, ProjectsAdd, ProjectsEdit} from './controllers/Projects'; import OrganizationsList from './organizations/list/organizations-list.controller'; import OrganizationsAdd from './organizations/add/organizations-add.controller'; @@ -111,6 +112,7 @@ var tower = angular.module('Tower', [ portalMode.name, search.name, config.name, + credentials.name, 'ngToast', 'templates', 'Utilities', diff --git a/awx/ui/client/src/credentials/main.js b/awx/ui/client/src/credentials/main.js new file mode 100644 index 0000000000..faee3f5093 --- /dev/null +++ b/awx/ui/client/src/credentials/main.js @@ -0,0 +1,11 @@ +/************************************************* + * Copyright (c) 2016 Ansible, Inc. + * + * All Rights Reserved + *************************************************/ + +import ownerList from './ownerList.directive'; + +export default + angular.module('credentials', []) + .directive('ownerList', ownerList); diff --git a/awx/ui/client/src/credentials/ownerList.directive.js b/awx/ui/client/src/credentials/ownerList.directive.js new file mode 100644 index 0000000000..a5178bc69b --- /dev/null +++ b/awx/ui/client/src/credentials/ownerList.directive.js @@ -0,0 +1,13 @@ +export default + [ 'templateUrl', + function(templateUrl) { + return { + restrict: 'E', + scope: false, + templateUrl: templateUrl('credentials/ownerList'), + link: function(scope) { + scope.owners_list = scope.credential.summary_fields.owners && scope.credential.summary_fields.owners.length > 0 ? scope.credential.summary_fields.owners : []; + } + }; + } + ]; diff --git a/awx/ui/client/src/credentials/ownerList.partial.html b/awx/ui/client/src/credentials/ownerList.partial.html new file mode 100644 index 0000000000..1ed46c081b --- /dev/null +++ b/awx/ui/client/src/credentials/ownerList.partial.html @@ -0,0 +1,5 @@ +