diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html index 1383637889..6d7aa49802 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.html +++ b/src-ui/src/app/components/app-frame/app-frame.component.html @@ -415,15 +415,14 @@ @if (settingsService.updateCheckingIsSet) { @if (appRemoteVersion().update_available) { - @if (appRemoteVersion()?.update_available) { Update available } - + } } @else { { httpTestingController.expectNone(`${environment.apiBaseUrl}ui_settings/`) }) + it('should open available release notes from update available', () => { + jest + .spyOn(remoteVersionService, 'checkForUpdates') + .mockReturnValue(of({ version: '3.6.0', update_available: true })) + settingsService.set(SETTINGS_KEYS.VERSION, '3.5.1') + settingsService.set(SETTINGS_KEYS.UPDATE_CHECKING_ENABLED, true) + component.ngOnInit() + fixture.detectChanges() + const modalSpy = jest.spyOn(modalService, 'open') + const saveSpy = jest.spyOn(settingsService, 'markReleasesSeen') + + const updateButton = fixture.debugElement + .queryAll(By.css('button')) + .find((b) => b.nativeElement.textContent.includes('Update available')) + updateButton.nativeElement.click() + + const dialog = modalSpy.mock.results[0].value + .componentInstance as ReleaseNotesDialogComponent + expect(dialog.since()).toEqual('3.5.1') + expect(dialog.until()).toEqual('3.6.0') + expect(saveSpy).not.toHaveBeenCalled() + }) + it('should save update checking chosen in the release notes dialog', () => { const setUpdateCheckingSpy = jest .spyOn(component, 'setUpdateChecking') diff --git a/src-ui/src/app/components/app-frame/app-frame.component.ts b/src-ui/src/app/components/app-frame/app-frame.component.ts index 20f078c363..0c443cf805 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.ts +++ b/src-ui/src/app/components/app-frame/app-frame.component.ts @@ -552,16 +552,23 @@ export class AppFrameComponent }) } - showReleaseNotes() { - const since = this.settingsService.unseenReleasesSince() + private openReleaseNotes( + since: string | null, + until: string | null = null + ): void { const modal = this.modalService.open(ReleaseNotesDialogComponent, { size: 'lg', scrollable: true, }) - modal.componentInstance.load(since) + modal.componentInstance.load(since, until) modal.componentInstance.updateCheckingChosen.subscribe((enable: boolean) => this.setUpdateChecking(enable) ) + } + + showReleaseNotes() { + const since = this.settingsService.unseenReleasesSince() + this.openReleaseNotes(since) if (since) { this.settingsService .markReleasesSeen() @@ -570,6 +577,14 @@ export class AppFrameComponent } } + /** Notes for releases newer than the running version, not yet installed */ + showAvailableReleaseNotes() { + this.openReleaseNotes( + this.settingsService.get(SETTINGS_KEYS.VERSION), + this.appRemoteVersion()?.version + ) + } + setUpdateChecking(enable: boolean) { this.settingsService.set(SETTINGS_KEYS.UPDATE_CHECKING_ENABLED, enable) this.settingsService