Merge branch 'RED-7641' into 'master'

Resolve RED-7641

Closes RED-7641

See merge request redactmanager/red-ui!115
This commit is contained in:
Dan Percic 2023-09-27 16:16:16 +02:00
commit 63164da2b8
3 changed files with 12 additions and 13 deletions

View File

@ -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,

View File

@ -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 = [];

View File

@ -86,7 +86,7 @@ export class LicenseService extends GenericService<ILicenseReport> {
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<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);
}