Skip to content

Commit

Permalink
Fixing schema failures from null
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-buttner committed Mar 9, 2023
1 parent 73c89da commit a6bbf17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 90 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/server/telemetry/queries/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export const getLatestCasesDates = async ({
]);

return {
createdAt: savedObjects?.[0]?.saved_objects?.[0]?.attributes?.created_at ?? null,
updatedAt: savedObjects?.[1]?.saved_objects?.[0]?.attributes?.updated_at ?? null,
closedAt: savedObjects?.[2]?.saved_objects?.[0]?.attributes?.closed_at ?? null,
createdAt: savedObjects?.[0]?.saved_objects?.[0]?.attributes?.created_at ?? '',
updatedAt: savedObjects?.[1]?.saved_objects?.[0]?.attributes?.updated_at ?? '',
closedAt: savedObjects?.[2]?.saved_objects?.[0]?.attributes?.closed_at ?? '',
};
};

Expand Down
84 changes: 0 additions & 84 deletions x-pack/plugins/cases/server/telemetry/queries/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import type {
CaseAggregationResult,
Buckets,
CasesTelemetry,
MaxBucketOnCaseAggregation,
SolutionTelemetry,
AttachmentFramework,
Expand Down Expand Up @@ -320,89 +319,6 @@ export const getOnlyConnectorsFilter = () =>
type: CASE_USER_ACTION_SAVED_OBJECT,
});

export const getTelemetryDataEmptyState = (): CasesTelemetry => ({
cases: {
all: {
assignees: {
total: 0,
totalWithZero: 0,
totalWithAtLeastOne: 0,
},
total: 0,
monthly: 0,
weekly: 0,
daily: 0,
status: {
open: 0,
inProgress: 0,
closed: 0,
},
syncAlertsOn: 0,
syncAlertsOff: 0,
totalUsers: 0,
totalParticipants: 0,
totalTags: 0,
totalWithAlerts: 0,
totalWithConnectors: 0,
latestDates: {
createdAt: null,
updatedAt: null,
closedAt: null,
},
...emptyAttachmentFramework(),
},
sec: {
total: 0,
monthly: 0,
weekly: 0,
daily: 0,
assignees: { total: 0, totalWithAtLeastOne: 0, totalWithZero: 0 },
...emptyAttachmentFramework(),
},
obs: {
total: 0,
monthly: 0,
weekly: 0,
daily: 0,
assignees: { total: 0, totalWithAtLeastOne: 0, totalWithZero: 0 },
...emptyAttachmentFramework(),
},
main: {
total: 0,
monthly: 0,
weekly: 0,
daily: 0,
assignees: { total: 0, totalWithAtLeastOne: 0, totalWithZero: 0 },
...emptyAttachmentFramework(),
},
},
userActions: { all: { total: 0, monthly: 0, weekly: 0, daily: 0, maxOnACase: 0 } },
comments: { all: { total: 0, monthly: 0, weekly: 0, daily: 0, maxOnACase: 0 } },
alerts: { all: { total: 0, monthly: 0, weekly: 0, daily: 0, maxOnACase: 0 } },
connectors: {
all: {
all: { totalAttached: 0 },
itsm: { totalAttached: 0 },
sir: { totalAttached: 0 },
jira: { totalAttached: 0 },
resilient: { totalAttached: 0 },
swimlane: { totalAttached: 0 },
maxAttachedToACase: 0,
},
},
pushes: {
all: { total: 0, maxOnACase: 0 },
},
configuration: {
all: {
closure: {
manually: 0,
automatic: 0,
},
},
},
});

const emptyAttachmentFramework = (): AttachmentFramework => ({
attachmentFramework: {
persistableAttachments: [],
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/server/telemetry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ export interface Status {
}

export interface LatestDates {
createdAt: string | null;
updatedAt: string | null;
closedAt: string | null;
createdAt: string;
updatedAt: string;
closedAt: string;
}

export interface CasesTelemetry {
Expand Down

0 comments on commit a6bbf17

Please sign in to comment.