Skip to content

Commit

Permalink
NAS-133331: Remove failover status from signin page (#11266)
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft authored Jan 1, 2025
1 parent 13caa2e commit ed05dae
Show file tree
Hide file tree
Showing 100 changed files with 1,165 additions and 2,669 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<div class="fake-icon">?</div>
@if (hasFailover()) {
<p>
{{ 'Waiting for Active TrueNAS controller to come up...' | translate }}
</p>
} @else {
<p>
{{ 'Connecting to TrueNAS' | translate }}
{{ '... Make sure the TrueNAS system is powered on and connected to the network.' | translate }}
</p>
}
<p>
{{ 'Connecting to TrueNAS' | translate }}
{{ '... Make sure the TrueNAS system is powered on and connected to the network.' | translate }}
</p>
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,4 @@ describe('DisconnectedMessageComponent', () => {
expect(spectator.fixture.nativeElement).toHaveText('Connecting to TrueNAS');
expect(spectator.fixture.nativeElement).toHaveText('Make sure the TrueNAS system is powered on and connected to the network.');
});

it('shows "Waiting for controller" message when hasFailover is true', () => {
spectator.setInput('hasFailover', true);

expect(spectator.fixture.nativeElement).toHaveText('Waiting for Active TrueNAS controller to come up...');
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
ChangeDetectionStrategy, Component, input,
ChangeDetectionStrategy, Component,
} from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';

Expand All @@ -11,6 +11,4 @@ import { TranslateModule } from '@ngx-translate/core';
standalone: true,
imports: [TranslateModule],
})
export class DisconnectedMessageComponent {
readonly hasFailover = input(false);
}
export class DisconnectedMessageComponent {}

This file was deleted.

This file was deleted.

This file was deleted.

65 changes: 0 additions & 65 deletions src/app/pages/signin/failover-status/failover-status.component.ts

This file was deleted.

15 changes: 1 addition & 14 deletions src/app/pages/signin/signin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
@if (!(isConnected$ | async) && (isConnectedDelayed$ | async) !== null) {
<mat-card>
<mat-card-content>
<ix-disconnected-message
[hasFailover]="hasFailover$ | async"
></ix-disconnected-message>
<ix-disconnected-message></ix-disconnected-message>
</mat-card-content>
</mat-card>
} @else if (isConnected$ | async) {
Expand All @@ -40,17 +38,6 @@ <h3 class="logging-in">{{ 'Logging in...' | translate }}</h3>
}
</div>

@if (failover$ | async; as failover) {
@if (hasFailover$ | async) {
<ix-failover-status
class="failover-status"
[status]="failover.status"
[failoverIps]="failover.ips"
[disabledReasons]="failover.disabledReasons"
></ix-failover-status>
}
}

<ix-true-command-status></ix-true-command-status>

