mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-11-20 12:36:53 +00:00
App frame handle the until too
This commit is contained in:
3 files changed
+43
-6
No files matched your search
@@ -415,15 +415,14 @@
|
||||
</ng-template>
|
||||
@if (settingsService.updateCheckingIsSet) {
|
||||
@if (appRemoteVersion().update_available) {
|
||||
<a class="small text-decoration-none" target="_blank" rel="noopener noreferrer"
|
||||
href="https://github.com/paperless-ngx/paperless-ngx/releases"
|
||||
<button type="button" class="bg-transparent border-0 p-0 small text-primary" (click)="showAvailableReleaseNotes()"
|
||||
[ngbPopover]="updateAvailablePopContent" popoverClass="shadow" triggers="mouseenter:mouseleave"
|
||||
container="body">
|
||||
<pngx-bs-icon width="1.2em" height="1.2em" name="info-circle" class="me-1"></pngx-bs-icon>
|
||||
@if (appRemoteVersion()?.update_available) {
|
||||
<ng-container i18n>Update available</ng-container>
|
||||
}
|
||||
</a>
|
||||
</button>
|
||||
}
|
||||
} @else {
|
||||
<a *pngxIfPermissions="{ action: PermissionAction.Change, type: PermissionType.UISettings }" class="small text-decoration-none" routerLink="/settings" fragment="update-checking" aria-label="Configure update checking" i18n-aria-label
|
||||
|
||||
@@ -741,6 +741,29 @@ describe('AppFrameComponent', () => {
|
||||
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')
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user