From 3f55a466f2449427ea0155bc6193090502553ecd Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 10 Jul 2023 12:57:50 +0300 Subject: [PATCH 1/2] RED-6713: always show switch accounts --- .../components/user-menu/user-menu.component.html | 2 +- .../license-usage/license-usage.component.ts | 3 +-- apps/red-ui/src/app/services/license.service.ts | 14 ++++++++++++-- apps/red-ui/src/assets/i18n/redact/de.json | 1 + apps/red-ui/src/assets/i18n/redact/en.json | 1 + apps/red-ui/src/assets/i18n/scm/de.json | 1 + apps/red-ui/src/assets/i18n/scm/en.json | 1 + libs/common-ui | 2 +- 8 files changed, 19 insertions(+), 6 deletions(-) diff --git a/apps/red-ui/src/app/components/user-menu/user-menu.component.html b/apps/red-ui/src/app/components/user-menu/user-menu.component.html index 5cc6b5e25..de842e814 100644 --- a/apps/red-ui/src/app/components/user-menu/user-menu.component.html +++ b/apps/red-ui/src/app/components/user-menu/user-menu.component.html @@ -5,7 +5,7 @@ - + {{ 'top-bar.navigation-items.my-account.children.select-tenant' | translate }} diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.ts index 0e423a730..8e10ee3c8 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.ts @@ -1,5 +1,4 @@ import { Component } from '@angular/core'; -import { TranslateService } from '@ngx-translate/core'; import { LicenseService } from '@services/license.service'; import { map } from 'rxjs/operators'; import type { ILicenseReport } from '@red/domain'; @@ -22,7 +21,7 @@ export class LicenseUsageComponent { })), ); - constructor(readonly licenseService: LicenseService, private readonly _translateService: TranslateService) {} + constructor(readonly licenseService: LicenseService) {} getAnalysisPercentageOfLicense() { const totalLicensedNumberOfPages = this.licenseService.totalLicensedNumberOfPages; diff --git a/apps/red-ui/src/app/services/license.service.ts b/apps/red-ui/src/app/services/license.service.ts index 8ababb1a5..d2cabf2b8 100644 --- a/apps/red-ui/src/app/services/license.service.ts +++ b/apps/red-ui/src/app/services/license.service.ts @@ -1,10 +1,11 @@ import { inject, Injectable } from '@angular/core'; -import { GenericService } from '@iqser/common-ui'; +import { GenericService, Toaster } from '@iqser/common-ui'; import { ILicense, ILicenseReport, ILicenseReportRequest, ILicenses } from '@red/domain'; import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs'; import { catchError, filter, tap } from 'rxjs/operators'; import dayjs from 'dayjs'; import { NGXLogger } from 'ngx-logger'; +import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; const defaultOnError: ILicenses = { activeLicense: 'err', @@ -42,6 +43,7 @@ export class LicenseService extends GenericService { readonly #licenseData$ = new BehaviorSubject(undefined); readonly #selectedLicense$ = new BehaviorSubject(undefined); readonly #logger = inject(NGXLogger); + readonly #toaster = inject(Toaster); protected readonly _defaultModelPath = 'report'; readonly licenseData$: Observable; readonly selectedLicense$: Observable; @@ -60,6 +62,10 @@ export class LicenseService extends GenericService { filter(licenses => !!licenses), tap(data => (this.activeLicenseId = data.activeLicense)), tap(() => { + const activeLicense = this.activeLicense; + if (!activeLicense) { + return; + } const uploadedBytesCapacity = this.activeLicense.features.find(f => f.name === 'uploadedBytesCapacity')?.value; this.uploadedBytesCapacity = uploadedBytesCapacity ? parseInt(uploadedBytesCapacity, 10) : 0; }), @@ -82,7 +88,6 @@ export class LicenseService extends GenericService { get activeLicenseKey(): string { const activeLicense = this.activeLicense; if (!activeLicense) { - this.#logger.error('[LICENSE] No active license found!'); return ''; } @@ -136,6 +141,11 @@ export class LicenseService extends GenericService { const licenses = await firstValueFrom(licenses$); this.#licenseData$.next(licenses); this.setDefaultSelectedLicense(); + const activeLicense = this.activeLicense; + if (!activeLicense) { + this.#logger.error('[LICENSE] No active license found!'); + this.#toaster.warning(_('no-active-license')); + } } setSelectedLicense($event: ILicense) { diff --git a/apps/red-ui/src/assets/i18n/redact/de.json b/apps/red-ui/src/assets/i18n/redact/de.json index aa85fbac9..23394a312 100644 --- a/apps/red-ui/src/assets/i18n/redact/de.json +++ b/apps/red-ui/src/assets/i18n/redact/de.json @@ -1717,6 +1717,7 @@ } }, "minutes": "", + "no-active-license": "", "notification": { "assign-approver": "Sie wurden dem Dokument {fileHref, select, null{{fileName}} other{{fileName}}} im Dossier {dossierHref, select, null{{dossierName}} other{{dossierName}}} als Genehmiger zugewiesen!", "assign-reviewer": "Sie wurden dem Dokument {fileHref, select, null{{fileName}} other{{fileName}}} im Dossier {dossierHref, select, null{{dossierName}} other{{dossierName}}} als Reviewer zugewiesen!", diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 0c5c768e4..f814951c8 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1717,6 +1717,7 @@ } }, "minutes": "minutes", + "no-active-license": "Invalid or corrupt license – Please contact your administrator", "notification": { "assign-approver": "You have been assigned as approver for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", "assign-reviewer": "You have been assigned as reviewer for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", diff --git a/apps/red-ui/src/assets/i18n/scm/de.json b/apps/red-ui/src/assets/i18n/scm/de.json index 94cbae7e1..a0cc3ecee 100644 --- a/apps/red-ui/src/assets/i18n/scm/de.json +++ b/apps/red-ui/src/assets/i18n/scm/de.json @@ -1717,6 +1717,7 @@ } }, "minutes": "", + "no-active-license": "", "notification": { "assign-approver": "Sie wurden dem Dokument {fileHref, select, null{{fileName}} other{{fileName}}} im Dossier {dossierHref, select, null{{dossierName}} other{{dossierName}}} als Genehmiger zugewiesen!", "assign-reviewer": "Sie wurden dem Dokument {fileHref, select, null{{fileName}} other{{fileName}}} im Dossier {dossierHref, select, null{{dossierName}} other{{dossierName}}} als Reviewer zugewiesen!", diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index aa7231b6b..0751acb8f 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1717,6 +1717,7 @@ } }, "minutes": "minutes", + "no-active-license": "Invalid or corrupt license – Please contact your administrator", "notification": { "assign-approver": "You have been assigned as approver for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", "assign-reviewer": "You have been assigned as reviewer for {fileHref, select, null{{fileName}} other{{fileName}}} in dossier: {dossierHref, select, null{{dossierName}} other{{dossierName}}}!", diff --git a/libs/common-ui b/libs/common-ui index a4e425d37..eb58e96d0 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit a4e425d3739d6145325a8fe347d9fcae1e12a662 +Subproject commit eb58e96d01290051858613dcfaed0288adaa3d53 From dd6d41a96718fa515d894e45d66bd44b37b87e0a Mon Sep 17 00:00:00 2001 From: Valentin Mihai Date: Mon, 10 Jul 2023 15:22:10 +0300 Subject: [PATCH 2/2] RED-7041 - Take into consideration if entity type only has dossier dictionaries --- .../redact-text-dialog/redact-text-dialog.component.html | 1 + .../redact-text-dialog/redact-text-dialog.component.ts | 8 ++++++++ libs/common-ui | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html index fec0d8467..a64d7c690 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.html @@ -52,6 +52,7 @@ *ngFor="let dictionary of dictionaries" [matTooltip]="dictionary.description" [value]="dictionary.type" + (click)="typeChanged()" matTooltipPosition="after" > {{ dictionary.label }} diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts index 080bd28bd..4755d984e 100644 --- a/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/dialogs/redact-text-dialog/redact-text-dialog.component.ts @@ -141,6 +141,14 @@ export class RedactTextDialogComponent } } + typeChanged() { + if (!this.#applyToAllDossiers) { + const selectedDictionaryType = this.form.get('dictionary').value; + const selectedDictionary = this.dictionaries.find(d => d.type === selectedDictionaryType); + this.options[1].extraOption.disabled = selectedDictionary.dossierDictionaryOnly; + } + } + save(): void { this.#enhanceManualRedaction(this.data.manualRedactionEntryWrapper.manualRedactionEntry); const redaction = this.data.manualRedactionEntryWrapper.manualRedactionEntry; diff --git a/libs/common-ui b/libs/common-ui index eb58e96d0..a8f5fb2e2 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit eb58e96d01290051858613dcfaed0288adaa3d53 +Subproject commit a8f5fb2e25cd1f150c1099d387b4f9dece3b922c