From c11d1915a28a449711e7c33f34cc7e58df9faeb5 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Thu, 28 Sep 2023 12:00:04 +0300 Subject: [PATCH 1/5] impersonate fix --- apps/red-ui/src/app/guards/if-logged-in.guard.ts | 4 +++- apps/red-ui/src/app/services/router-history.service.ts | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/guards/if-logged-in.guard.ts b/apps/red-ui/src/app/guards/if-logged-in.guard.ts index 39a127622..86651e9fe 100644 --- a/apps/red-ui/src/app/guards/if-logged-in.guard.ts +++ b/apps/red-ui/src/app/guards/if-logged-in.guard.ts @@ -10,6 +10,7 @@ import jwt_decode from 'jwt-decode'; export interface JwtToken { auth_time: number; + iat: number; } export function ifLoggedIn(): AsyncGuard { @@ -42,7 +43,8 @@ export function ifLoggedIn(): AsyncGuard { await licenseService.loadLicenses(); const token = await keycloakService.getToken(); - const authTime = (jwt_decode(token) as JwtToken).auth_time.toString(); + const jwtToken = jwt_decode(token) as JwtToken; + const authTime = (jwtToken.auth_time || jwtToken.iat).toString(); localStorage.setItem('authTime', authTime); } diff --git a/apps/red-ui/src/app/services/router-history.service.ts b/apps/red-ui/src/app/services/router-history.service.ts index 23c4007db..938ff679b 100644 --- a/apps/red-ui/src/app/services/router-history.service.ts +++ b/apps/red-ui/src/app/services/router-history.service.ts @@ -33,7 +33,8 @@ export class RouterHistoryService { } const token = await this._keycloakService.getToken(); - const authTime = (jwt_decode(token) as JwtToken).auth_time; + const jwtToken = jwt_decode(token) as JwtToken; + const authTime = (jwtToken.auth_time || jwtToken.iat).toString(); const localStorageAuthTime = localStorage.getItem('authTime'); if (authTime.toString() !== localStorageAuthTime) { From 0be4819e78863e2faa8333dac06f244716df49b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Thu, 28 Sep 2023 15:56:00 +0300 Subject: [PATCH 2/5] RED-7641: Fixed weird scrollbars in license screen --- .../components/chart/chart.component.html | 4 +- .../components/chart/chart.component.scss | 4 - .../components/chart/chart.component.ts | 1 + ...nse-analysis-capacity-usage.component.scss | 1 - .../license-page-usage.component.scss | 1 - .../license-retention-capacity.component.scss | 1 - .../license-screen.component.html | 134 +++++++++--------- .../license-screen.component.scss | 5 - 8 files changed, 67 insertions(+), 84 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.html b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.html index 0e417290e..780899496 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.html @@ -1,3 +1 @@ -
- -
+ diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.scss b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.scss index d98283f70..e69de29bb 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.scss @@ -1,4 +0,0 @@ -.canvas-container { - position: relative; - width: 1000px; -} diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts index 397692423..933a526b8 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts @@ -32,6 +32,7 @@ export class ChartComponent implements OnChanges { #setChartOptions(): void { this.chartOptions = { + responsive: false, scales: { y: { stacked: true, diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-analysis-capacity-usage/license-analysis-capacity-usage.component.scss b/apps/red-ui/src/app/modules/admin/screens/license/components/license-analysis-capacity-usage/license-analysis-capacity-usage.component.scss index 8af8aac74..e91dc2856 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-analysis-capacity-usage/license-analysis-capacity-usage.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-analysis-capacity-usage/license-analysis-capacity-usage.component.scss @@ -3,7 +3,6 @@ } .grid-container { - width: calc(100% - 40px); display: grid; grid-template-columns: 250px 300px 1fr; margin: 20px; diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-page-usage/license-page-usage.component.scss b/apps/red-ui/src/app/modules/admin/screens/license/components/license-page-usage/license-page-usage.component.scss index 8af8aac74..e91dc2856 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-page-usage/license-page-usage.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-page-usage/license-page-usage.component.scss @@ -3,7 +3,6 @@ } .grid-container { - width: calc(100% - 40px); display: grid; grid-template-columns: 250px 300px 1fr; margin: 20px; diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-retention-capacity-usage/license-retention-capacity.component.scss b/apps/red-ui/src/app/modules/admin/screens/license/components/license-retention-capacity-usage/license-retention-capacity.component.scss index 2f537cca5..3863510aa 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-retention-capacity-usage/license-retention-capacity.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-retention-capacity-usage/license-retention-capacity.component.scss @@ -3,7 +3,6 @@ } .grid-container { - width: calc(100% - 40px); display: grid; grid-template-columns: 250px 300px 1fr; margin: 20px; diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.html index 399ab7748..cba01b93f 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.html @@ -1,81 +1,77 @@ -
-
- + -
-
-
-
-
-
{{ configService.values.BACKEND_APP_VERSION || '-' }}
-
+
+
+
+
+
+
{{ configService.values.BACKEND_APP_VERSION || '-' }}
+
-
-
-
{{ configService.values.APP_NAME || '-' }}
-
+
+
+
{{ configService.values.APP_NAME || '-' }}
+
-
-
-
- {{ 'license-info-screen.copyright-claim-text' | translate: { currentYear: currentYear } }} -
-
+
+
+
+ {{ 'license-info-screen.copyright-claim-text' | translate: { currentYear: currentYear } }} +
+
-
-
-
-
+
+
+
+
-
+
-
-
-
- -
-
+
+
+
+ +
+
- -
-
-
{{ selectedLicense.licensedTo || '-' }}
-
- -
-
-
- {{ (selectedLicense.validFrom | date: 'dd-MM-yyyy') || '-' }} / - {{ (selectedLicense.validUntil | date: 'dd-MM-yyyy') || '-' }} -
-
-
- -
-
{{ 'license-info-screen.licensing-details.licensed-page-count' | translate }}
-
{{ licenseService.totalLicensedNumberOfPages }}
-
- -
-
{{ 'license-info-screen.licensing-details.licensed-analysis-capacity' | translate }}
-
{{ licenseService.analysisCapacityBytes | size }}
-
- -
-
{{ 'license-info-screen.licensing-details.licensed-retention-capacity' | translate }}
-
{{ licenseService.retentionCapacityBytes | size }}
-
+ +
+
+
{{ selectedLicense.licensedTo || '-' }}
- - - +
+
+
+ {{ (selectedLicense.validFrom | date: 'dd-MM-yyyy') || '-' }} / + {{ (selectedLicense.validUntil | date: 'dd-MM-yyyy') || '-' }} +
+
+
+ +
+
{{ 'license-info-screen.licensing-details.licensed-page-count' | translate }}
+
{{ licenseService.totalLicensedNumberOfPages }}
+
+ +
+
{{ 'license-info-screen.licensing-details.licensed-analysis-capacity' | translate }}
+
{{ licenseService.analysisCapacityBytes | size }}
+
+ +
+
{{ 'license-info-screen.licensing-details.licensed-retention-capacity' | translate }}
+
{{ licenseService.retentionCapacityBytes | size }}
+ + + +
-
+ diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.scss b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.scss index fe4109839..e4d10b52a 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.scss @@ -4,12 +4,7 @@ overflow: auto; @include common-mixins.scroll-bar; - display: flex; - flex-direction: column; - align-items: center; - .grid-container { - width: calc(100% - 40px); display: grid; grid-template-columns: 250px 300px 1fr; margin: 20px; From 127ce7578900b0c62c13c30e2b98de729d8b97f9 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 28 Sep 2023 17:36:29 +0300 Subject: [PATCH 3/5] RED-7605: Fixed search again + esc only on document focused. --- .../file-preview-screen.component.ts | 2 -- .../pdf-viewer/services/pdf-viewer.service.ts | 23 ++++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts index 53a69f27b..ad962f246 100644 --- a/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/file-preview-screen.component.ts @@ -397,8 +397,6 @@ export class FilePreviewScreenComponent $event.preventDefault(); this.fullScreen = false; this.closeFullScreen(); - this.pdf.deactivateSearch(); - this.pdf.focusViewer(); this._changeRef.markForCheck(); } diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts index 731980fb4..2890bbf32 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/pdf-viewer.service.ts @@ -108,14 +108,9 @@ export class PdfViewer { } deactivateSearch() { - this.#clearSearchResultsWhenVisibilityChanged(); this.#instance.UI.closeElements(['searchPanel']); } - focusViewer() { - this.instance.UI.iframeWindow.focus(); - } - resetAnnotationActions() { if (this.#instance.UI.annotationPopup.getItems().length) { this.#logger.info('[PDF] Reset annotation actions'); @@ -167,8 +162,9 @@ export class PdfViewer { this.#setSelectionMode(); this.#configureElements(); this.#disableHotkeys(); - this.#clearSearchResultsWhenVisibilityChanged(); this.#listenForCommandF(); + this.#listenForEsc(); + this.#clearSearchResultsWhenVisibilityChanged(); }); return this.#instance; @@ -267,6 +263,16 @@ export class PdfViewer { }); } + #listenForEsc() { + this.#instance.UI.hotkeys.on('esc', e => { + e.preventDefault(); + if (this.#isElementActive('searchPanel')) { + this.deactivateSearch(); + this.#focusViewer(); + } + }); + } + #adjustPage(page: number) { if (this.isCompareMode()) { if (page % 2 === 1) { @@ -351,4 +357,9 @@ export class PdfViewer { input.select(); } } + + #focusViewer() { + this.instance.UI.iframeWindow.document.getElementById('SearchPanel__input').blur(); + this.instance.UI.iframeWindow.focus(); + } } From 73699a4eea637b5711f4cca9c8a16b28beb4e81a Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Fri, 29 Sep 2023 14:41:12 +0300 Subject: [PATCH 4/5] RED-7649: Added toaster error messages and length limits to fields. --- ...clone-dossier-template-dialog.component.ts | 14 ++++++------- ...d-edit-justification-dialog.component.html | 2 +- ...add-edit-justification-dialog.component.ts | 20 ++++++++++++------- .../edit-redaction-dialog.component.ts | 6 +++--- .../services/annotation-actions.service.ts | 11 +++++++--- libs/common-ui | 2 +- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts index afb0def58..1ea204a86 100644 --- a/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/dialogs/add-edit-dossier-template-dialog/add-edit-clone-dossier-template-dialog.component.ts @@ -93,11 +93,11 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon } this._dialogRef.close(true); } catch (error) { - const message = - error.status === HttpStatusCode.Conflict - ? _('add-edit-clone-dossier-template.error.conflict') - : _('add-edit-clone-dossier-template.error.generic'); - this._toaster.error(message, { error }); + if (error.status === HttpStatusCode.Conflict) { + this._toaster.error(_('add-edit-clone-dossier-template.error.conflict'), { error }); + } else { + this._toaster.rawError(error.error.message); + } } this._loadingService.stop(); } @@ -114,8 +114,8 @@ export class AddEditCloneDossierTemplateDialogComponent extends BaseDialogCompon #getForm() { return this._formBuilder.group({ - name: [this.#getCloneName(), Validators.required], - description: [this.dossierTemplate?.description], + name: [this.#getCloneName(), [Validators.required, Validators.maxLength(255)]], + description: [this.dossierTemplate?.description, Validators.maxLength(4000)], validFrom: [ this.dossierTemplate?.validFrom ? dayjs(this.dossierTemplate?.validFrom).toDate() : null, this.#requiredIfValidator(() => this.hasValidFrom), diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.html b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.html index 922e222e0..7e58ccc7e 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.html @@ -1,7 +1,7 @@
diff --git a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts index eacc00d60..fa7e5483c 100644 --- a/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/justifications/add-edit-justification-dialog/add-edit-justification-dialog.component.ts @@ -29,19 +29,25 @@ export class AddEditJustificationDialogComponent extends BaseDialogComponent { async save() { const dossierTemplateId = this.data.dossierTemplateId; - this._loadingService.start(); - await firstValueFrom(this._justificationService.createOrUpdate(this.form.getRawValue() as Justification, dossierTemplateId)); - await firstValueFrom(this._justificationService.loadAll(dossierTemplateId)); + try { + await firstValueFrom(this._justificationService.createOrUpdate(this.form.getRawValue() as Justification, dossierTemplateId)); + await firstValueFrom(this._justificationService.loadAll(dossierTemplateId)); + this._dialogRef.close(true); + } catch (error) { + this._toaster.rawError(error.error.message); + } this._loadingService.stop(); - this._dialogRef.close(true); } private _getForm(): UntypedFormGroup { return this._formBuilder.group({ - name: [{ value: this.data.justification?.name, disabled: !!this.data.justification }, Validators.required], - reason: [this.data.justification?.reason, Validators.required], - description: [this.data.justification?.description, Validators.required], + name: [ + { value: this.data.justification?.name, disabled: !!this.data.justification }, + [Validators.required, Validators.maxLength(255)], + ], + reason: [this.data.justification?.reason, [Validators.required, Validators.maxLength(4000)]], + description: [this.data.justification?.description, [Validators.required, Validators.maxLength(4000)]], }); } } diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts index 82c1608a5..030469dad 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/edit-redaction-dialog/edit-redaction-dialog.component.ts @@ -1,5 +1,5 @@ import { Component, inject, OnInit } from '@angular/core'; -import { FormBuilder, FormControl } from '@angular/forms'; +import { FormBuilder, FormControl, Validators } from '@angular/forms'; import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqser/common-ui'; import { Dictionary, SuperTypes } from '@red/domain'; import { ActiveDossiersService } from '@services/dossiers/active-dossiers.service'; @@ -58,7 +58,7 @@ export class EditRedactionDialogComponent } get disabled() { - return this.showExtras ? !this.form.controls.reason.value : false; + return this.form.invalid || (this.showExtras ? !this.form.controls.reason.value : false); } async ngOnInit() { @@ -126,7 +126,7 @@ export class EditRedactionDialogComponent const sameSection = this.data.annotations.every(annotation => annotation.section === this.data.annotations[0].section); return this._formBuilder.group({ reason: new FormControl(null), - comment: new FormControl(null), + comment: new FormControl(null, Validators.maxLength(4000)), type: new FormControl(sameType ? this.data.annotations[0].type : null), section: new FormControl(sameSection ? this.data.annotations[0].section : null), option: new FormControl(null), diff --git a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts index e7273ee3e..689a725bb 100644 --- a/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts +++ b/apps/red-ui/src/app/modules/file-preview/services/annotation-actions.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { IqserDialog } from '@common-ui/dialog/iqser-dialog.service'; -import { getConfig } from '@iqser/common-ui'; +import { getConfig, Toaster } from '@iqser/common-ui'; import { List, log } from '@iqser/common-ui/lib/utils'; import { AnnotationPermissions } from '@models/file/annotation.permissions'; import { AnnotationWrapper } from '@models/file/annotation.wrapper'; @@ -60,6 +60,7 @@ export class AnnotationActionsService { private readonly _skippedService: SkippedService, private readonly _dossierTemplatesService: DossierTemplatesService, private readonly _permissionsService: PermissionsService, + private readonly _toaster: Toaster, ) {} removeHighlights(highlights: AnnotationWrapper[]): void { @@ -126,8 +127,12 @@ export class AnnotationActionsService { } if (result.comment) { - for (const a of annotations) { - await this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId); + try { + for (const a of annotations) { + await this._manualRedactionService.addComment(result.comment, a.id, dossierId, fileId); + } + } catch (error) { + this._toaster.rawError(error.error.message); } } diff --git a/libs/common-ui b/libs/common-ui index 6dc910c4c..14f4f0089 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 6dc910c4ca6182fd4f1d6746b1114ad5210229a8 +Subproject commit 14f4f0089850700284ba7f44a5fe80639f3cd68f From 04a514463d034ce74ca36640d40df94098026b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Mon, 2 Oct 2023 15:33:15 +0300 Subject: [PATCH 5/5] RED-7681: Fixed checkbox & toggle styles, added a console log --- apps/red-ui/src/app/guards/dossier-template-exists.guard.ts | 2 +- libs/common-ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/red-ui/src/app/guards/dossier-template-exists.guard.ts b/apps/red-ui/src/app/guards/dossier-template-exists.guard.ts index 80c51b671..5fe3dd893 100644 --- a/apps/red-ui/src/app/guards/dossier-template-exists.guard.ts +++ b/apps/red-ui/src/app/guards/dossier-template-exists.guard.ts @@ -34,7 +34,7 @@ export function templateExistsWhenEnteringDossierList(): CanActivateFn { await firstValueFrom(dossierTemplatesService.loadAll()); const dossierTemplateStats = dashboardStatsService.find(dossierTemplateId); if (!dossierTemplateStats || dossierTemplateStats.isEmpty) { - logger.warn('[ROUTES] Dossier template not found, redirecting to main'); + logger.warn(`[ROUTES] Dossier template ${dossierTemplateId} not found, redirecting to main`); await router.navigate([tenantsService.activeTenantId, 'main']); return false; } diff --git a/libs/common-ui b/libs/common-ui index 14f4f0089..a9d6e5e72 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 14f4f0089850700284ba7f44a5fe80639f3cd68f +Subproject commit a9d6e5e7286b7655140a3ed19c9f0b9c5464b0ae