diff --git a/package-lock.json b/package-lock.json index 8e49fae2..1cde2cde 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2804,6 +2804,15 @@ "webpack-sources": "2.2.0" } }, + "@ngx-loading-bar/core": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@ngx-loading-bar/core/-/core-5.1.1.tgz", + "integrity": "sha512-ODXZ+Op1NtRiEKqh1CU2nwmb5GgI7iGMuT2uji8e6dgfKIEgIl5/BhYyKszlTmttID/tU25FdKFnv0RtAL4KUA==", + "dev": true, + "requires": { + "tslib": ">=1.7.1" + } + }, "@ngx-translate/i18n-polyfill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@ngx-translate/i18n-polyfill/-/i18n-polyfill-1.0.0.tgz", @@ -14520,12 +14529,6 @@ "integrity": "sha1-Pz5hPgE3sGSbcFxngHS0vQgUnMw=", "dev": true }, - "ng2-slim-loading-bar": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ng2-slim-loading-bar/-/ng2-slim-loading-bar-4.0.0.tgz", - "integrity": "sha1-clb93nwFjxSVWj7y5lr6+1tmRgM=", - "dev": true - }, "ngx-bootstrap": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/ngx-bootstrap/-/ngx-bootstrap-5.2.0.tgz", diff --git a/package.json b/package.json index f8abde62..bc179ce3 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@angular/platform-browser": "11.2.9", "@angular/platform-browser-dynamic": "11.2.9", "@angular/router": "11.2.9", + "@ngx-loading-bar/core": "^5.1.1", "@ngx-translate/i18n-polyfill": "1.0.0", "@types/bcrypt": "3.0.1", "@types/bcryptjs": "2.4.2", @@ -119,7 +120,6 @@ "mocha": "8.3.2", "natural-orderby": "2.0.3", "ng2-cookies": "1.0.12", - "ng2-slim-loading-bar": "4.0.0", "ngx-bootstrap": "5.2.0", "ngx-clipboard": "14.0.1", "ngx-toastr": "13.2.1", diff --git a/src/backend/model/jobs/jobs/FileJob.ts b/src/backend/model/jobs/jobs/FileJob.ts index f96902e6..45b47f9c 100644 --- a/src/backend/model/jobs/jobs/FileJob.ts +++ b/src/backend/model/jobs/jobs/FileJob.ts @@ -55,9 +55,9 @@ export abstract class FileJob; + protected abstract shouldProcess(filePath: string): Promise; - protected abstract async processFile(filePath: string): Promise; + protected abstract processFile(filePath: string): Promise; protected async step(): Promise { if (this.directoryQueue.length === 0 && this.fileQueue.length === 0) { diff --git a/src/backend/model/jobs/jobs/Job.ts b/src/backend/model/jobs/jobs/Job.ts index 0ad52a36..da0bae05 100644 --- a/src/backend/model/jobs/jobs/Job.ts +++ b/src/backend/model/jobs/jobs/Job.ts @@ -77,9 +77,9 @@ export abstract class Job implements IJob { }; } - protected abstract async step(): Promise; + protected abstract step(): Promise; - protected abstract async init(): Promise; + protected abstract init(): Promise; private onFinish(): void { if (this.InProgress === false) { diff --git a/src/backend/model/threading/MetadataLoader.ts b/src/backend/model/threading/MetadataLoader.ts index a4e320ee..1c595aea 100644 --- a/src/backend/model/threading/MetadataLoader.ts +++ b/src/backend/model/threading/MetadataLoader.ts @@ -50,8 +50,8 @@ export class MetadataLoader { metadata.size.width = data.streams[i].width; metadata.size.height = data.streams[i].height; - if (Utils.isInt32(parseInt(data.streams[i].rotation, 10)) && - (Math.abs(parseInt(data.streams[i].rotation, 10)) / 90) % 2 === 1) { + if (Utils.isInt32(parseInt('' + data.streams[i].rotation, 10)) && + (Math.abs(parseInt('' + data.streams[i].rotation, 10)) / 90) % 2 === 1) { // noinspection JSSuspiciousNameCombination metadata.size.width = data.streams[i].height; // noinspection JSSuspiciousNameCombination diff --git a/src/frontend/app/app.module.ts b/src/frontend/app/app.module.ts index e80b7adb..6796cc49 100644 --- a/src/frontend/app/app.module.ts +++ b/src/frontend/app/app.module.ts @@ -12,6 +12,7 @@ import {AuthenticationService} from './model/network/authentication.service'; import {UserMangerSettingsComponent} from './ui/settings/usermanager/usermanager.settings.component'; import {FrameComponent} from './ui/frame/frame.component'; import {YagaModule} from '@yaga/leaflet-ng2'; +import { LoadingBarModule } from '@ngx-loading-bar/core'; import {GalleryLightboxMediaComponent} from './ui/gallery/lightbox/media/media.lightbox.gallery.component'; import {GalleryPhotoLoadingComponent} from './ui/gallery/grid/photo/loading/loading.photo.grid.gallery.component'; import {GalleryNavigatorComponent} from './ui/gallery/navigator/navigator.gallery.component'; @@ -29,7 +30,6 @@ import {GalleryMapComponent} from './ui/gallery/map/map.gallery.component'; import {GalleryMapLightboxComponent} from './ui/gallery/map/lightbox/lightbox.map.gallery.component'; import {ThumbnailManagerService} from './ui/gallery/thumbnailManager.service'; import {OverlayService} from './ui/gallery/overlay.service'; -import {SlimLoadingBarModule} from 'ng2-slim-loading-bar'; import {GalleryShareComponent} from './ui/gallery/share/share.gallery.component'; import {ShareLoginComponent} from './ui/sharelogin/share-login.component'; import {ShareService} from './ui/gallery/share.service'; @@ -154,10 +154,10 @@ export function translationsFactory(locale: string) { CollapseModule.forRoot(), PopoverModule.forRoot(), BsDropdownModule.forRoot(), - SlimLoadingBarModule.forRoot(), BsDatepickerModule.forRoot(), YagaModule, - TimepickerModule.forRoot() + TimepickerModule.forRoot(), + LoadingBarModule ], declarations: [AppComponent, LoginComponent, diff --git a/src/frontend/app/model/network/network.service.spec.ts b/src/frontend/app/model/network/network.service.spec.ts index 0b713297..45ffed0b 100644 --- a/src/frontend/app/model/network/network.service.spec.ts +++ b/src/frontend/app/model/network/network.service.spec.ts @@ -2,7 +2,7 @@ import {getTestBed, inject, TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; import {NetworkService} from './network.service'; import {Message} from '../../../../common/entities/Message'; -import {SlimLoadingBarService} from 'ng2-slim-loading-bar'; +import {LoadingBarService} from '@ngx-loading-bar/core'; import {VersionService} from '../version.service'; @@ -20,7 +20,7 @@ describe('NetworkService Success tests', () => { imports: [HttpClientTestingModule], providers: [ VersionService, - SlimLoadingBarService, + LoadingBarService, NetworkService ] }); @@ -133,7 +133,7 @@ describe('NetworkService Fail tests', () => { imports: [HttpClientTestingModule], providers: [ VersionService, - SlimLoadingBarService, + LoadingBarService, NetworkService ] }); diff --git a/src/frontend/app/model/network/network.service.ts b/src/frontend/app/model/network/network.service.ts index 5c70e8f0..3bad5cba 100644 --- a/src/frontend/app/model/network/network.service.ts +++ b/src/frontend/app/model/network/network.service.ts @@ -1,7 +1,7 @@ import {Injectable} from '@angular/core'; import {HttpClient, HttpResponse} from '@angular/common/http'; import {Message} from '../../../../common/entities/Message'; -import {SlimLoadingBarService} from 'ng2-slim-loading-bar'; +import {LoadingBarService} from '@ngx-loading-bar/core'; import {ErrorCodes, ErrorDTO} from '../../../../common/entities/Error'; import {Config} from '../../../../common/config/public/Config'; import {Utils} from '../../../../common/Utils'; @@ -15,7 +15,7 @@ export class NetworkService { private globalErrorHandlers: Array<(error: ErrorDTO) => boolean> = []; constructor(private _http: HttpClient, - private slimLoadingBarService: SlimLoadingBarService, + private loadingBarService: LoadingBarService, private versionService: VersionService) { } @@ -37,19 +37,17 @@ export class NetworkService { public getXML(url: string): Promise { - this.slimLoadingBarService.visible = true; - this.slimLoadingBarService.start(() => { - this.slimLoadingBarService.visible = false; - }); + + this.loadingBarService.useRef().start(); const process = (res: string): Document => { - this.slimLoadingBarService.complete(); + this.loadingBarService.useRef().complete(); const parser = new DOMParser(); return parser.parseFromString(res, 'text/xml'); }; const err = (error: any) => { - this.slimLoadingBarService.complete(); + this.loadingBarService.useRef().complete(); return this.handleError(error); }; @@ -82,13 +80,10 @@ export class NetworkService { private callJson(method: 'get' | 'post' | 'delete' | 'put', url: string, data: any = {}): Promise { const body = data; - this.slimLoadingBarService.visible = true; - this.slimLoadingBarService.start(() => { - this.slimLoadingBarService.visible = false; - }); + this.loadingBarService.useRef().start(); const process = (res: HttpResponse>): T => { - this.slimLoadingBarService.complete(); + this.loadingBarService.useRef().complete(); const msg = res.body; if (res.headers.has(CustomHeaders.dataVersion)) { this.versionService.onNewVersion(res.headers.get(CustomHeaders.dataVersion)); @@ -103,7 +98,7 @@ export class NetworkService { }; const err = (error: any) => { - this.slimLoadingBarService.complete(); + this.loadingBarService.useRef().complete(); return this.handleError(error); }; diff --git a/src/frontend/app/model/network/user.service.spec.ts b/src/frontend/app/model/network/user.service.spec.ts index b1f0fea0..392d76f1 100644 --- a/src/frontend/app/model/network/user.service.spec.ts +++ b/src/frontend/app/model/network/user.service.spec.ts @@ -3,7 +3,7 @@ import {HttpClientTestingModule} from '@angular/common/http/testing'; import {NetworkService} from './network.service'; import {UserService} from './user.service'; import {LoginCredential} from '../../../../common/entities/LoginCredential'; -import {SlimLoadingBarService} from 'ng2-slim-loading-bar'; +import {LoadingBarService} from '@ngx-loading-bar/core'; import {ShareService} from '../../ui/gallery/share.service'; import {VersionService} from '../version.service'; @@ -26,7 +26,7 @@ describe('UserService', () => { providers: [ VersionService, UserService, - SlimLoadingBarService, + LoadingBarService, NetworkService, {provide: ShareService, useClass: MockShareService} ] diff --git a/src/frontend/app/ui/faces/faces.component.ts b/src/frontend/app/ui/faces/faces.component.ts index f7e86e3b..8ef96b6b 100644 --- a/src/frontend/app/ui/faces/faces.component.ts +++ b/src/frontend/app/ui/faces/faces.component.ts @@ -3,7 +3,7 @@ import {FacesService} from './faces.service'; import {QueryService} from '../../model/query.service'; import {map} from 'rxjs/operators'; import {PersonDTO} from '../../../../common/entities/PersonDTO'; -import {Observable} from 'rxjs/Observable'; +import {Observable} from 'rxjs'; @Component({ selector: 'app-faces', diff --git a/src/frontend/app/ui/frame/frame.component.html b/src/frontend/app/ui/frame/frame.component.html index c58fb515..6c14800d 100644 --- a/src/frontend/app/ui/frame/frame.component.html +++ b/src/frontend/app/ui/frame/frame.component.html @@ -1,4 +1,4 @@ - +