Skip to content

Commit

Permalink
NAS-131248 / 25.04 / Update copyright line component to use dynamic l…
Browse files Browse the repository at this point in the history
…inks (#11150)

* NAS-131248: Update copyright line component to use dynamic links

* NAS-131248: Use computed property
  • Loading branch information
denysbutenko authored Dec 6, 2024
1 parent 3408719 commit 7fc9ed2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
-
}
<a
href="https://www.ixsystems.com/"
target="_blank"
title="iXsystems, Inc."
ixTest="copyright"
[href]="targetHref()"
>
@if (withIxLogo()) {
<img class="ix-logo" src="assets/images/ix_logo_full.png" alt="iXsystems, Inc.">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ describe('CopyrightLineComponent', () => {

expect(spectator.fixture.nativeElement).toHaveText('TrueNAS ® © 2024');
expect(spectator.fixture.nativeElement).toHaveText('iXsystems, Inc');
expect(spectator.query('a')).toHaveAttribute('href', 'https://truenas.com/testdrive');
});

it('shows copyright line with enterprise product type and year of build', () => {
Expand All @@ -46,5 +47,6 @@ describe('CopyrightLineComponent', () => {

expect(spectator.fixture.nativeElement).toHaveText('TrueNAS ENTERPRISE ® © 2024');
expect(spectator.fixture.nativeElement).toHaveText('iXsystems, Inc');
expect(spectator.query('a')).toHaveAttribute('href', 'https://truenas.com/production');
});
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
ChangeDetectionStrategy, Component, input,
ChangeDetectionStrategy, Component, computed, input,
} from '@angular/core';
import { toSignal } from '@angular/core/rxjs-interop';
import { Store } from '@ngrx/store';
import { TestDirective } from 'app/modules/test-id/test.directive';
import { AppState } from 'app/store';
import { selectCopyrightText } from 'app/store/system-info/system-info.selectors';
import { selectCopyrightText, selectIsEnterprise } from 'app/store/system-info/system-info.selectors';

@Component({
selector: 'ix-copyright-line',
Expand All @@ -18,6 +18,10 @@ import { selectCopyrightText } from 'app/store/system-info/system-info.selectors
export class CopyrightLineComponent {
readonly withIxLogo = input(false);
readonly copyrightText = toSignal(this.store$.select(selectCopyrightText));
readonly isEnterprise = toSignal(this.store$.select(selectIsEnterprise));
readonly targetHref = computed(() => {
return this.isEnterprise() ? 'https://truenas.com/production' : 'https://truenas.com/testdrive';
});

constructor(private store$: Store<AppState>) { }
}

0 comments on commit 7fc9ed2

Please sign in to comment.