-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ceph#56349 from rhcs-dashboard/add-landing-page-up…
…grade-notification mgr/dashboard: add upgrade notification Reviewed-by: Ankush Behl <[email protected]> Reviewed-by: Nizamudeen A <[email protected]>
- Loading branch information
Showing
11 changed files
with
175 additions
and
30 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
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
26 changes: 26 additions & 0 deletions
26
...ind/mgr/dashboard/frontend/src/app/shared/components/upgradable/upgradable.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,26 @@ | ||
<div *ngIf="upgradeStatus$ | async as status; else isUpgradable"> | ||
<ng-container *ngIf="status.is_paused || status.in_progress; else isUpgradable"> | ||
<h5 *ngIf="status.is_paused; else inProgress" | ||
i18n> | ||
Upgrade is paused | ||
</h5> | ||
<ng-template #inProgress> | ||
<a href="#/upgrade/progress" | ||
i18n> | ||
<i [ngClass]="[icons.spin, icons.spinner]"></i> | ||
Upgrading {{executingTask?.progress}}% | ||
</a> | ||
</ng-template> | ||
</ng-container> | ||
</div> | ||
|
||
<ng-template #isUpgradable> | ||
<div *ngIf="upgradeInfo$ | async as info" | ||
i18n> | ||
<h5 *ngIf="info.versions.length > 0" | ||
(click)="upgradeModal()"> | ||
<i [ngClass]="icons.up"></i> | ||
Upgrade available | ||
</h5> | ||
</div> | ||
</ng-template> |
Empty file.
24 changes: 24 additions & 0 deletions
24
.../mgr/dashboard/frontend/src/app/shared/components/upgradable/upgradable.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,24 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { UpgradableComponent } from './upgradable.component'; | ||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
|
||
describe('UpgradableComponent', () => { | ||
let component: UpgradableComponent; | ||
let fixture: ComponentFixture<UpgradableComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [UpgradableComponent], | ||
imports: [HttpClientTestingModule] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(UpgradableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
...ybind/mgr/dashboard/frontend/src/app/shared/components/upgradable/upgradable.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,57 @@ | ||
import { Component } from '@angular/core'; | ||
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap'; | ||
import { Observable, Subscription } from 'rxjs'; | ||
import { UpgradeService } from '../../api/upgrade.service'; | ||
import { UpgradeInfoInterface, UpgradeStatusInterface } from '../../models/upgrade.interface'; | ||
import { OrchestratorService } from '../../api/orchestrator.service'; | ||
import { Icons } from '~/app/shared/enum/icons.enum'; | ||
import { SummaryService } from '../../services/summary.service'; | ||
import { ExecutingTask } from '../../models/executing-task'; | ||
|
||
@Component({ | ||
selector: 'cd-upgradable', | ||
templateUrl: './upgradable.component.html', | ||
styleUrls: ['./upgradable.component.scss'] | ||
}) | ||
export class UpgradableComponent { | ||
orchAvailable: boolean = false; | ||
upgradeInfo$: Observable<UpgradeInfoInterface>; | ||
upgradeStatus$: Observable<UpgradeStatusInterface>; | ||
upgradeModalRef: NgbModalRef; | ||
executingTask: ExecutingTask; | ||
private subs = new Subscription(); | ||
|
||
icons = Icons; | ||
|
||
constructor( | ||
private orchestratorService: OrchestratorService, | ||
private summaryService: SummaryService, | ||
private upgradeService: UpgradeService | ||
) {} | ||
|
||
ngOnInit() { | ||
this.orchestratorService.status().subscribe((status: any) => { | ||
this.orchAvailable = status.available; | ||
if (this.orchAvailable && status.upgrade_status?.available) { | ||
this.upgradeInfo$ = this.upgradeService.listCached(); | ||
this.upgradeStatus$ = this.upgradeService.status(); | ||
} | ||
}); | ||
|
||
this.subs.add( | ||
this.summaryService.subscribe((summary) => { | ||
this.executingTask = summary.executing_tasks.filter((tasks) => | ||
tasks.name.includes('progress/Upgrade') | ||
)[0]; | ||
}) | ||
); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subs?.unsubscribe(); | ||
} | ||
|
||
upgradeModal() { | ||
this.upgradeModalRef = this.upgradeService.startUpgradeModal(); | ||
} | ||
} |