Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7.x field changes #28543

Merged
merged 15 commits into from
Jan 18, 2019
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
27 changes: 27 additions & 0 deletions x-pack/plugins/uptime/common/graphql/introspection.json
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,14 @@
"type": { "kind": "OBJECT", "name": "TLS", "ofType": null },
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "url",
"description": "",
"args": [],
"type": { "kind": "OBJECT", "name": "URL", "ofType": null },
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
Expand Down Expand Up @@ -1322,6 +1330,25 @@
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "URL",
"description": "",
"fields": [
{
"name": "full",
"description": "",
"args": [],
"type": { "kind": "SCALAR", "name": "String", "ofType": null },
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [],
"enumValues": null,
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "DocCount",
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/uptime/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export interface Ping {
tcp?: Tcp | null;

tls?: Tls | null;

url?: Url | null;
}
/** An agent for recording a beat */
export interface Beat {
Expand Down Expand Up @@ -258,6 +260,10 @@ export interface Tls {
rtt?: Rtt | null;
}

export interface Url {
full?: string | null;
}

export interface DocCount {
count: UnsignedInteger;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ export const FilterBar = ({ dateRangeEnd, dateRangeStart, updateQuery }: FilterB
{
type: 'field_value_selection',
field: 'monitor.id',
name: i18n.translate('xpack.uptime.filterBar.options.hostLabel', {
defaultMessage: 'Host',
name: i18n.translate('xpack.uptime.filterBar.options.idLabel', {
defaultMessage: 'ID',
}),
multiSelect: false,
options: take(id, MAX_SELECTION_LENGTH).map((idValue: any) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ export const getMonitorListQuery = gql`
ping {
timestamp
monitor {
id
status
type
host
ip
duration {
us
}
}
url {
full
}
}
upSeries {
x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EuiInMemoryTable,
// @ts-ignore missing type definition
EuiLineSeries,
EuiLink,
EuiPanel,
// @ts-ignore missing type definition
EuiSeriesChart,
Expand Down Expand Up @@ -65,25 +66,22 @@ const monitorListColumns = [
sortable: true,
},
{
field: 'ping.monitor.host',
name: i18n.translate('xpack.uptime.monitorList.hostColumnLabel', {
defaultMessage: 'Host',
field: 'ping.monitor.id',
name: i18n.translate('xpack.uptime.monitorList.idColumnLabel', {
defaultMessage: 'ID',
}),
render: (host: string, monitor: any) => <Link to={`/monitor/${monitor.key.id}`}>{host}</Link>,
render: (id: string, monitor: any) => <Link to={`/monitor/${monitor.key.id}`}>{id}</Link>,
},
{
field: 'key.port',
name: i18n.translate('xpack.uptime.monitorList.portColumnLabel', {
defaultMessage: 'Port',
field: 'ping.url.full',
name: i18n.translate('xpack.uptime.monitorList.urlColumnLabel', {
defaultMessage: 'URL',
}),
sortable: true,
},
{
field: 'ping.monitor.type',
name: i18n.translate('xpack.uptime.monitorList.typeColumnLabel', {
defaultMessage: 'Type',
}),
sortable: true,
render: (url: string, monitor: any) => (
<EuiLink href={url} target="_blank">
andrewvc marked this conversation as resolved.
Show resolved Hide resolved
{url}
</EuiLink>
),
},
{
field: 'ping.monitor.ip',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ export const createGetMonitorStatusBarQuery = gql`
duration {
us
}
scheme
}
tcp {
port
url {
full
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiPanel } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiHealth, EuiLink, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import moment from 'moment';
Expand Down Expand Up @@ -55,11 +55,10 @@ export const MonitorStatusBar = ({
monitor: {
status,
timestamp,
host,
ip,
duration: { us },
scheme,
},
tcp: { port },
url: { full: fullURL },
} = monitorStatus[0];

return (
Expand Down Expand Up @@ -99,17 +98,16 @@ export const MonitorStatusBar = ({
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.hostMessage"
values={{ host }}
defaultMessage="Host: {host}"
/>
<EuiLink href={fullURL} target="_blank">
{fullURL}
</EuiLink>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.portMessage"
values={{ port }}
defaultMessage="Port: {port}"
id="xpack.uptime.monitorStatusBar.healthStatus.ipMessage"
// TODO: this should not be computed inline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably remove this comment. Not worth breaking CI for though.

values={{ ip }}
defaultMessage="IP: {ip}"
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand All @@ -120,13 +118,6 @@ export const MonitorStatusBar = ({
defaultMessage="Duration: {duration} ms"
/>
</EuiFlexItem>
<EuiFlexItem>
<FormattedMessage
id="xpack.uptime.monitorStatusBar.healthStatus.schemeMessage"
values={{ scheme }}
defaultMessage="Scheme: {scheme}"
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
);
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/uptime/server/graphql/pings/schema.gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ export const pingsSchema = gql`
rtt: RTT
}

type URL {
full: String
scheme: String
domain: String
port: Int
path: String
query: String
}

"A request sent from a monitor to a host"
type Ping {
"The timestamp of the ping's creation"
Expand All @@ -199,5 +208,6 @@ export const pingsSchema = gql`
tags: String
tcp: TCP
tls: TLS
url: URL
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter {
body: {
query: getFilteredQuery(dateRangeStart, dateRangeEnd, filters),
aggs: {
hosts: {
urls: {
composite: {
sources: [
{
Expand All @@ -165,7 +165,7 @@ export class ElasticsearchMonitorsAdapter implements UMMonitorsAdapter {
{
port: {
terms: {
field: 'tcp.port',
field: 'url.full',
},
},
},
Expand Down