Merge pull request #2584 from westlywright/mc-app-bugs

Fix issue with a getting display name on project with no cluster
This commit is contained in:
Westly Wright 2019-01-23 20:00:51 -07:00 committed by GitHub
commit 200ec9b87d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 9 deletions

View File

@ -142,8 +142,8 @@ export default Component.extend(NewOrEdit, CatalogApp, {
const nue = {
type: 'member',
accessType: null,
displayType: principal.displayType || principalType,
displayName: principal.displayName || principal.loginName || principalType.id,
displayType: get(principal, 'displayType') || principalType,
displayName: get(principal, 'displayName') || get(principal, 'loginName') || get(principalType, 'id'),
};
if (!members) {
@ -310,10 +310,12 @@ export default Component.extend(NewOrEdit, CatalogApp, {
allProjectsGroupedByCluster: computed('projects.[]', 'primaryResource.targets.@each.projectId', function() {
return get(this, 'projects').map( (p) => {
const clusterDisplayNameOrNa = get(p, 'cluster.displayName') || this.intl.t('generic.na');
const out = {
name: p.name,
value: p.id,
cluster: `Cluster: ${ p.cluster.displayName }`
name: get(p, 'name'),
value: get(p, 'id'),
cluster: `Cluster: ${ clusterDisplayNameOrNa }`
};
if (get(this, 'primaryResource.targets').findBy('projectId', p.id)) {
@ -333,14 +335,14 @@ export default Component.extend(NewOrEdit, CatalogApp, {
get(this, 'clusters').forEach( (c) => {
out.pushObject({
name: c.name,
value: c.id,
name: get(c, 'name'),
value: get(c, 'id'),
});
c.get('projects').forEach( (p) => {
out.pushObject({
name: p.name,
value: p.id,
name: get(p, 'name'),
value: get(p, 'id'),
});
});
});