RED-7204: Allow for negative values for

This commit is contained in:
Adina Țeudan 2023-08-17 18:18:06 +03:00
parent e271f5b2c2
commit d3cdeedabc
4 changed files with 20 additions and 10 deletions

View File

@ -29,7 +29,7 @@ export class LicenseUsageComponent implements OnDestroy {
constructor(readonly licenseService: LicenseService, private readonly _translateService: TranslateService) {
this._subscription = this.licenseService.selectedLicense$
.pipe(map(() => this.licenseService.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY) !== undefined))
.pipe(map(() => this.licenseService.hasNumberFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY)))
.subscribe(hasCapacity => {
this.switchView(hasCapacity ? ViewMode.VOLUME : ViewMode.PAGES);
});

View File

@ -29,7 +29,7 @@ export class LicenseScreenComponent {
];
get showCapacity(): boolean {
return this.licenseService.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY) !== undefined;
return this.licenseService.hasNumberFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY);
}
constructor(

View File

@ -17,14 +17,19 @@ const defaultOnError: ILicenses = {
product: 'Error',
licensedTo: 'Error',
licensedToEmail: 'Error',
validFrom: '01-01-2022',
validUntil: '01-01-2023',
validFrom: '01-01-2023',
validUntil: '01-01-2024',
features: [
{
name: LicenseFeatures.PROCESSING_PAGES,
type: 'NUMBER',
value: '2000000',
},
{
name: LicenseFeatures.UPLOADED_BYTES_CAPACITY,
type: 'NUMBER',
value: '-1',
},
{
name: LicenseFeatures.PDFTRON,
type: 'STRING',
@ -70,12 +75,12 @@ export class LicenseService extends GenericService<ILicenseReport> {
return '';
}
return activeLicense.features.find(f => f.name === LicenseFeatures.PDFTRON).value;
return activeLicense.features.find(f => f.name === LicenseFeatures.PDFTRON).value as string;
}
get totalLicensedNumberOfPages(): number {
const processingPagesFeature = this.getFeature(LicenseFeatures.PROCESSING_PAGES);
return Number(processingPagesFeature?.value ?? '0');
return Math.max(Number(processingPagesFeature?.value ?? '0'), 0);
}
get analyzedPagesPercentageForSelectedLicensePercentage(): number {
@ -86,7 +91,7 @@ export class LicenseService extends GenericService<ILicenseReport> {
get uploadedBytesCapacity(): number {
const capacityFeature = this.getFeature(LicenseFeatures.UPLOADED_BYTES_CAPACITY);
return Number(capacityFeature?.value ?? '0');
return Math.max(Number(capacityFeature?.value ?? '0'), 0);
}
get analyzedFilesBytesForSelectedLicensePercentage(): number {
@ -107,6 +112,11 @@ export class LicenseService extends GenericService<ILicenseReport> {
this.licenseData$ = this.#licenseData$.pipe(filter(licenses => !!licenses));
}
hasNumberFeature(key: LicenseFeatures): boolean {
const feature = this.getFeature(key);
return !!feature && Number(feature.value) >= 0;
}
getFeature(name: string): ILicenseFeature | undefined {
return this.selectedLicense.features?.find(f => f.name === name);
}

View File

@ -1,9 +1,9 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://qa2.iqser.cloud",
"API_URL": "https://dev-08.iqser.cloud",
"APP_NAME": "RedactManager",
"IS_DOCUMINE": true,
"IS_DOCUMINE": false,
"RULE_EDITOR_DEV_ONLY": false,
"AUTO_READ_TIME": 3,
"BACKEND_APP_VERSION": "4.4.40",
@ -13,7 +13,7 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://qa2.iqser.cloud/auth",
"OAUTH_URL": "https://dev-08.iqser.cloud/auth",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",