From fd757fa6869fe0e07ffb12cba7d4a28f385986e5 Mon Sep 17 00:00:00 2001 From: Xavier Mouligneau <189600+XavierM@users.noreply.github.com> Date: Tue, 4 Jun 2019 08:19:44 -0400 Subject: [PATCH] Fix bug when you delete column (#37946) --- .../siem/common/graphql/shared/schema.gql.ts | 2 +- .../body/column_headers/actions/index.tsx | 7 +++- .../siem/public/graphql/introspection.json | 6 +-- x-pack/plugins/siem/public/graphql/types.ts | 38 +++++++++---------- x-pack/plugins/siem/server/graphql/types.ts | 14 +++---- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/x-pack/plugins/siem/common/graphql/shared/schema.gql.ts b/x-pack/plugins/siem/common/graphql/shared/schema.gql.ts index 192b82551e7c0..e8847ac14bbfe 100644 --- a/x-pack/plugins/siem/common/graphql/shared/schema.gql.ts +++ b/x-pack/plugins/siem/common/graphql/shared/schema.gql.ts @@ -17,7 +17,7 @@ export const sharedSchema = gql` } type CursorType { - value: String! + value: String tiebreaker: String } diff --git a/x-pack/plugins/siem/public/components/timeline/body/column_headers/actions/index.tsx b/x-pack/plugins/siem/public/components/timeline/body/column_headers/actions/index.tsx index 640dc77c77b2e..6cb753146d742 100644 --- a/x-pack/plugins/siem/public/components/timeline/body/column_headers/actions/index.tsx +++ b/x-pack/plugins/siem/public/components/timeline/body/column_headers/actions/index.tsx @@ -49,7 +49,12 @@ export const CloseButton = pure<{ aria-label={i18n.REMOVE_COLUMN} data-test-subj="remove-column" iconType="cross" - onClick={() => onColumnRemoved(columnId)} + onClick={(event: React.MouseEvent) => { + // To avoid a re-sorting when you delete a column + event.preventDefault(); + event.stopPropagation(); + onColumnRemoved(columnId); + }} /> )); diff --git a/x-pack/plugins/siem/public/graphql/introspection.json b/x-pack/plugins/siem/public/graphql/introspection.json index 5845dc23341b5..646a5c2245a79 100644 --- a/x-pack/plugins/siem/public/graphql/introspection.json +++ b/x-pack/plugins/siem/public/graphql/introspection.json @@ -2955,11 +2955,7 @@ "name": "value", "description": "", "args": [], - "type": { - "kind": "NON_NULL", - "name": null, - "ofType": { "kind": "SCALAR", "name": "String", "ofType": null } - }, + "type": { "kind": "SCALAR", "name": "String", "ofType": null }, "isDeprecated": false, "deprecationReason": null }, diff --git a/x-pack/plugins/siem/public/graphql/types.ts b/x-pack/plugins/siem/public/graphql/types.ts index c6b80a51dae37..49632def01189 100644 --- a/x-pack/plugins/siem/public/graphql/types.ts +++ b/x-pack/plugins/siem/public/graphql/types.ts @@ -312,7 +312,7 @@ export interface OsEcsFields { } export interface CursorType { - value: string; + value?: string | null; tiebreaker?: string | null; } @@ -2181,7 +2181,7 @@ export namespace GetAuthenticationsQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -2195,7 +2195,7 @@ export namespace GetAuthenticationsQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -2323,7 +2323,7 @@ export namespace GetDomainsQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -2337,7 +2337,7 @@ export namespace GetDomainsQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -2386,7 +2386,7 @@ export namespace GetEventsQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; tiebreaker?: string | null; }; @@ -2634,7 +2634,7 @@ export namespace GetHostsTableQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -2648,7 +2648,7 @@ export namespace GetHostsTableQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -3090,7 +3090,7 @@ export namespace GetNetworkDnsQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -3104,7 +3104,7 @@ export namespace GetNetworkDnsQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -3219,7 +3219,7 @@ export namespace GetNetworkTopNFlowQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -3233,7 +3233,7 @@ export namespace GetNetworkTopNFlowQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -3609,7 +3609,7 @@ export namespace GetTimelineQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; tiebreaker?: string | null; }; @@ -4838,7 +4838,7 @@ export namespace GetTlsQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -4852,7 +4852,7 @@ export namespace GetTlsQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -4936,7 +4936,7 @@ export namespace GetUncommonProcessesQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -4950,7 +4950,7 @@ export namespace GetUncommonProcessesQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } @@ -5021,7 +5021,7 @@ export namespace GetUsersQuery { export type Cursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; export type PageInfo = { @@ -5035,7 +5035,7 @@ export namespace GetUsersQuery { export type EndCursor = { __typename?: 'CursorType'; - value: string; + value?: string | null; }; } diff --git a/x-pack/plugins/siem/server/graphql/types.ts b/x-pack/plugins/siem/server/graphql/types.ts index bc90d5bf7f89b..168ce83062298 100644 --- a/x-pack/plugins/siem/server/graphql/types.ts +++ b/x-pack/plugins/siem/server/graphql/types.ts @@ -341,7 +341,7 @@ export interface OsEcsFields { } export interface CursorType { - value: string; + value?: string | null; tiebreaker?: string | null; } @@ -3342,16 +3342,16 @@ export namespace OsEcsFieldsResolvers { export namespace CursorTypeResolvers { export interface Resolvers { - value?: ValueResolver; + value?: ValueResolver; tiebreaker?: TiebreakerResolver; } - export type ValueResolver = Resolver< - R, - Parent, - Context - >; + export type ValueResolver< + R = string | null, + Parent = CursorType, + Context = SiemContext + > = Resolver; export type TiebreakerResolver< R = string | null, Parent = CursorType,