From 98a5ab23a409e6e585dbda5947caf37758c13b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Tue, 5 Feb 2019 16:01:18 +0100 Subject: [PATCH] Adapt to saved object version type change --- x-pack/plugins/infra/common/graphql/types.ts | 73 ++++++++++++++++++- .../containers/with_source/with_source.tsx | 5 +- x-pack/plugins/infra/public/graphql/types.ts | 2 +- 3 files changed, 74 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/infra/common/graphql/types.ts b/x-pack/plugins/infra/common/graphql/types.ts index b833414d12001..c4b581c83cd0d 100644 --- a/x-pack/plugins/infra/common/graphql/types.ts +++ b/x-pack/plugins/infra/common/graphql/types.ts @@ -19,7 +19,7 @@ export interface InfraSource { /** The id of the source */ id: string; /** The version number the source configuration was last persisted with */ - version?: number | null; + version?: string | null; /** The timestamp the source configuration was last persisted at */ updatedAt?: number | null; /** The raw configuration of the source */ @@ -34,6 +34,8 @@ export interface InfraSource { logEntriesBetween: InfraLogEntryInterval; /** A consecutive span of summary buckets within an interval */ logSummaryBetween: InfraLogSummaryInterval; + + logItem: InfraLogItem; /** A hierarchy of hosts, pods, containers, services or arbitrary groups */ map?: InfraResponse | null; @@ -177,6 +179,22 @@ export interface InfraLogSummaryBucket { entriesCount: number; } +export interface InfraLogItem { + /** The ID of the document */ + id: string; + /** The index where the document was found */ + index: string; + /** An array of flattened fields and values */ + fields: InfraLogItemField[]; +} + +export interface InfraLogItemField { + /** The flattened field name */ + field: string; + /** The value for the Field as a string */ + value: string; +} + export interface InfraResponse { nodes: InfraNode[]; } @@ -197,6 +215,10 @@ export interface InfraNodeMetric { name: InfraMetricType; value: number; + + avg: number; + + max: number; } export interface InfraMetricData { @@ -395,6 +417,9 @@ export interface LogSummaryBetweenInfraSourceArgs { /** The query to filter the log entries by */ filterQuery?: string | null; } +export interface LogItemInfraSourceArgs { + id: string; +} export interface MapInfraSourceArgs { timerange: InfraTimerangeInput; @@ -456,6 +481,7 @@ export enum InfraPathType { hosts = 'hosts', pods = 'pods', containers = 'containers', + custom = 'custom', } export enum InfraMetricType { @@ -521,6 +547,45 @@ export type InfraLogMessageSegment = InfraLogMessageFieldSegment | InfraLogMessa // Documents // ==================================================== +export namespace FlyoutItemQuery { + export type Variables = { + sourceId: string; + itemId: string; + }; + + export type Query = { + __typename?: 'Query'; + + source: Source; + }; + + export type Source = { + __typename?: 'InfraSource'; + + id: string; + + logItem: LogItem; + }; + + export type LogItem = { + __typename?: 'InfraLogItem'; + + id: string; + + index: string; + + fields: Fields[]; + }; + + export type Fields = { + __typename?: 'InfraLogItemField'; + + field: string; + + value: string; + }; +} + export namespace MetadataQuery { export type Variables = { sourceId: string; @@ -658,6 +723,10 @@ export namespace WaffleNodesQuery { name: InfraMetricType; value: number; + + avg: number; + + max: number; }; } @@ -845,7 +914,7 @@ export namespace SourceFields { id: string; - version?: number | null; + version?: string | null; updatedAt?: number | null; diff --git a/x-pack/plugins/infra/public/containers/with_source/with_source.tsx b/x-pack/plugins/infra/public/containers/with_source/with_source.tsx index 31fae204da7e2..8254b5f784d4f 100644 --- a/x-pack/plugins/infra/public/containers/with_source/with_source.tsx +++ b/x-pack/plugins/infra/public/containers/with_source/with_source.tsx @@ -89,8 +89,7 @@ const createContainerProps = memoizeLast((sourceId: string, apolloClient: Apollo undefined, getDerivedIndexPattern: () => getDerivedIndexPattern, getVersion: () => state => (state && state.source && state.source.version) || undefined, - getExists: () => state => - (state && state.source && typeof state.source.version === 'number') || false, + getExists: () => state => (state && state.source && !!state.source.version) || false, }); const effects = inferEffectMap()({ @@ -219,7 +218,7 @@ interface WithSourceProps { metricIndicesExist?: boolean; sourceId: string; update: (changes: UpdateSourceInput[]) => Promise; - version?: number; + version?: string; }>; } diff --git a/x-pack/plugins/infra/public/graphql/types.ts b/x-pack/plugins/infra/public/graphql/types.ts index 4044c2ab82590..c4b581c83cd0d 100644 --- a/x-pack/plugins/infra/public/graphql/types.ts +++ b/x-pack/plugins/infra/public/graphql/types.ts @@ -914,7 +914,7 @@ export namespace SourceFields { id: string; - version?: number | null; + version?: string | null; updatedAt?: number | null;