<div class="ix-logo">
Expand Down
32 changes: 0 additions & 32 deletions src/app/pages/signin/signin.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest';
import { MockComponents } from 'ng-mocks';
import { NgxSkeletonLoaderComponent } from 'ngx-skeleton-loader';
import { BehaviorSubject, of } from 'rxjs';
import { FailoverDisabledReason } from 'app/enums/failover-disabled-reason.enum';
import { FailoverStatus } from 'app/enums/failover-status.enum';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { CopyrightLineComponent } from 'app/modules/layout/copyright-line/copyright-line.component';
import {
DisconnectedMessageComponent,
} from 'app/pages/signin/disconnected-message/disconnected-message.component';
import { FailoverStatusComponent } from 'app/pages/signin/failover-status/failover-status.component';
import {
SetAdminPasswordFormComponent,
} from 'app/pages/signin/set-admin-password-form/set-admin-password-form.component';
Expand All @@ -26,12 +22,6 @@ import { WebSocketHandlerService } from 'app/services/websocket/websocket-handle
describe('SigninComponent', () => {
let spectator: Spectator<SigninComponent>;
const wasAdminSet$ = new BehaviorSubject<boolean>(undefined);
const failover$ = new BehaviorSubject<{
status: FailoverStatus;
ips?: string[];
disabledReasons?: FailoverDisabledReason[];
}>(null);
const hasFailover$ = new BehaviorSubject<boolean>(undefined);
const canLogin$ = new BehaviorSubject<boolean>(undefined);
const isConnected$ = new BehaviorSubject<boolean>(undefined);
const loginBanner$ = new BehaviorSubject<string>(undefined);
Expand All @@ -41,21 +31,17 @@ describe('SigninComponent', () => {
const createComponent = createComponentFactory({
component: SigninComponent,
imports: [
NgxSkeletonLoaderComponent,
MockComponents(
SigninFormComponent,
DisconnectedMessageComponent,
SetAdminPasswordFormComponent,
TrueCommandStatusComponent,
FailoverStatusComponent,
CopyrightLineComponent,
),
],
componentProviders: [
mockProvider(SigninStore, {
wasAdminSet$,
failover$,
hasFailover$,
canLogin$,
loginBanner$,
isLoading$: of(false),
Expand All @@ -81,8 +67,6 @@ describe('SigninComponent', () => {
beforeEach(() => {
spectator = createComponent();
wasAdminSet$.next(true);
failover$.next(null);
hasFailover$.next(false);
canLogin$.next(true);
isConnected$.next(true);
loginBanner$.next('');
Expand Down Expand Up @@ -125,22 +109,6 @@ describe('SigninComponent', () => {
expect(spectator.query(TrueCommandStatusComponent)).toExist();
});

it('shows FailoverStatusComponent when failover status is loaded and system has failover', () => {
failover$.next({
status: FailoverStatus.Error,
ips: ['123.44.1.22', '123.44.1.34'],
disabledReasons: [FailoverDisabledReason.NoPong],
});
hasFailover$.next(true);
spectator.detectChanges();

const failoverStatus = spectator.query(FailoverStatusComponent)!;
expect(failoverStatus).toExist();
expect(failoverStatus.disabledReasons).toEqual([FailoverDisabledReason.NoPong]);
expect(failoverStatus.status).toEqual(FailoverStatus.Error);
expect(failoverStatus.failoverIps).toEqual(['123.44.1.22', '123.44.1.34']);
});

it('shows the logo when waiting for connection status', () => {
isConnectedDelayed$.next(null);
spectator.detectChanges();
Expand Down
4 changes: 0 additions & 4 deletions src/app/pages/signin/signin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { DialogService } from 'app/modules/dialog/dialog.service';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { CopyrightLineComponent } from 'app/modules/layout/copyright-line/copyright-line.component';
import { DisconnectedMessageComponent } from 'app/pages/signin/disconnected-message/disconnected-message.component';
import { FailoverStatusComponent } from 'app/pages/signin/failover-status/failover-status.component';
import { SetAdminPasswordFormComponent } from 'app/pages/signin/set-admin-password-form/set-admin-password-form.component';
import { SigninFormComponent } from 'app/pages/signin/signin-form/signin-form.component';
import { SigninStore } from 'app/pages/signin/store/signin.store';
Expand All @@ -40,7 +39,6 @@ import { WebSocketHandlerService } from 'app/services/websocket/websocket-handle
IxIconComponent,
SigninFormComponent,
SetAdminPasswordFormComponent,
FailoverStatusComponent,
TrueCommandStatusComponent,
DisconnectedMessageComponent,
AsyncPipe,
Expand All @@ -54,8 +52,6 @@ export class SigninComponent implements OnInit {
protected isTokenWithinTimeline$ = this.tokenLastUsedService.isTokenWithinTimeline$;

readonly wasAdminSet$ = this.signinStore.wasAdminSet$;
readonly failover$ = this.signinStore.failover$;
readonly hasFailover$ = this.signinStore.hasFailover$;
readonly canLogin$ = this.signinStore.canLogin$;
readonly isConnected$ = this.wsManager.isConnected$;
isConnectedDelayed$: Observable<boolean> = of(null).pipe(
Expand Down
Loading

0 comments on commit ed05dae

Please sign in to comment.