From 5be8409711510cbacf48bb76fd01ab3398bfd7bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 26 Sep 2023 19:26:40 +0300 Subject: [PATCH] RED-7641: Fix (oops, uncommited changes) --- .../src/app/services/license.service.ts | 38 ++++++++++++------- apps/red-ui/src/assets/i18n/redact/en.json | 4 +- apps/red-ui/src/assets/i18n/scm/en.json | 4 +- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/apps/red-ui/src/app/services/license.service.ts b/apps/red-ui/src/app/services/license.service.ts index 8927ac5f8..4f439f32e 100644 --- a/apps/red-ui/src/app/services/license.service.ts +++ b/apps/red-ui/src/app/services/license.service.ts @@ -25,11 +25,6 @@ const defaultOnError: ILicenses = { type: 'NUMBER', value: '2000000', }, - { - name: LicenseFeatures.UPLOADED_BYTES_CAPACITY, - type: 'NUMBER', - value: '-1', - }, { name: LicenseFeatures.PDFTRON, type: 'STRING', @@ -80,32 +75,47 @@ export class LicenseService extends GenericService { get totalLicensedNumberOfPages(): number { const processingPagesFeature = this.getFeature(LicenseFeatures.PROCESSING_PAGES); - return Math.max(Number(processingPagesFeature?.value ?? '0'), 0); + return Number(processingPagesFeature?.value ?? '-1'); } get analyzedPagesPercentageForSelectedLicensePercentage(): number { - return this.totalLicensedNumberOfPages + return this.totalLicensedNumberOfPages > 0 ? (this.selectedLicenseReport.numberOfAnalyzedPages / this.totalLicensedNumberOfPages) * 100 : -1; } - get uploadedBytesCapacity(): number { - const capacityFeature = this.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY); - return Math.max(Number(capacityFeature?.value ?? '0'), 0); + get analysisCapacityBytes(): number { + const capacityFeature = this.getFeature(LicenseFeatures.ANALYSIS_CAPACITY_BYTES); + return Number(capacityFeature?.value ?? '-1'); } - get analyzedFilesBytesForSelectedLicensePercentage(): number { - return this.uploadedBytesCapacity ? (this.selectedLicenseReport.analysedFilesBytes / this.uploadedBytesCapacity) * 100 : -1; + get retentionCapacityBytes(): number { + const capacityFeature = this.getFeature(LicenseFeatures.RETENTION_CAPACITY_BYTES); + return Number(capacityFeature?.value ?? '-1'); } - get uploadedFilesBytesForSelectedLicensePercentage(): number { - return this.uploadedBytesCapacity ? (this.selectedLicenseReport.totalFilesUploadedBytes / this.uploadedBytesCapacity) * 100 : -1; + get analysisCapacityBytesForSelectedLicensePercentage(): number { + return this.analysisCapacityBytes > 0 ? (this.selectedLicenseReport.analysedFilesBytes / this.analysisCapacityBytes) * 100 : -1; + } + + get retentionCapacityBytesForSelectedLicensePercentage(): number { + return this.retentionCapacityBytes > 0 + ? (this.selectedLicenseReport.totalFilesUploadedBytes / this.retentionCapacityBytes) * 100 + : -1; } get unlicensedPages(): number { return Math.max(0, this.selectedLicenseReport.numberOfAnalyzedPages - this.totalLicensedNumberOfPages); } + get isPageBased(): boolean { + return this.totalLicensedNumberOfPages >= 0; + } + + get isCapacityBased(): boolean { + return this.analysisCapacityBytes >= 0 && this.retentionCapacityBytes >= 0; + } + constructor() { super(); this.selectedLicense$ = this.#selectedLicense$.pipe(filter(license => !!license)); diff --git a/apps/red-ui/src/assets/i18n/redact/en.json b/apps/red-ui/src/assets/i18n/redact/en.json index 57e8d0e54..2ddfdd12b 100644 --- a/apps/red-ui/src/assets/i18n/redact/en.json +++ b/apps/red-ui/src/assets/i18n/redact/en.json @@ -1787,8 +1787,8 @@ "ocr-analyzed-pages": "OCR Processed Pages in Licensing Period", "pages-per-month": "Pages per Month", "section-title": "Page Usage Details", - "total-analyzed": "Total Analyzed Pages Since {date}", - "total-ocr-analyzed": "Total OCR Processed Pages Since {date}", + "total-analyzed": "Total Analyzed Pages", + "total-ocr-analyzed": "Total OCR Processed Pages", "total-pages": "Total Pages", "unlicensed-analyzed": "Unlicensed Analyzed Pages" }, diff --git a/apps/red-ui/src/assets/i18n/scm/en.json b/apps/red-ui/src/assets/i18n/scm/en.json index 0da4f7705..3511678ef 100644 --- a/apps/red-ui/src/assets/i18n/scm/en.json +++ b/apps/red-ui/src/assets/i18n/scm/en.json @@ -1787,8 +1787,8 @@ "ocr-analyzed-pages": "OCR Processed Pages in Licensing Period", "pages-per-month": "Pages per Month", "section-title": "Page Usage Details", - "total-analyzed": "Total Analyzed Pages Since {date}", - "total-ocr-analyzed": "Total OCR Processed Pages Since {date}", + "total-analyzed": "Total Analyzed Pages", + "total-ocr-analyzed": "Total OCR Processed Pages", "total-pages": "Total Pages", "unlicensed-analyzed": "Unlicensed Analyzed Pages" },