From d72cf7be9a91f0f29f7654fac48499d4a78761f5 Mon Sep 17 00:00:00 2001 From: Timo Date: Mon, 22 Feb 2021 11:54:03 +0200 Subject: [PATCH] more license fixes --- .../license-information-screen.component.ts | 4 ++-- .../file/pdf-viewer/pdf-viewer.component.ts | 5 ++++- apps/red-ui/src/app/state/app-state.service.ts | 4 ++-- apps/red-ui/src/main.ts | 14 ++++++++++++-- docker/red-ui/docker-entrypoint.sh | 8 ++++---- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/screens/admin/license-information-screen/license-information-screen.component.ts b/apps/red-ui/src/app/screens/admin/license-information-screen/license-information-screen.component.ts index 14addefb5..686f0ae67 100644 --- a/apps/red-ui/src/app/screens/admin/license-information-screen/license-information-screen.component.ts +++ b/apps/red-ui/src/app/screens/admin/license-information-screen/license-information-screen.component.ts @@ -23,8 +23,8 @@ export class LicenseInformationScreenComponent { public readonly appConfigService: AppConfigService ) { this.totalLicensedNumberOfPages = this.appConfigService.getConfig('LICENSE_PAGE_COUNT', 0); - const startDate = moment(this.appConfigService.getConfig('LICENSING_START'), 'DD-MM-YYYY'); - const endDate = moment(this.appConfigService.getConfig('LICENSING_END'), 'DD-MM-YYYY'); + const startDate = moment(this.appConfigService.getConfig('LICENSE_START'), 'DD-MM-YYYY'); + const endDate = moment(this.appConfigService.getConfig('LICENSE_END'), 'DD-MM-YYYY'); const currentConfig = { startDate: startDate.toDate(), endDate: endDate.toDate() diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 700f0a799..c61dee94d 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -14,7 +14,7 @@ import { } from '@angular/core'; import { AppConfigService } from '../../../app-config/app-config.service'; import { ManualRedactionEntry, Rectangle } from '@redaction/red-ui-http'; -import WebViewer, { Annotations, WebViewerInstance } from '@pdftron/webviewer'; +import WebViewer, { Annotations, Tools, WebViewerInstance } from '@pdftron/webviewer'; import { TranslateService } from '@ngx-translate/core'; import { ManualRedactionEntryWrapper } from '../model/manual-redaction-entry.wrapper'; import { AppStateService } from '../../../state/app-state.service'; @@ -27,6 +27,7 @@ import { AnnotationDrawService } from '../service/annotation-draw.service'; import { AnnotationActionsService } from '../../../common/service/annotation-actions.service'; import { UserPreferenceService } from '../../../common/service/user-preference.service'; import { translateQuads } from '../../../utils/pdf-coordinates'; +import Tool = Tools.Tool; @Component({ selector: 'redaction-pdf-viewer', @@ -56,6 +57,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { instance: WebViewerInstance; private readonly _allowedKeyboardShortcuts = ['+', '-', 'p', 'r', 'Escape']; + private _defaultTool: Tool; constructor( private readonly kc: KeycloakService, @@ -403,6 +405,7 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { private _documentLoaded() { this._ngZone.run(() => { + this._defaultTool = this.instance.getToolMode(); this.viewerReady.emit(this.instance); this.setInitialViewerState(); }); diff --git a/apps/red-ui/src/app/state/app-state.service.ts b/apps/red-ui/src/app/state/app-state.service.ts index a6a416ce0..2970dd970 100644 --- a/apps/red-ui/src/app/state/app-state.service.ts +++ b/apps/red-ui/src/app/state/app-state.service.ts @@ -286,8 +286,8 @@ export class AppStateService { // this._automaticallyReanalyseErrorFiles(project); this._computeStats(); - fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file)); - fileStatusChangedEvent.forEach((file) => this.fileChanged.emit(file)); + // fileReanalysedEvent.forEach((file) => this.fileReanalysed.emit(file)); + // fileStatusChangedEvent.forEach((file) => this.fileChanged.emit(file)); return files; } diff --git a/apps/red-ui/src/main.ts b/apps/red-ui/src/main.ts index 207c6dde9..692f5d296 100644 --- a/apps/red-ui/src/main.ts +++ b/apps/red-ui/src/main.ts @@ -1,13 +1,23 @@ -import { enableProdMode } from '@angular/core'; +import { ApplicationRef, enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; +import { enableDebugTools } from '@angular/platform-browser'; if (environment.production) { enableProdMode(); } +platformBrowserDynamic(); platformBrowserDynamic() .bootstrapModule(AppModule) - .catch((err) => console.error(err)); + .then((moduleRef) => { + if (!environment.production) { + const applicationRef = moduleRef.injector.get(ApplicationRef); + const componentRef = applicationRef.components[0]; + // allows to run `ng.profiler.timeChangeDetection();` + enableDebugTools(componentRef); + } + }) + .catch((err) => window['console'].error(err)); diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index 8ac70257f..c64966fdb 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -9,8 +9,8 @@ ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}" AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}" MAX_FILE_SIZE_MB="${MAX_FILE_SIZE_MB:-50}" -LICENSING_START="${LICENSING_START:-01-01-2021}" -LICENSING_END="${LICENSING_END:-31-12-2021}" +LICENSE_START="${LICENSE_START:-01-01-2021}" +LICENSE_END="${LICENSE_END:-31-12-2021}" LICENSE_PAGE_COUNT="${LICENSE_PAGE_COUNT:-1000000}" LICENSE_CUSTOMER="${LICENSE_CUSTOMER:-Developement License}" @@ -20,8 +20,8 @@ echo '{ "OAUTH_URL":"'"$OAUTH_URL"'", "ADMIN_CONTACT_NAME":"'"$ADMIN_CONTACT_NAME"'", "ADMIN_CONTACT_URL":"'"$ADMIN_CONTACT_URL"'", - "LICENSING_START":"'"$LICENSING_START"'", - "LICENSING_END":"'"$LICENSING_END"'", + "LICENSE_START":"'"$LICENSE_START"'", + "LICENSE_END":"'"$LICENSE_END"'", "LICENSE_PAGE_COUNT":'"$LICENSE_PAGE_COUNT"', "LICENSE_CUSTOMER":"'"$LICENSE_CUSTOMER"'", "APP_NAME":"'"$APP_NAME"'",