mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Merge branch 'owners-credential-list' of https://github.com/mabashian/ansible-tower into mabashian-owners-credential-list
# Conflicts: # awx/ui/client/src/app.js
This commit is contained in:
commit
277c3a62f0
@ -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(),
|
||||
|
@ -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',
|
||||
|
11
awx/ui/client/src/credentials/main.js
Normal file
11
awx/ui/client/src/credentials/main.js
Normal file
@ -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);
|
13
awx/ui/client/src/credentials/ownerList.directive.js
Normal file
13
awx/ui/client/src/credentials/ownerList.directive.js
Normal file
@ -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 : [];
|
||||
}
|
||||
};
|
||||
}
|
||||
];
|
5
awx/ui/client/src/credentials/ownerList.partial.html
Normal file
5
awx/ui/client/src/credentials/ownerList.partial.html
Normal file
@ -0,0 +1,5 @@
|
||||
<div ng-repeat="owner in owners_list">
|
||||
<a ng-if="owner.type === 'organization'" ui-sref="organizations.edit({ organization_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
|
||||
<a ng-if="owner.type === 'user'" ui-sref="users.edit({ user_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
|
||||
<a ng-if="owner.type === 'team'" ui-sref="teams.edit({ team_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
|
||||
</div>
|
@ -39,7 +39,14 @@ export default
|
||||
searchOptions: [], // will be set by Options call to credentials resource
|
||||
excludeModal: true,
|
||||
nosort: true,
|
||||
columnClass: 'col-md-3 hidden-sm hidden-xs'
|
||||
columnClass: 'col-md-2 hidden-sm hidden-xs'
|
||||
},
|
||||
owners: {
|
||||
label: 'Owners',
|
||||
type: 'owners',
|
||||
nosort: true,
|
||||
excludeModal: true,
|
||||
columnClass: 'col-md-2 hidden-sm hidden-xs'
|
||||
}
|
||||
},
|
||||
|
||||
@ -55,7 +62,7 @@ export default
|
||||
|
||||
fieldActions: {
|
||||
|
||||
columnClass: 'col-md-3 col-sm-3 col-xs-3',
|
||||
columnClass: 'col-md-2 col-sm-3 col-xs-3',
|
||||
|
||||
edit: {
|
||||
ngClick: "editCredential(credential.id)",
|
||||
|
@ -482,7 +482,15 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
</labels-list>
|
||||
</td>
|
||||
`;
|
||||
} else if (field.type === 'badgeCount') {
|
||||
} else if (field.type === 'owners') {
|
||||
classList = (field.columnClass) ?
|
||||
Attr(field, 'columnClass') : "";
|
||||
html += `
|
||||
<td ${classList}>
|
||||
<owner-list></owner-list>
|
||||
</td>
|
||||
`;
|
||||
}else if (field.type === 'badgeCount') {
|
||||
html = BadgeCount(params);
|
||||
} else if (field.type === 'badgeOnly') {
|
||||
html = Badge(field);
|
||||
|
Loading…
Reference in New Issue
Block a user