Added owners column to the credentials list

This commit is contained in:
Michael Abashian 2016-06-03 14:46:07 -04:00
parent b999206ffd
commit 18c74a8020
6 changed files with 47 additions and 3 deletions

View File

@ -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';
@ -109,6 +110,7 @@ var tower = angular.module('Tower', [
JobTemplates.name,
portalMode.name,
search.name,
credentials.name,
'ngToast',
'templates',
'Utilities',

View 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);

View 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 : [];
}
};
}
];

View File

@ -0,0 +1,3 @@
<div ng-repeat="owner in owners_list">
<a ui-sref="organizations.edit({ organization_id: owner.id })">{{ owner.name }}{{$last ? '' : ', '}}</a>
</div>

View File

@ -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)",

View File

@ -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);