diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.html b/lib/content-services/src/lib/aspect-list/aspect-list.component.html index dd39db15ae..304299ae96 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.html +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.html @@ -1,18 +1,18 @@
- - + + -

{{aspect?.entry?.title}}

+

{{getTitle(aspect)}}

- {{aspect?.entry?.title}} + [matTooltip]="getTitle(aspect)"> + {{getTitle(aspect)}}

{{aspect?.entry?.description}}

diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts b/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts index fb419e1e65..af1c8d90ae 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.spec.ts @@ -68,7 +68,7 @@ const aspectListMock: AspectEntry[] = [{ const customAspectListMock: AspectEntry[] = [{ entry: { - parentId: 'cst:customAspect', + parentId: 'cst:parentAspect', id: 'cst:customAspect', description: 'Custom Aspect with random description', title: 'CustomAspect', @@ -85,6 +85,21 @@ const customAspectListMock: AspectEntry[] = [{ } ] } +}, +{ + entry: { + parentId: 'cst:commonaspect', + id: 'cst:nonamedAspect', + description: '', + title: '', + properties: [ + { + id: 'channelPassword', + title: 'The authenticated channel password', + dataType: 'd:propA' + } + ] + } }]; describe('AspectListComponent', () => { @@ -151,6 +166,13 @@ describe('AspectListComponent', () => { expect(secondElement).toBeDefined(); }); + it('should show aspect id when name or title is not set', () => { + const noNameAspect: HTMLElement = fixture.nativeElement.querySelector('#aspect-list-cst-nonamedAspect .adf-aspect-list-element-title'); + expect(noNameAspect).toBeDefined(); + expect(noNameAspect).not.toBeNull(); + expect(noNameAspect.innerText).toBe('cst:nonamedAspect'); + }); + it('should show the details when a row is clicked', () => { const firstElement = fixture.nativeElement.querySelector('#aspect-list-FirstAspect'); firstElement.click(); diff --git a/lib/content-services/src/lib/aspect-list/aspect-list.component.ts b/lib/content-services/src/lib/aspect-list/aspect-list.component.ts index 70f4dc5eff..ab8536f343 100644 --- a/lib/content-services/src/lib/aspect-list/aspect-list.component.ts +++ b/lib/content-services/src/lib/aspect-list/aspect-list.component.ts @@ -101,4 +101,12 @@ export class AspectListComponent implements OnInit, OnDestroy { this.nodeAspects = []; this.valueChanged.emit(this.nodeAspects); } + + getId(aspect: any): string { + return aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id.replace(':', '-'); + } + + getTitle(aspect: any): string { + return aspect?.entry?.title ? aspect?.entry?.title : aspect?.entry?.id; + } }