-
Notifications
You must be signed in to change notification settings - Fork 309
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
NAS-131326 / 25.04 / Simplify HA upgrade logic + NAS-131325: system.reboot.info
and failover.reboot.info
methods and events
#10744
Merged
Merged
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a31ad6e
NAS-131326: Simplify HA upgrade logic
544ef1c
NAS-131326: Add Reboot Info store
a7cf359
NAS-131326: Add Reboot Info dialog
cb566cb
NAS-131326: Add unit tests
cb9f196
Merge branch 'origin/master' into 131326/NAS-131326
424ddbe
NAS-131326: Add unit tests
3918657
NAS-131326: Fix remarks
80a2d08
NAS-131326: Remove unnecessary filters
14193eb
NAS-131326: Rename `RebootDialog` to `RebootRequiredDialog`
dbca167
NAS-131326: Add reboot reason
21ad32c
Merge branch 'origin/master' into 131326/NAS-131326
f92048d
Merge branch 'origin/master' into 131326/NAS-131326
261ae44
NAS-131326: Fix merge errors
1b0b76f
Merge branch 'origin/master' into 131326/NAS-131326
e68f634
NAS-131326: Add cancel button
a590d42
Merge branch 'origin/master' into 131326/NAS-131326
f914985
Merge branch 'origin/master' into 131326/NAS-131326
aa95da5
NAS-131326: Fix linter errors
68d3419
NAS-131326: Remove `HaFipsEffects`
dff1d06
NAS-131326: Fix remarks
ef34519
Merge branch 'origin/master' into 131326/NAS-131326
a84c004
Merge branch 'origin/master' into 131326/NAS-131326
185f0b0
Merge branch 'origin/master' into 131326/NAS-131326
7af5895
Merge branch 'origin/master' into 131326/NAS-131326
65644a4
Merge branch 'master' into NAS-131326
bvasilenko 506bccb
Merge branch 'master' into NAS-131326
bvasilenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
42 changes: 42 additions & 0 deletions
42
src/app/modules/dialog/components/reboot-dialog/reboot-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,42 @@ | ||
<div class="dialog-content" mat-dialog-content> | ||
<h3 mat-dialog-title class="dialog-title"> | ||
{{ 'Reboot Info' | translate }} | ||
</h3> | ||
|
||
<ng-container | ||
*appLet="thisNodeInfo$ | async as nodeInfo" | ||
[ngTemplateOutlet]="reasonsTemplate" | ||
[ngTemplateOutletContext]="{ | ||
$implicit: { | ||
reasons: nodeInfo?.reboot_required_reasons, | ||
message: 'The local node must be rebooted because' | translate, | ||
} | ||
}" | ||
></ng-container> | ||
|
||
<ng-container | ||
*appLet="otherNodeInfo$ | async as nodeInfo" | ||
[ngTemplateOutlet]="reasonsTemplate" | ||
[ngTemplateOutletContext]="{ | ||
$implicit: { | ||
reasons: nodeInfo?.reboot_required_reasons, | ||
message: 'The remote node must be rebooted because' | translate, | ||
} | ||
}" | ||
></ng-container> | ||
</div> | ||
|
||
<ng-template #reasonsTemplate let-props> | ||
@if (typeReasons(props.reasons); as reasons) { | ||
<div class="reasons"> | ||
<p class="dialog-message"> | ||
<span>{{ props.message }}:</span> | ||
</p> | ||
@for (reason of reasons; track reason) { | ||
<li> | ||
{{ reason.reason }} | ||
</li> | ||
} | ||
</div> | ||
} | ||
</ng-template> |
14 changes: 14 additions & 0 deletions
14
src/app/modules/dialog/components/reboot-dialog/reboot-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-content { | ||
padding-bottom: 5px; | ||
} | ||
|
||
.dialog-message, | ||
.dialog-title { | ||
margin-bottom: 5px; | ||
margin-top: 0; | ||
padding: 0; | ||
} | ||
|
||
.reasons { | ||
padding: 0 12px 12px; | ||
} |
60 changes: 60 additions & 0 deletions
60
src/app/modules/dialog/components/reboot-dialog/reboot-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 { RebootDialogComponent } from 'app/modules/dialog/components/reboot-dialog/reboot-dialog.component'; | ||
import { | ||
selectOtherNodeInfo, | ||
selectThisNodeInfo, | ||
} from 'app/store/reboot-info/reboot-info.selectors'; | ||
|
||
const fakeThisNodeInfo: SystemRebootInfo = { | ||
boot_id: 'this-boot-id', | ||
reboot_required_reasons: [ | ||
{ code: 'FIPS', reason: 'Test Reason 1' }, | ||
{ code: 'FIPS', reason: 'Test Reason 2' }, | ||
], | ||
}; | ||
|
||
const fakeOtherNodeInfo: SystemRebootInfo = { | ||
boot_id: 'other-boot-id', | ||
reboot_required_reasons: [ | ||
{ code: 'FIPS', reason: 'Test Reason 3' }, | ||
{ code: 'FIPS', reason: 'Test Reason 4' }, | ||
], | ||
}; | ||
|
||
describe('RebootDialogComponent', () => { | ||
let spectator: Spectator<RebootDialogComponent>; | ||
const createComponent = createComponentFactory({ | ||
component: RebootDialogComponent, | ||
providers: [ | ||
provideMockStore({ | ||
selectors: [ | ||
{ | ||
selector: selectThisNodeInfo, | ||
value: fakeThisNodeInfo, | ||
}, | ||
{ | ||
selector: selectOtherNodeInfo, | ||
value: fakeOtherNodeInfo, | ||
}, | ||
], | ||
}), | ||
], | ||
}); | ||
|
||
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', | ||
]); | ||
}); | ||
}); |
39 changes: 39 additions & 0 deletions
39
src/app/modules/dialog/components/reboot-dialog/reboot-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,39 @@ | ||
import { CdkScrollable } from '@angular/cdk/scrolling'; | ||
import { AsyncPipe, NgTemplateOutlet } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { MatDialogContent, MatDialogTitle } from '@angular/material/dialog'; | ||
import { UntilDestroy } from '@ngneat/until-destroy'; | ||
import { Store } from '@ngrx/store'; | ||
import { TranslateModule } from '@ngx-translate/core'; | ||
import { LetDirective } from 'app/directives/app-let.directive'; | ||
import { RebootRequiredReasons } from 'app/interfaces/reboot-info.interface'; | ||
import { AppsState } from 'app/store'; | ||
import { selectOtherNodeInfo, selectThisNodeInfo } from 'app/store/reboot-info/reboot-info.selectors'; | ||
|
||
@UntilDestroy() | ||
@Component({ | ||
selector: 'ix-reboot-dialog', | ||
templateUrl: './reboot-dialog.component.html', | ||
styleUrls: ['./reboot-dialog.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
CdkScrollable, | ||
MatDialogContent, | ||
MatDialogTitle, | ||
TranslateModule, | ||
AsyncPipe, | ||
LetDirective, | ||
NgTemplateOutlet, | ||
], | ||
}) | ||
export class RebootDialogComponent { | ||
thisNodeInfo$ = this.store$.select(selectThisNodeInfo); | ||
otherNodeInfo$ = this.store$.select(selectOtherNodeInfo); | ||
|
||
constructor(private store$: Store<AppsState>) {} | ||
|
||
typeReasons(reasons: unknown): RebootRequiredReasons[] { | ||
return reasons as RebootRequiredReasons[]; | ||
} | ||
} |
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.
41 changes: 0 additions & 41 deletions
41
.../modules/layout/topbar/failover-upgrade-indicator/failover-upgrade-indicator.component.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make
hasRebootRequiredReasons
a signal.