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 9c242f49f..30d8341cc 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
@@ -75,23 +75,23 @@
-
{{ licenseService.totalInfo.numberOfAnalyzedPages }}
+
{{ licenseService.annualInfo.numberOfAnalyzedPages }}
- {{ licenseService.currentInfo.numberOfAnalyzedPages }}
+ {{ licenseService.analyzedPagesInCurrentLicensingPeriod }}
({{ analysisPercentageOfLicense$ | async | number : '1.0-2' }}%)
-
+
-
{{ licenseService.unlicensedInfo.numberOfAnalyzedPages }}
+
{{ licenseService.unlicensedPages }}
diff --git a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts
index 0b9cbcd6c..b38bf630e 100644
--- a/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/license/license-screen/license-screen.component.ts
@@ -50,7 +50,7 @@ export class LicenseScreenComponent {
getAnalysisPercentageOfLicense() {
const totalLicensedNumberOfPages = this.licenseService.totalLicensedNumberOfPages;
- const numberOfAnalyzedPages = this.licenseService.currentInfo.numberOfAnalyzedPages;
+ const numberOfAnalyzedPages = this.licenseService.analyzedPagesInCurrentLicensingPeriod;
return totalLicensedNumberOfPages > 0 ? (numberOfAnalyzedPages / totalLicensedNumberOfPages) * 100 : 100;
}
diff --git a/apps/red-ui/src/app/services/license.service.ts b/apps/red-ui/src/app/services/license.service.ts
index aa66c4dd9..05dfb64d9 100644
--- a/apps/red-ui/src/app/services/license.service.ts
+++ b/apps/red-ui/src/app/services/license.service.ts
@@ -51,20 +51,16 @@ export class LicenseService extends GenericService {
activeLicenseId: string;
totalLicensedNumberOfPages = 0;
currentInfo: ILicenseReport = {};
- totalInfo: ILicenseReport = {};
- unlicensedInfo: ILicenseReport = {};
+ annualInfo: ILicenseReport = {};
+ unlicensedPages = 0;
+ analyzedPagesInCurrentLicensingPeriod = 0;
protected readonly _defaultModelPath = 'report';
readonly #licenseData$ = new BehaviorSubject(undefined);
readonly #selectedLicense$ = new BehaviorSubject(undefined);
constructor(private readonly _logger: NGXLogger) {
super();
- this.selectedLicense$ = this.#selectedLicense$.pipe(
- filter(license => !!license),
- tap(license => {
- this.totalLicensedNumberOfPages = this.getTotalLicensedNumberOfPages(license);
- }),
- );
+ this.selectedLicense$ = this.#selectedLicense$.pipe(filter(license => !!license));
this.licenseData$ = this.#licenseData$.pipe(
filter(licenses => !!licenses),
tap(data => (this.activeLicenseId = data.activeLicense)),
@@ -95,6 +91,8 @@ export class LicenseService extends GenericService {
}
async loadLicenseData(license: ILicense = this.selectedLicense) {
+ this.totalLicensedNumberOfPages = this.getTotalLicensedNumberOfPages(license);
+
const startDate = dayjs(license.validFrom);
const endDate = dayjs(license.validUntil);
@@ -102,16 +100,23 @@ export class LicenseService extends GenericService {
startDate: startDate.toDate(),
endDate: endDate.toDate(),
};
- const reports: Promise[] = [this.getReport(currentConfig), this.getReport({})];
- if (endDate.isBefore(dayjs())) {
- const unlicensedConfig = {
- startDate: endDate.toDate(),
- };
- reports.push(this.getReport(unlicensedConfig));
+ const thisYearConfig = {
+ startDate: `${startDate.year()}-01-01T00:00:00.000Z`,
+ endDate: `${startDate.year()}-12-31T00:00:00.000Z`,
+ };
+ const configs = [currentConfig, thisYearConfig];
+ const reports = configs.map(config => this.getReport(config));
+
+ [this.currentInfo, this.annualInfo] = await Promise.all(reports);
+
+ if (this.currentInfo.numberOfAnalyzedPages > this.totalLicensedNumberOfPages) {
+ this.unlicensedPages = this.currentInfo.numberOfAnalyzedPages - this.totalLicensedNumberOfPages;
+ this.analyzedPagesInCurrentLicensingPeriod = this.totalLicensedNumberOfPages;
+ } else {
+ this.unlicensedPages = 0;
+ this.analyzedPagesInCurrentLicensingPeriod = this.currentInfo.numberOfAnalyzedPages;
}
-
- [this.currentInfo, this.totalInfo, this.unlicensedInfo] = await Promise.all(reports);
}
getTotalLicensedNumberOfPages(license: ILicense) {
diff --git a/apps/red-ui/src/app/services/notifications.service.ts b/apps/red-ui/src/app/services/notifications.service.ts
index 42cb282be..3a8297b12 100644
--- a/apps/red-ui/src/app/services/notifications.service.ts
+++ b/apps/red-ui/src/app/services/notifications.service.ts
@@ -13,6 +13,10 @@ import dayjs from 'dayjs';
const INCLUDE_SEEN = false;
+const AVAILABLE_NOTIFICATIONS_DAYS = 30;
+const AVAILABLE_OLD_NOTIFICATIONS_MINUTES = 60;
+const NOTIFICATIONS_THRESHOLD = 1000;
+
@Injectable({
providedIn: 'root',
})
@@ -81,14 +85,30 @@ export class NotificationsService extends EntitiesService {
diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh
index 3c861dd26..1f49ec007 100755
--- a/docker/red-ui/docker-entrypoint.sh
+++ b/docker/red-ui/docker-entrypoint.sh
@@ -18,6 +18,9 @@ RECENT_PERIOD_IN_HOURS="${RECENT_PERIOD_IN_HOURS:-24}"
SELECTION_MODE="${SELECTION_MODE:-structural}"
MANUAL_BASE_URL="${MANUAL_BASE_URL:-https://docs.redactmanager.com/preview}"
ANNOTATIONS_THRESHOLD="${ANNOTATIONS_THRESHOLD:-1000}"
+AVAILABLE_NOTIFICATIONS_DAYS="${AVAILABLE_NOTIFICATIONS_DAYS:-30}"
+AVAILABLE_OLD_NOTIFICATIONS_MINUTES="${AVAILABLE_OLD_NOTIFICATIONS_MINUTES:-60}"
+NOTIFICATIONS_THRESHOLD="${NOTIFICATIONS_THRESHOLD:-1000}"
BASE_TRANSLATIONS_DIRECTORY="${BASE_TRANSLATIONS_DIRECTORY:-/assets/i18n/redact/}"
THEME="${THEME:-theme-template}"
@@ -42,7 +45,10 @@ echo '{
"MANUAL_BASE_URL":"'"$MANUAL_BASE_URL"'",
"BASE_TRANSLATIONS_DIRECTORY":"'"$BASE_TRANSLATIONS_DIRECTORY"'",
"THEME":"'"$THEME"'",
- "ANNOTATIONS_THRESHOLD":"'"$ANNOTATIONS_THRESHOLD"'"
+ "ANNOTATIONS_THRESHOLD":"'"$ANNOTATIONS_THRESHOLD"'",
+ "AVAILABLE_NOTIFICATIONS_DAYS":"'"$AVAILABLE_NOTIFICATIONS_DAYS"'",
+ "AVAILABLE_OLD_NOTIFICATIONS_MINUTES":"'"$AVAILABLE_OLD_NOTIFICATIONS_MINUTES"'",
+ "NOTIFICATIONS_THRESHOLD":"'"$NOTIFICATIONS_THRESHOLD"'"
}' > /usr/share/nginx/html/ui/assets/config/config.json
echo 'Env variables: '
diff --git a/libs/red-domain/src/lib/reports/license-report.request.ts b/libs/red-domain/src/lib/reports/license-report.request.ts
index f12577f42..796fb114a 100644
--- a/libs/red-domain/src/lib/reports/license-report.request.ts
+++ b/libs/red-domain/src/lib/reports/license-report.request.ts
@@ -2,7 +2,7 @@ import { List } from '@iqser/common-ui';
export interface ILicenseReportRequest {
dossierIds?: List;
- endDate?: Date;
+ endDate?: Date | string;
requestId?: string;
- startDate?: Date;
+ startDate?: Date | string;
}
diff --git a/package.json b/package.json
index 61f5f467b..9b2d412fb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "redaction",
- "version": "3.977.0",
+ "version": "3.983.0",
"private": true,
"license": "MIT",
"scripts": {
diff --git a/paligo-theme.tar.gz b/paligo-theme.tar.gz
index 062df6f06..8120c5543 100644
Binary files a/paligo-theme.tar.gz and b/paligo-theme.tar.gz differ