+
{{ 'license-info-screen.capacity.storage-capacity' | translate }}
diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-storage/license-capacity.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/components/license-storage/license-capacity.component.ts
index a1943b15f..dffab4001 100644
--- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-storage/license-capacity.component.ts
+++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-storage/license-capacity.component.ts
@@ -18,7 +18,7 @@ export class LicenseCapacityComponent {
readonly formatSize = size;
donutChartConfig: DonutChartConfig[] = [];
readonly data$ = this.licenseService.selectedLicense$.pipe(
- map(() => this.licenseService.currentLicenseReport),
+ map(() => this.licenseService.selectedLicenseReport),
tap(license => {
this.donutChartConfig = this.#getDonutChartConfig(license);
}),
diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.html b/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.html
index ae0f382ee..fe2fcc7cc 100644
--- a/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.html
+++ b/apps/red-ui/src/app/modules/admin/screens/license/components/license-usage/license-usage.component.html
@@ -4,9 +4,9 @@
- {{ licenseService.currentLicenseReport.analysedFilesBytes | size }}
- = 0">
- ({{ licenseService.analyzedFilesBytesForCurrentLicensePercentage | number : '1.0-2' }}%)
+ {{ licenseService.selectedLicenseReport.analysedFilesBytes | size }}
+ = 0">
+ ({{ licenseService.analyzedFilesBytesForSelectedLicensePercentage | number : '1.0-2' }}%)
@@ -21,16 +21,16 @@
- {{ licenseService.currentLicenseReport.numberOfAnalyzedPages }}
- = 0">
- ({{ licenseService.analyzedPagesPercentageForCurrentLicensePercentage | number : '1.0-2' }}%)
+ {{ licenseService.selectedLicenseReport.numberOfAnalyzedPages }}
+ = 0">
+ ({{ licenseService.analyzedPagesPercentageForSelectedLicensePercentage | number : '1.0-2' }}%)
-
{{ licenseService.currentLicenseReport.numberOfOcrPages }}
+
{{ licenseService.selectedLicenseReport.numberOfOcrPages }}
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 f676005c9..d1e04cc57 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,11 +1,11 @@
-import { Component } from '@angular/core';
+import { Component, OnDestroy } from '@angular/core';
import { LicenseService } from '@services/license.service';
import { map } from 'rxjs/operators';
import { ChartDataset } from 'chart.js';
-import { ChartBlue, ChartGreen, ChartRed } from '../../utils/constants';
+import { ChartBlue, ChartGreen, ChartRed, LicenseFeatures } from '../../utils/constants';
import { getLabelsFromLicense, getLineConfig } from '../../utils/functions';
import { TranslateService } from '@ngx-translate/core';
-import { BehaviorSubject, combineLatest } from 'rxjs';
+import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { size } from '@iqser/common-ui/lib/utils';
@@ -19,13 +19,25 @@ enum ViewMode {
templateUrl: './license-usage.component.html',
styleUrls: ['./license-usage.component.scss'],
})
-export class LicenseUsageComponent {
+export class LicenseUsageComponent implements OnDestroy {
readonly viewModes = ViewMode;
- activeViewMode$ = new BehaviorSubject(ViewMode.VOLUME);
-
+ readonly activeViewMode$ = new BehaviorSubject(
+ this.licenseService.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY) ? ViewMode.VOLUME : ViewMode.PAGES,
+ );
readonly data$ = combineLatest([this.licenseService.selectedLicense$, this.activeViewMode$]).pipe(map(() => this.#getData()));
+ private _subscription: Subscription;
- constructor(readonly licenseService: LicenseService, private readonly _translateService: TranslateService) {}
+ constructor(readonly licenseService: LicenseService, private readonly _translateService: TranslateService) {
+ this._subscription = this.licenseService.selectedLicense$
+ .pipe(map(() => this.licenseService.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY) !== undefined))
+ .subscribe(hasCapacity => {
+ this.switchView(hasCapacity ? ViewMode.VOLUME : ViewMode.PAGES);
+ });
+ }
+
+ ngOnDestroy() {
+ this._subscription.unsubscribe();
+ }
switchView(mode: ViewMode): void {
this.activeViewMode$.next(mode);
@@ -44,7 +56,7 @@ export class LicenseUsageComponent {
return {
datasets: isVolume ? this.#getVolumeDatasets() : this.#getPagesDatasets(),
- labels: getLabelsFromLicense(this.licenseService.currentLicenseReport),
+ labels: getLabelsFromLicense(this.licenseService.selectedLicenseReport),
yAxisLabel: this._translateService.instant(yAxisLabel),
yAxisLabelRight: this._translateService.instant(yAxisLabelRight),
valueFormatter: isVolume ? value => size(value) : undefined,
@@ -52,7 +64,7 @@ export class LicenseUsageComponent {
}
#getPagesDatasets(): ChartDataset[] {
- const monthlyData = this.licenseService.currentLicenseReport.monthlyData;
+ const monthlyData = this.licenseService.selectedLicenseReport.monthlyData;
return [
{
@@ -85,7 +97,7 @@ export class LicenseUsageComponent {
}
#getVolumeDatasets(): ChartDataset[] {
- const monthlyData = this.licenseService.currentLicenseReport.monthlyData;
+ const monthlyData = this.licenseService.selectedLicenseReport.monthlyData;
const datasets: ChartDataset[] = [
{
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 4c210d01e..4585f72c6 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
@@ -68,7 +68,7 @@
-
+