From 1e2a3152d0f688283eda7c9eedc2c50320056273 Mon Sep 17 00:00:00 2001 From: Jonathan Buttner Date: Tue, 11 Apr 2023 12:14:46 -0400 Subject: [PATCH] Fixing average schema value issue --- .../cases/server/telemetry/queries/cases.test.ts | 8 ++++---- .../cases/server/telemetry/queries/utils.test.ts | 14 +++++++------- .../cases/server/telemetry/queries/utils.ts | 2 +- x-pack/plugins/cases/server/telemetry/types.ts | 4 +++- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/x-pack/plugins/cases/server/telemetry/queries/cases.test.ts b/x-pack/plugins/cases/server/telemetry/queries/cases.test.ts index d6198e5c37444..b97235ff82247 100644 --- a/x-pack/plugins/cases/server/telemetry/queries/cases.test.ts +++ b/x-pack/plugins/cases/server/telemetry/queries/cases.test.ts @@ -189,7 +189,7 @@ describe('getCasesTelemetryData', () => { const filesRes: FileAttachmentAggregationResults = { securitySolution: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -204,7 +204,7 @@ describe('getCasesTelemetryData', () => { }, }, observability: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -219,7 +219,7 @@ describe('getCasesTelemetryData', () => { }, }, cases: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -233,7 +233,7 @@ describe('getCasesTelemetryData', () => { ], }, }, - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { diff --git a/x-pack/plugins/cases/server/telemetry/queries/utils.test.ts b/x-pack/plugins/cases/server/telemetry/queries/utils.test.ts index 8116af2763e3e..359aa621798f0 100644 --- a/x-pack/plugins/cases/server/telemetry/queries/utils.test.ts +++ b/x-pack/plugins/cases/server/telemetry/queries/utils.test.ts @@ -170,7 +170,7 @@ describe('utils', () => { const filesRes: FileAttachmentAggregationResults = { securitySolution: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -185,7 +185,7 @@ describe('utils', () => { }, }, observability: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -200,7 +200,7 @@ describe('utils', () => { }, }, cases: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -214,7 +214,7 @@ describe('utils', () => { ], }, }, - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -592,7 +592,7 @@ describe('utils', () => { attachmentAggregations: attachmentFramework, totalCasesForOwner: 5, filesAggregations: { - averageSize: 0, + averageSize: { value: 0 }, topMimeTypes: { buckets: [], }, @@ -635,7 +635,7 @@ describe('utils', () => { getAttachmentsFrameworkStats({ attachmentAggregations: attachmentFramework, filesAggregations: { - averageSize: 500, + averageSize: { value: 500 }, topMimeTypes: { buckets: [ { @@ -685,7 +685,7 @@ describe('utils', () => { getAttachmentsFrameworkStats({ attachmentAggregations: attachmentFramework, filesAggregations: { - averageSize: 0, + averageSize: { value: 0 }, topMimeTypes: { buckets: [ { diff --git a/x-pack/plugins/cases/server/telemetry/queries/utils.ts b/x-pack/plugins/cases/server/telemetry/queries/utils.ts index f9eb531f3a207..7896c2bdac760 100644 --- a/x-pack/plugins/cases/server/telemetry/queries/utils.ts +++ b/x-pack/plugins/cases/server/telemetry/queries/utils.ts @@ -230,7 +230,7 @@ export const getAttachmentsFrameworkStats = ({ return emptyAttachmentFramework(); } - const averageFileSize = filesAggregations?.averageSize; + const averageFileSize = filesAggregations?.averageSize?.value; const topMimeTypes = filesAggregations?.topMimeTypes; return { diff --git a/x-pack/plugins/cases/server/telemetry/types.ts b/x-pack/plugins/cases/server/telemetry/types.ts index f1cf2e79499ab..b38d46d04283b 100644 --- a/x-pack/plugins/cases/server/telemetry/types.ts +++ b/x-pack/plugins/cases/server/telemetry/types.ts @@ -62,7 +62,9 @@ export interface AssigneesFilters { } export interface FileAttachmentAggsResult { - averageSize: number; + averageSize: { + value: number; + }; topMimeTypes: Buckets; }