From 7b7559cf53edca83d20d7d37abb2f471b715fd13 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Wed, 23 Jan 2019 18:29:21 -0700 Subject: [PATCH] Fix issue with a getting display name on project with no cluster --- .../new-multi-cluster-app/component.js | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/global-admin/addon/components/new-multi-cluster-app/component.js b/lib/global-admin/addon/components/new-multi-cluster-app/component.js index 6269dd7af..6a370034d 100644 --- a/lib/global-admin/addon/components/new-multi-cluster-app/component.js +++ b/lib/global-admin/addon/components/new-multi-cluster-app/component.js @@ -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'), }); }); });