Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions projects/common/src/navigation/breadcrumb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export interface Breadcrumb {
icon?: string;
url?: string[];
hide?: boolean;
alwaysShowIcon?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@ describe('BreadcrumbsComponent', () => {
label: 'First',
type: 'First Type',
icon: 'firstIcon',
url: ['first', 'second']
url: ['first', 'second'],
alwaysShowIcon: false
},
{
label: 'Second'
label: 'Second',
icon: 'secondIcon',
alwaysShowIcon: true
},
{
label: 'Third',
type: 'Third Type',
icon: 'secondIcon',
url: ['first', 'second', 'third']
icon: 'thirdIcon',
url: ['first', 'second', 'third'],
alwaysShowIcon: false
}
]
}
Expand All @@ -53,12 +57,20 @@ describe('BreadcrumbsComponent', () => {
expect(spectator.queryAll('.breadcrumbs .breadcrumb').length).toBe(3);
});

it('should show icon only on the first crumb', () => {
it('should show icon on the first crumb', () => {
const crumbs = spectator.queryAll('.breadcrumbs .breadcrumb');
expect(crumbs[0].querySelector('ht-icon')).toExist();
});

crumbs.shift();
crumbs.forEach(crumb => expect(crumb.querySelector('ht-icon')).toBeNull());
it('should display the icon', () => {
const crumbs = spectator.queryAll('.breadcrumbs .breadcrumb');
crumbs.forEach((crumb, index) => {
if (index < crumbs.length - 1) {
expect(crumb.querySelector('ht-icon')).toExist();
} else {
expect(crumb.querySelector('ht-icon')).toBeNull();
}
});
});

it('should make last crumb inactive', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IconSize } from '../icon/icon-size';
>
<ht-icon
class="icon"
*ngIf="isFirst"
*ngIf="isFirst || breadcrumb.alwaysShowIcon"
[icon]="breadcrumb.icon"
[label]="breadcrumb.label"
size="${IconSize.Small}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ import { NavigableTab } from '../../tabs/navigable/navigable-tab';
>
<div class="breadcrumb-container">
<ht-breadcrumbs [breadcrumbs]="breadcrumbs"></ht-breadcrumbs>

<div class="title" *ngIf="this.titlecrumb$ | async as titlecrumb">
<ht-icon
class="icon"
*ngIf="titlecrumb.icon"
*ngIf="titlecrumb.icon && breadcrumbs.length <= 1"
[icon]="titlecrumb.icon"
[label]="titlecrumb.label"
size="${IconSize.Large}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ describe('Backend detail breadcrumb resolver', () => {
expectObservable(breadcrumb$).toBe('(x|)', {
x: {
label: 'test backend',
icon: ObservabilityIconType.Mysql
icon: ObservabilityIconType.Mysql,
alwaysShowIcon: true
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class BackendDetailBreadcrumbResolver implements Resolve<Observable<Bread
take(1),
map(backend => ({
label: backend.name,
icon: this.iconLookupService.forBackendEntity(backend, this.getBackendTypeAttributeName())
icon: this.iconLookupService.forBackendEntity(backend, this.getBackendTypeAttributeName()),
alwaysShowIcon: true
}))
)
);
Expand Down