-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:truenas/webui into NAS-132542
# Conflicts: # src/assets/i18n/zh-hans.json
- Loading branch information
Showing
140 changed files
with
1,651 additions
and
934 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export interface SystemRebootInfo { | ||
boot_id: string; | ||
reboot_required_reasons: RebootRequiredReasons[]; | ||
} | ||
|
||
export interface FailoverRebootInfo { | ||
this_node: SystemRebootInfo; | ||
other_node: SystemRebootInfo | null; | ||
} | ||
|
||
export interface RebootRequiredReasons { | ||
code: string; | ||
reason: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...pp/modules/dialog/components/reboot-required-dialog/reboot-required-dialog.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<h3 mat-dialog-title> | ||
{{ 'Reboot Required' | translate }} | ||
</h3> | ||
|
||
<div mat-dialog-content> | ||
@if(thisNodeRebootReasons().length) { | ||
<div class="reasons"> | ||
<p class="dialog-message"> | ||
<span>{{ 'The local node must be rebooted because' | translate }}:</span> | ||
</p> | ||
@for (reason of thisNodeRebootReasons(); track reason) { | ||
<li> {{ reason.reason }} </li> | ||
} | ||
</div> | ||
} | ||
|
||
@if(otherNodeRebootReasons().length) { | ||
<div class="reasons"> | ||
<p class="dialog-message"> | ||
<span>{{ 'The remote node must be rebooted because' | translate }}:</span> | ||
</p> | ||
@for (reason of otherNodeRebootReasons(); track reason) { | ||
<li> {{ reason.reason }} </li> | ||
} | ||
</div> | ||
} | ||
</div> | ||
|
||
@if(thisNodeRebootReasons().length || otherNodeRebootReasons().length) { | ||
<ix-form-actions mat-dialog-actions class="form-actions"> | ||
<ix-checkbox | ||
class="confirm" | ||
[formControl]="form.controls.confirm" | ||
[label]="'Confirm' | translate" | ||
[required]="true" | ||
></ix-checkbox> | ||
|
||
<button mat-button type="button" matDialogClose ixTest="cancel"> | ||
{{ 'Cancel' | translate }} | ||
</button> | ||
|
||
@if(thisNodeRebootReasons().length) { | ||
<button | ||
mat-button | ||
color="primary" | ||
ixTest="reboot-local" | ||
[disabled]="form.invalid" | ||
(click)="rebootLocalNode()" | ||
> | ||
{{ 'Reboot Local' | translate }} | ||
</button> | ||
} | ||
|
||
@if(otherNodeRebootReasons().length) { | ||
<button | ||
mat-button | ||
color="primary" | ||
ixTest="reboot-remote" | ||
[disabled]="form.invalid" | ||
(click)="rebootRemoteNode()" | ||
> | ||
{{ 'Reboot Remote' | translate }} | ||
</button> | ||
} | ||
</ix-form-actions> | ||
} |
14 changes: 14 additions & 0 deletions
14
...pp/modules/dialog/components/reboot-required-dialog/reboot-required-dialog.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.dialog-message { | ||
margin-bottom: 5px; | ||
margin-top: 0; | ||
padding: 0; | ||
} | ||
|
||
.reasons { | ||
padding: 0 12px 12px; | ||
} | ||
|
||
.confirm { | ||
margin-right: auto; | ||
padding-right: 10px; | ||
} |
60 changes: 60 additions & 0 deletions
60
...modules/dialog/components/reboot-required-dialog/reboot-required-dialog.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; | ||
import { provideMockStore } from '@ngrx/store/testing'; | ||
import { SystemRebootInfo } from 'app/interfaces/reboot-info.interface'; | ||
import { RebootRequiredDialogComponent } from 'app/modules/dialog/components/reboot-required-dialog/reboot-required-dialog.component'; | ||
import { | ||
selectOtherNodeRebootInfo, | ||
selectThisNodeRebootInfo, | ||
} from 'app/store/reboot-info/reboot-info.selectors'; | ||
|
||
const fakeThisNodeRebootInfo: SystemRebootInfo = { | ||
boot_id: 'this-boot-id', | ||
reboot_required_reasons: [ | ||
{ code: 'FIPS', reason: 'Test Reason 1' }, | ||
{ code: 'FIPS', reason: 'Test Reason 2' }, | ||
], | ||
}; | ||
|
||
const fakeOtherNodeRebootInfo: SystemRebootInfo = { | ||
boot_id: 'other-boot-id', | ||
reboot_required_reasons: [ | ||
{ code: 'FIPS', reason: 'Test Reason 3' }, | ||
{ code: 'FIPS', reason: 'Test Reason 4' }, | ||
], | ||
}; | ||
|
||
describe('RebootRequiredDialogComponent', () => { | ||
let spectator: Spectator<RebootRequiredDialogComponent>; | ||
const createComponent = createComponentFactory({ | ||
component: RebootRequiredDialogComponent, | ||
providers: [ | ||
provideMockStore({ | ||
selectors: [ | ||
{ | ||
selector: selectThisNodeRebootInfo, | ||
value: fakeThisNodeRebootInfo, | ||
}, | ||
{ | ||
selector: selectOtherNodeRebootInfo, | ||
value: fakeOtherNodeRebootInfo, | ||
}, | ||
], | ||
}), | ||
], | ||
}); | ||
|
||
beforeEach(() => { | ||
spectator = createComponent(); | ||
}); | ||
|
||
it('shows reasons', () => { | ||
expect( | ||
spectator.queryAll('.reasons li').map((item) => item.textContent.trim()), | ||
).toEqual([ | ||
'Test Reason 1', | ||
'Test Reason 2', | ||
'Test Reason 3', | ||
'Test Reason 4', | ||
]); | ||
}); | ||
}); |
64 changes: 64 additions & 0 deletions
64
src/app/modules/dialog/components/reboot-required-dialog/reboot-required-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { CdkScrollable } from '@angular/cdk/scrolling'; | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { toSignal } from '@angular/core/rxjs-interop'; | ||
import { ReactiveFormsModule, Validators } from '@angular/forms'; | ||
import { MatButton } from '@angular/material/button'; | ||
import { MatDialogModule } from '@angular/material/dialog'; | ||
import { FormBuilder } from '@ngneat/reactive-forms'; | ||
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | ||
import { Store } from '@ngrx/store'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { map } from 'rxjs'; | ||
import { RebootRequiredReasons } from 'app/interfaces/reboot-info.interface'; | ||
import { IxCheckboxComponent } from 'app/modules/forms/ix-forms/components/ix-checkbox/ix-checkbox.component'; | ||
import { FipsService } from 'app/services/fips.service'; | ||
import { AppState } from 'app/store'; | ||
import { selectOtherNodeRebootInfo, selectThisNodeRebootInfo } from 'app/store/reboot-info/reboot-info.selectors'; | ||
|
||
@UntilDestroy() | ||
@Component({ | ||
selector: 'ix-reboot-required-dialog', | ||
templateUrl: './reboot-required-dialog.component.html', | ||
styleUrls: ['./reboot-required-dialog.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
CdkScrollable, | ||
TranslateModule, | ||
ReactiveFormsModule, | ||
MatDialogModule, | ||
IxCheckboxComponent, | ||
MatButton, | ||
], | ||
}) | ||
export class RebootRequiredDialogComponent { | ||
thisNodeRebootReasons = toSignal(this.store$.select(selectThisNodeRebootInfo).pipe( | ||
map((info) => info?.reboot_required_reasons || []), | ||
)); | ||
|
||
otherNodeRebootReasons = toSignal(this.store$.select(selectOtherNodeRebootInfo).pipe( | ||
map((info) => info?.reboot_required_reasons || []), | ||
)); | ||
|
||
form = this.fb.group({ | ||
confirm: [false, Validators.requiredTrue], | ||
}); | ||
|
||
constructor( | ||
private store$: Store<AppState>, | ||
private fips: FipsService, | ||
private fb: FormBuilder, | ||
) {} | ||
|
||
typeReasons(reasons: unknown): RebootRequiredReasons[] { | ||
return reasons as RebootRequiredReasons[]; | ||
} | ||
|
||
rebootLocalNode(): void { | ||
this.fips.restart(); | ||
} | ||
|
||
rebootRemoteNode(): void { | ||
this.fips.restartRemote().pipe(untilDestroyed(this)).subscribe(); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...odules/layout/topbar/failover-upgrade-indicator/failover-upgrade-indicator.component.html
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
...les/layout/topbar/failover-upgrade-indicator/failover-upgrade-indicator.component.spec.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.