From b97a8dc1f9b287032adc15154be519e0c6e928f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 27 Sep 2023 15:06:32 +0300 Subject: [PATCH 1/2] RED-7641: Align axis grid lines --- .../license/components/chart/chart.component.ts | 10 ++++++++-- apps/red-ui/src/app/services/license.service.ts | 7 +------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts index d6669e947..397692423 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/components/chart/chart.component.ts @@ -35,7 +35,10 @@ export class ChartComponent implements OnChanges { scales: { y: { stacked: true, - ticks: { callback: this.valueFormatter ? (value: number) => this.valueFormatter(value) : undefined }, + ticks: { + callback: this.valueFormatter ? (value: number) => this.valueFormatter(value) : undefined, + count: 9, + }, title: { display: !!this.yAxisLabel, text: this.yAxisLabel, @@ -46,7 +49,10 @@ export class ChartComponent implements OnChanges { y1: { display: this.secondaryAxis, position: 'right', - ticks: { callback: this.valueFormatter ? (value: number) => this.valueFormatter(value) : undefined }, + ticks: { + callback: this.valueFormatter ? (value: number) => this.valueFormatter(value) : undefined, + count: 9, + }, title: { display: !!this.yAxisLabelRight, text: this.yAxisLabelRight, diff --git a/apps/red-ui/src/app/services/license.service.ts b/apps/red-ui/src/app/services/license.service.ts index 4f439f32e..270f5724f 100644 --- a/apps/red-ui/src/app/services/license.service.ts +++ b/apps/red-ui/src/app/services/license.service.ts @@ -86,7 +86,7 @@ export class LicenseService extends GenericService { get analysisCapacityBytes(): number { const capacityFeature = this.getFeature(LicenseFeatures.ANALYSIS_CAPACITY_BYTES); - return Number(capacityFeature?.value ?? '-1'); + return (Number(capacityFeature?.value ?? '-1') / 10) * 10; } get retentionCapacityBytes(): number { @@ -122,11 +122,6 @@ export class LicenseService extends GenericService { 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); } From 485ce08d99943ec083cfe6f36784403b32fbb5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Wed, 27 Sep 2023 17:01:02 +0300 Subject: [PATCH 2/2] RED-7641: Fixed current month not being displayed --- .../app/modules/admin/screens/license/utils/functions.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts b/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts index 1711451bc..107bcbf6b 100644 --- a/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts +++ b/apps/red-ui/src/app/modules/admin/screens/license/utils/functions.ts @@ -1,7 +1,7 @@ import dayjs, { Dayjs } from 'dayjs'; import { FillTarget } from 'chart.js'; import { hexToRgba } from '@utils/functions'; -import { ILicenseData, ILicenseReport } from '@red/domain'; +import { ILicenseReport } from '@red/domain'; import { ComplexFillTarget } from 'chart.js/dist/types'; const monthNames = dayjs.monthsShort(); @@ -31,11 +31,9 @@ export const getLineConfig: ( pointStyle: false, }); -export const getLabelsFromMonthlyData = (monthlyData: ILicenseData[]) => monthlyData.map(data => verboseDate(dayjs(data.startDate))); - export const getLabelsFromLicense = (license: ILicenseReport) => { - let startMonth = dayjs(license.startDate); - const endMonth = dayjs(license.endDate); + let startMonth = dayjs(license.startDate).startOf('month'); + const endMonth = dayjs(license.endDate).endOf('month'); const result = [];