Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,15 @@ describe('Field Renderers', () => {
};
test('it renders correctly against snapshot', () => {
const wrapper = shallow(
<TestProviders>
{hostNameRenderer(mockData.complete.source!.host!, '10.10.10.10')}
</TestProviders>
<TestProviders>{hostNameRenderer(mockData.complete.host, '10.10.10.10')}</TestProviders>
);

expect(toJson(wrapper)).toMatchSnapshot();
});

test('it renders emptyTagValue when non-matching IP is provided', () => {
const wrapper = mount(
<TestProviders>
{hostNameRenderer(mockData.complete.source!.host!, '10.10.10.11')}
</TestProviders>
<TestProviders>{hostNameRenderer(mockData.complete.host, '10.10.10.11')}</TestProviders>
);
expect(wrapper.text()).toEqual(getEmptyValue());
});
Expand Down Expand Up @@ -163,19 +159,15 @@ describe('Field Renderers', () => {
};
test('it renders correctly against snapshot', () => {
const wrapper = shallow(
<TestProviders>
{hostNameRenderer(mockData.complete.source!.host!, '10.10.10.10')}
</TestProviders>
<TestProviders>{hostNameRenderer(mockData.complete.host, '10.10.10.10')}</TestProviders>
);

expect(toJson(wrapper)).toMatchSnapshot();
});

test('it renders emptyTagValue when non-matching IP is provided', () => {
const wrapper = mount(
<TestProviders>
{hostNameRenderer(mockData.complete.source!.host!, '10.10.10.11')}
</TestProviders>
<TestProviders>{hostNameRenderer(mockData.complete.host, '10.10.10.11')}</TestProviders>
);
expect(wrapper.text()).toEqual(getEmptyValue());
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ export const IpOverview = pure<IpOverviewProps>(({ ip, data, loading, flowTarget
[
{
title: i18n.HOST_ID,
description: typeData ? hostIdRenderer(typeData.host, ip) : getEmptyTagValue(),
description: typeData ? hostIdRenderer(data.host, ip) : getEmptyTagValue(),
},
{
title: i18n.HOST_NAME,
description: typeData ? hostNameRenderer(typeData.host, ip) : getEmptyTagValue(),
description: typeData ? hostNameRenderer(data.host, ip) : getEmptyTagValue(),
},
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@ export const mockData: Readonly<Record<string, IpOverviewData>> = {
region_iso_code: ['US-NY'],
region_name: ['New York'],
},
host: {
os: {
kernel: ['4.14.50-v7+'],
name: ['Raspbian GNU/Linux'],
family: [''],
version: ['9 (stretch)'],
platform: ['raspbian'],
},
name: ['raspberrypi'],
id: ['b19a781f683541a7a25ee345133aa399'],
ip: ['10.10.10.10'],
architecture: ['armv7l'],
},
},
destination: {
firstSeen: '2019-02-07T17:19:41.648Z',
Expand All @@ -54,19 +41,19 @@ export const mockData: Readonly<Record<string, IpOverviewData>> = {
region_iso_code: ['US-NY'],
region_name: ['New York'],
},
host: {
os: {
kernel: ['4.14.50-v7+'],
name: ['Raspbian GNU/Linux'],
family: [''],
version: ['9 (stretch)'],
platform: ['raspbian'],
},
name: ['raspberrypi'],
id: ['b19a781f683541a7a25ee345133aa399'],
ip: ['10.10.10.10'],
architecture: ['armv7l'],
},
host: {
os: {
kernel: ['4.14.50-v7+'],
name: ['Raspbian GNU/Linux'],
family: [''],
version: ['9 (stretch)'],
platform: ['raspbian'],
},
name: ['raspberrypi'],
id: ['b19a781f683541a7a25ee345133aa399'],
ip: ['10.10.10.10'],
architecture: ['armv7l'],
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,6 @@ export const ipOverviewQuery = gql`
region_iso_code
region_name
}
host {
architecture
id
ip
mac
name
os {
family
name
platform
version
}
type
}
}
destination {
firstSeen
Expand All @@ -71,20 +57,20 @@ export const ipOverviewQuery = gql`
region_iso_code
region_name
}
host {
architecture
id
ip
mac
}
host {
architecture
id
ip
mac
name
os {
family
name
os {
family
name
platform
version
}
type
platform
version
}
type
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const IpOverviewQuery = pure<IpOverviewProps>(
}}
>
{({ data, loading }) => {
const init: IpOverviewData = {};
const init: IpOverviewData = { host: {} };
const ipOverviewData: IpOverviewData = getOr(init, 'source.IpOverview', data);
return children({
id,
Expand Down
24 changes: 12 additions & 12 deletions x-pack/plugins/siem/public/graphql/introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -5814,6 +5814,18 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "host",
"description": "",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "server",
"description": "",
Expand Down Expand Up @@ -5869,18 +5881,6 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "host",
"description": "",
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": { "kind": "OBJECT", "name": "HostEcsFields", "ofType": null }
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "geo",
"description": "",
Expand Down
46 changes: 7 additions & 39 deletions x-pack/plugins/siem/public/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,8 @@ export interface IpOverviewData {

destination?: Overview | null;

host: HostEcsFields;

server?: Overview | null;

source?: Overview | null;
Expand All @@ -916,8 +918,6 @@ export interface Overview {

autonomousSystem: AutonomousSystem;

host: HostEcsFields;

geo: GeoEcsFields;
}

Expand Down Expand Up @@ -2767,6 +2767,8 @@ export namespace GetIpOverviewQuery {
source?: _Source | null;

destination?: Destination | null;

host: Host;
};

export type _Source = {
Expand All @@ -2779,8 +2781,6 @@ export namespace GetIpOverviewQuery {
autonomousSystem: AutonomousSystem;

geo: Geo;

host: Host;
};

export type AutonomousSystem = {
Expand Down Expand Up @@ -2819,36 +2819,6 @@ export namespace GetIpOverviewQuery {
lon?: ToNumberArray | null;
};

export type Host = {
__typename?: 'HostEcsFields';

architecture?: ToStringArray | null;

id?: ToStringArray | null;

ip?: ToStringArray | null;

mac?: ToStringArray | null;

name?: ToStringArray | null;

os?: Os | null;

type?: ToStringArray | null;
};

export type Os = {
__typename?: 'OsEcsFields';

family?: ToStringArray | null;

name?: ToStringArray | null;

platform?: ToStringArray | null;

version?: ToStringArray | null;
};

export type Destination = {
__typename?: 'Overview';

Expand All @@ -2859,8 +2829,6 @@ export namespace GetIpOverviewQuery {
autonomousSystem: _AutonomousSystem;

geo: _Geo;

host: _Host;
};

export type _AutonomousSystem = {
Expand Down Expand Up @@ -2899,7 +2867,7 @@ export namespace GetIpOverviewQuery {
lon?: ToNumberArray | null;
};

export type _Host = {
export type Host = {
__typename?: 'HostEcsFields';

architecture?: ToStringArray | null;
Expand All @@ -2912,12 +2880,12 @@ export namespace GetIpOverviewQuery {

name?: ToStringArray | null;

os?: _Os | null;
os?: Os | null;

type?: ToStringArray | null;
};

export type _Os = {
export type Os = {
__typename?: 'OsEcsFields';

family?: ToStringArray | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ const ipOverviewSchema = gql`
firstSeen: Date
lastSeen: Date
autonomousSystem: AutonomousSystem!
host: HostEcsFields!
geo: GeoEcsFields!
}

type IpOverviewData {
client: Overview
destination: Overview
host: HostEcsFields!
server: Overview
source: Overview
}
Expand Down
18 changes: 9 additions & 9 deletions x-pack/plugins/siem/server/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,8 @@ export interface IpOverviewData {

destination?: Overview | null;

host: HostEcsFields;

server?: Overview | null;

source?: Overview | null;
Expand All @@ -945,8 +947,6 @@ export interface Overview {

autonomousSystem: AutonomousSystem;

host: HostEcsFields;

geo: GeoEcsFields;
}

Expand Down Expand Up @@ -5300,6 +5300,8 @@ export namespace IpOverviewDataResolvers {

destination?: DestinationResolver<Overview | null, TypeParent, Context>;

host?: HostResolver<HostEcsFields, TypeParent, Context>;

server?: ServerResolver<Overview | null, TypeParent, Context>;

source?: SourceResolver<Overview | null, TypeParent, Context>;
Expand All @@ -5315,6 +5317,11 @@ export namespace IpOverviewDataResolvers {
Parent = IpOverviewData,
Context = SiemContext
> = Resolver<R, Parent, Context>;
export type HostResolver<
R = HostEcsFields,
Parent = IpOverviewData,
Context = SiemContext
> = Resolver<R, Parent, Context>;
export type ServerResolver<
R = Overview | null,
Parent = IpOverviewData,
Expand All @@ -5335,8 +5342,6 @@ export namespace OverviewResolvers {

autonomousSystem?: AutonomousSystemResolver<AutonomousSystem, TypeParent, Context>;

host?: HostResolver<HostEcsFields, TypeParent, Context>;

geo?: GeoResolver<GeoEcsFields, TypeParent, Context>;
}

Expand All @@ -5355,11 +5360,6 @@ export namespace OverviewResolvers {
Parent = Overview,
Context = SiemContext
> = Resolver<R, Parent, Context>;
export type HostResolver<R = HostEcsFields, Parent = Overview, Context = SiemContext> = Resolver<
R,
Parent,
Context
>;
export type GeoResolver<R = GeoEcsFields, Parent = Overview, Context = SiemContext> = Resolver<
R,
Parent,
Expand Down
Loading