Skip to content

Privacy Policy opening in new tab #1769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 1, 2022
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { ActivatedRoute } from '@angular/router';
import { IconType } from '@hypertrace/assets-library';
import { FeatureState, FeatureStateResolver, MemoizeModule, NavigationService } from '@hypertrace/common';
import {
ExternalNavigationWindowHandling,
FeatureState,
FeatureStateResolver,
MemoizeModule,
NavigationParamsType,
NavigationService
} from '@hypertrace/common';
import { createHostFactory, mockProvider, SpectatorHost } from '@ngneat/spectator/jest';
import { MockComponent } from 'ng-mocks';
import { EMPTY, of } from 'rxjs';
Expand Down Expand Up @@ -78,6 +85,11 @@ describe('Navigation List Component', () => {
);
const footerItemsCount = spectator.component.footerItems?.length;
expect(spectator.queryAll('.footer-item').length).toBe(footerItemsCount);
expect(spectator.query(LinkComponent)?.paramsOrUrl).toMatchObject({
navType: NavigationParamsType.External,
url: 'http://test',
windowHandling: ExternalNavigationWindowHandling.NewWindow
});
});

test('should update layout when collapsed input is updated', () => {
Expand Down
18 changes: 16 additions & 2 deletions projects/components/src/navigation/navigation-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { IconType } from '@hypertrace/assets-library';
import { NavigationService, TypedSimpleChanges } from '@hypertrace/common';
import {
ExternalNavigationParams,
ExternalNavigationWindowHandling,
NavigationParamsType,
NavigationService,
TypedSimpleChanges
} from '@hypertrace/common';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { IconSize } from '../icon/icon-size';
Expand Down Expand Up @@ -70,7 +76,7 @@ import {

<hr class="nav-divider" />
<div *ngFor="let footerItem of footerItems" class="footer-item">
<ht-link class="link" [paramsOrUrl]="footerItem.url">
<ht-link class="link" [paramsOrUrl]="this.getFooterItemNavigationParams | htMemoize: footerItem.url">
<ht-icon *ngIf="this.collapsed" [icon]="footerItem.icon" size="${IconSize.Small}"></ht-icon>
<ht-label *ngIf="!this.collapsed" [label]="footerItem.label"></ht-label>
</ht-link>
Expand Down Expand Up @@ -112,6 +118,14 @@ export class NavigationListComponent implements OnChanges {
private readonly navListComponentService: NavigationListComponentService
) {}

public getFooterItemNavigationParams(url: string): ExternalNavigationParams {
return {
navType: NavigationParamsType.External,
url: url,
windowHandling: ExternalNavigationWindowHandling.NewWindow
};
}

public ngOnChanges(changes: TypedSimpleChanges<this>): void {
if (changes.navItems) {
this.navItems = this.navListComponentService.resolveFeaturesAndUpdateVisibilityForNavItems(this.navItems);
Expand Down