mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Merge branch 'mabashian-owners-credential-list' into release_3.0.0
This commit is contained in:
@@ -1659,6 +1659,7 @@ class CredentialSerializer(BaseSerializer):
|
|||||||
for user in obj.owner_role.members.all():
|
for user in obj.owner_role.members.all():
|
||||||
summary_dict['owners'].append({
|
summary_dict['owners'].append({
|
||||||
'id': user.pk,
|
'id': user.pk,
|
||||||
|
'type': 'user',
|
||||||
'name': user.username,
|
'name': user.username,
|
||||||
'description': ' '.join([user.first_name, user.last_name]),
|
'description': ' '.join([user.first_name, user.last_name]),
|
||||||
'url': reverse('api:user_detail', args=(user.pk,)),
|
'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():
|
for parent in obj.owner_role.parents.exclude(object_id__isnull=True).all():
|
||||||
summary_dict['owners'].append({
|
summary_dict['owners'].append({
|
||||||
'id': parent.content_object.pk,
|
'id': parent.content_object.pk,
|
||||||
|
'type': camelcase_to_underscore(parent.content_object.__class__.__name__),
|
||||||
'name': parent.content_object.name,
|
'name': parent.content_object.name,
|
||||||
'description': parent.content_object.description,
|
'description': parent.content_object.description,
|
||||||
'url': parent.content_object.get_absolute_url(),
|
'url': parent.content_object.get_absolute_url(),
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import activityStream from './activity-stream/main';
|
|||||||
import standardOut from './standard-out/main';
|
import standardOut from './standard-out/main';
|
||||||
import JobTemplates from './job-templates/main';
|
import JobTemplates from './job-templates/main';
|
||||||
import search from './search/main';
|
import search from './search/main';
|
||||||
|
import credentials from './credentials/main';
|
||||||
import {ProjectsList, ProjectsAdd, ProjectsEdit} from './controllers/Projects';
|
import {ProjectsList, ProjectsAdd, ProjectsEdit} from './controllers/Projects';
|
||||||
import OrganizationsList from './organizations/list/organizations-list.controller';
|
import OrganizationsList from './organizations/list/organizations-list.controller';
|
||||||
import OrganizationsAdd from './organizations/add/organizations-add.controller';
|
import OrganizationsAdd from './organizations/add/organizations-add.controller';
|
||||||
@@ -111,6 +112,7 @@ var tower = angular.module('Tower', [
|
|||||||
portalMode.name,
|
portalMode.name,
|
||||||
search.name,
|
search.name,
|
||||||
config.name,
|
config.name,
|
||||||
|
credentials.name,
|
||||||
'ngToast',
|
'ngToast',
|
||||||
'templates',
|
'templates',
|
||||||
'Utilities',
|
'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
|
searchOptions: [], // will be set by Options call to credentials resource
|
||||||
excludeModal: true,
|
excludeModal: true,
|
||||||
nosort: 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: {
|
fieldActions: {
|
||||||
|
|
||||||
columnClass: 'col-md-3 col-sm-3 col-xs-3',
|
columnClass: 'col-md-2 col-sm-3 col-xs-3',
|
||||||
|
|
||||||
edit: {
|
edit: {
|
||||||
ngClick: "editCredential(credential.id)",
|
ngClick: "editCredential(credential.id)",
|
||||||
|
|||||||
@@ -482,7 +482,15 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
|||||||
</labels-list>
|
</labels-list>
|
||||||
</td>
|
</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);
|
html = BadgeCount(params);
|
||||||
} else if (field.type === 'badgeOnly') {
|
} else if (field.type === 'badgeOnly') {
|
||||||
html = Badge(field);
|
html = Badge(field);
|
||||||
|
|||||||
Reference in New Issue
Block a user