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