From 9256c19931a108e7bfd53af071e24f4cf7db8f3c Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 4 Nov 2020 12:18:38 +0100 Subject: [PATCH 01/22] Refactor overview list --- .../common/runtime_types/monitor/state.ts | 11 ++- .../plugins/uptime/public/apps/uptime_app.tsx | 1 + .../overview/filter_group/filter_popover.tsx | 3 +- .../monitor_list/columns/monitor_name_col.tsx | 76 +++++++++++++++++++ .../overview/monitor_list/monitor_list.tsx | 17 +---- .../monitor_list/monitor_list_container.tsx | 1 - .../monitor_list_drawer.tsx | 39 ++++++++-- .../monitor_status_list.tsx | 16 +++- .../monitor_status_row.tsx | 34 ++------- .../monitor_list_status_column.tsx | 73 +++++++++--------- .../public/contexts/uptime_theme_context.tsx | 7 +- .../plugins/uptime/public/pages/overview.tsx | 2 +- .../server/lib/requests/get_monitor_states.ts | 1 + .../search/refine_potential_matches.ts | 1 + 14 files changed, 187 insertions(+), 95 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx diff --git a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts index d32c47bb5d3f9..46290b9e53b8e 100644 --- a/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts +++ b/x-pack/plugins/uptime/common/runtime_types/monitor/state.ts @@ -23,9 +23,14 @@ export const StateType = t.intersection([ up: t.number, down: t.number, }), - monitor: t.partial({ - name: t.string, - }), + monitor: t.intersection([ + t.partial({ + name: t.string, + }), + t.type({ + type: t.string, + }), + ]), }), t.partial({ tls: t.partial({ diff --git a/x-pack/plugins/uptime/public/apps/uptime_app.tsx b/x-pack/plugins/uptime/public/apps/uptime_app.tsx index a5b8bc859ad94..31f167e3dc129 100644 --- a/x-pack/plugins/uptime/public/apps/uptime_app.tsx +++ b/x-pack/plugins/uptime/public/apps/uptime_app.tsx @@ -35,6 +35,7 @@ import { ScopedHistory } from '../../../../../src/core/public'; export interface UptimeAppColors { danger: string; + dangerBehindText: string; success: string; gray: string; range: string; diff --git a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx index 902f497babda8..5b8c27acf8d75 100644 --- a/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx +++ b/x-pack/plugins/uptime/public/components/overview/filter_group/filter_popover.tsx @@ -54,6 +54,7 @@ export const FilterPopover = ({ const mItems = selectedItems.concat(allItems ?? []); const newItems = mItems.filter((item, index) => mItems.indexOf(item) === index); setItems(newItems); + setTempSelectedItems(selectedItems); }, [allItems, selectedItems]); useEffect(() => { @@ -73,7 +74,7 @@ export const FilterPopover = ({ isDisabled={disabled && selectedItems.length === 0} isSelected={tempSelectedItems.length > 0} numFilters={items.length} - numActiveFilters={tempSelectedItems.length} + numActiveFilters={isOpen ? tempSelectedItems.length : selectedItems.length} onClick={() => { setIsOpen(!isOpen); onFilterFieldChange(fieldName, tempSelectedItems); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx new file mode 100644 index 0000000000000..e0276f3004ba7 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx @@ -0,0 +1,76 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import { EuiBadge } from '@elastic/eui'; +import { MonitorPageLink } from '../../../common/monitor_page_link'; +import { useGetUrlParams } from '../../../../hooks'; +import { stringifyUrlParams } from '../../../../lib/helper/stringify_url_params'; +import { MonitorSummary } from '../../../../../common/runtime_types/monitor'; +import { useFilterUpdate } from '../../../../hooks/use_filter_update'; + +interface Props { + summary: MonitorSummary; +} + +const parseCurrentFilters = (filters: string) => { + let parsedFilters: Map; + try { + parsedFilters = new Map(JSON.parse(filters)); + } catch { + parsedFilters = new Map(); + } + return parsedFilters; +}; + +const MONITOR_TYPES: Record = { + browser: 'Browser', + http: 'HTTP', + tcp: 'TCP', + icmp: 'ICMP', +}; + +export const MonitorNameColumn = ({ summary }: Props) => { + const { absoluteDateRangeStart, absoluteDateRangeEnd, ...params } = useGetUrlParams(); + + const linkParameters = stringifyUrlParams(params, true); + + const currFilters = parseCurrentFilters(params.filters); + + const [filterType, setFilterType] = useState(currFilters.get('monitor.type') ?? []); + + useFilterUpdate('monitor.type', filterType); + + const filterLabel = i18n.translate('xpack.uptime.monitorList.monitorType.filter', { + defaultMessage: 'Filter all monitors with type {type}', + values: { + type: summary.state.monitor.type, + }, + }); + + return ( +
+ + {summary.state.monitor.name + ? summary.state.monitor.name + : `Unnamed - ${summary.monitor_id}`} + +
+ { + setFilterType([summary.state.monitor.type]); + }} + onClickAriaLabel={filterLabel} + > + {MONITOR_TYPES[summary.state.monitor.type]} + +
+
+ ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index 5e0cc5d3dee1d..b6cc4b22a2335 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -21,7 +21,6 @@ import { MonitorSummary } from '../../../../common/runtime_types'; import { MonitorListStatusColumn } from './monitor_list_status_column'; import { ExpandedRowMap } from './types'; import { MonitorBarSeries } from '../../common/charts'; -import { MonitorPageLink } from '../../common/monitor_page_link'; import { OverviewPageLink } from './overview_page_link'; import * as labels from './translations'; import { MonitorListPageSizeSelect } from './monitor_list_page_size_select'; @@ -33,6 +32,7 @@ import { MonitorListHeader } from './monitor_list_header'; import { URL_LABEL } from '../../common/translations'; import { EnableMonitorAlert } from './columns/enable_alert'; import { STATUS_ALERT_COLUMN } from './translations'; +import { MonitorNameColumn } from './columns/monitor_name_col'; interface Props extends MonitorListProps { pageSize: number; @@ -54,16 +54,9 @@ export const noItemsMessage = (loading: boolean, filters?: string) => { export const MonitorListComponent: ({ filters, monitorList: { list, error, loading }, - linkParameters, pageSize, setPageSize, -}: Props) => any = ({ - filters, - monitorList: { list, error, loading }, - linkParameters, - pageSize, - setPageSize, -}) => { +}: Props) => any = ({ filters, monitorList: { list, error, loading }, pageSize, setPageSize }) => { const [drawerIds, updateDrawerIds] = useState([]); const items = list.summaries ?? []; @@ -109,11 +102,7 @@ export const MonitorListComponent: ({ mobileOptions: { fullWidth: true, }, - render: (name: string, summary: MonitorSummary) => ( - - {name ? name : `Unnamed - ${summary.monitor_id}`} - - ), + render: (name: string, summary: MonitorSummary) => , sortable: true, }, { diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx index ce5490752a89e..b7b6cf9a57c5e 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_container.tsx @@ -14,7 +14,6 @@ import { UptimeRefreshContext } from '../../../contexts'; export interface MonitorListProps { filters?: string; - linkParameters?: string; } const DEFAULT_PAGE_SIZE = 10; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx index 4b359099bc58c..015bed96f71e0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx @@ -6,13 +6,15 @@ import React from 'react'; import styled from 'styled-components'; -import { EuiLink, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText } from '@elastic/eui'; +import moment from 'moment'; +import { EuiLink, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; +import { Alert } from '../../../../../../triggers_actions_ui/public'; import { MostRecentError } from './most_recent_error'; import { MonitorStatusList } from './monitor_status_list'; import { MonitorDetails, MonitorSummary } from '../../../../../common/runtime_types'; import { ActionsPopover } from './actions_popover/actions_popover_container'; import { EnabledAlerts } from './enabled_alerts'; -import { Alert } from '../../../../../../triggers_actions_ui/public'; const ContainerDiv = styled.div` padding: 10px; @@ -47,12 +49,33 @@ export function MonitorListDrawerComponent({ - - - {monitorUrl} - - - + + + +

+ {i18n.translate('xpack.uptime.monitorList.drawer.url', { + defaultMessage: 'Url', + })} +

+
+ + + {monitorUrl} + + +
+ + +

+ {i18n.translate('xpack.uptime.monitorList.drawer.mostRecentRun', { + defaultMessage: 'Most recent test run', + })} +

+
+ {/* TODO: add link to details page */} + {moment(summary.state.timestamp).format('LLL').toString()} +
+
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx index 96536a357a450..9f2eb753cd1bd 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_list.tsx @@ -5,7 +5,7 @@ */ import React from 'react'; -import { EuiCallOut, EuiSpacer } from '@elastic/eui'; +import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { LocationLink } from '../../../common/location_link'; import { MonitorStatusRow } from './monitor_status_row'; @@ -39,8 +39,18 @@ export const MonitorStatusList = ({ summaryPings }: MonitorStatusListProps) => { return ( <> - - + + {downChecks.size > 0 && ( + + + + )} + {absUpChecks.size > 0 && ( + + + + )} + {(downChecks.has(UNNAMED_LOCATION) || upChecks.has(UNNAMED_LOCATION)) && ( <> diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx index d0cc71ece989a..458303e704ee0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx @@ -4,10 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { useContext } from 'react'; -import { EuiHealth, EuiSpacer } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { UptimeThemeContext } from '../../../../contexts'; +import React from 'react'; +import { EuiBadge, EuiSpacer } from '@elastic/eui'; import { UNNAMED_LOCATION, STATUS } from '../../../../../common/constants'; interface MonitorStatusRowProps { @@ -22,11 +20,7 @@ interface MonitorStatusRowProps { } export const MonitorStatusRow = ({ locationNames, status }: MonitorStatusRowProps) => { - const { - colors: { success, danger }, - } = useContext(UptimeThemeContext); - - const color = status === STATUS.UP ? success : danger; + const color = status === STATUS.UP ? 'secondary' : 'danger'; let checkListArray = [...locationNames]; // If un-named location exists, move it to end @@ -41,23 +35,11 @@ export const MonitorStatusRow = ({ locationNames, status }: MonitorStatusRowProp const locations = checkListArray.join(', '); return ( - <> - - {status === STATUS.UP ? ( - - ) : ( - - )} - + + {status} + + {locations} - + ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx index 7140211d18807..7d257abae9344 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx @@ -4,11 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import React from 'react'; +import React, { useContext } from 'react'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; import styled from 'styled-components'; -import { EuiHealth, EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip } from '@elastic/eui'; +import { EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiBadge, EuiSpacer } from '@elastic/eui'; import { parseTimestamp } from './parse_timestamp'; import { Ping } from '../../../../common/runtime_types'; import { @@ -19,6 +19,7 @@ import { } from '../../../../common/constants'; import * as labels from './translations'; +import { UptimeThemeContext } from '../../../contexts'; interface MonitorListStatusColumnProps { status: string; @@ -27,7 +28,7 @@ interface MonitorListStatusColumnProps { } const PaddedSpan = styled.span` - padding-left: 17px; + padding-left: 5px; `; const StatusColumnFlexG = styled(EuiFlexGroup)` @@ -36,17 +37,6 @@ const StatusColumnFlexG = styled(EuiFlexGroup)` } `; -const getHealthColor = (status: string): string => { - switch (status) { - case STATUS.UP: - return 'success'; - case STATUS.DOWN: - return 'danger'; - default: - return ''; - } -}; - const getHealthMessage = (status: string): string | null => { switch (status) { case STATUS.UP: @@ -118,29 +108,40 @@ export const MonitorListStatusColumn = ({ timestamp: tsString, }: MonitorListStatusColumnProps) => { const timestamp = parseTimestamp(tsString); + + const { + colors: { dangerBehindText }, + } = useContext(UptimeThemeContext); + return ( - - - - {getHealthMessage(status)} - - - - {timestamp.toLocaleString()} - - } +
+ + + - - {getRelativeShortTimeStamp(tsString)} - - - - - - {getLocationStatus(summaryPings, status)} - - + {getHealthMessage(status)} + + + + + + {timestamp.toLocaleString()} + + } + > + + {getRelativeShortTimeStamp(tsString)} + + + + + + + {getLocationStatus(summaryPings, status)} +
); }; diff --git a/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx b/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx index f0a702b9c0b75..a2f50c44f8ca4 100644 --- a/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx +++ b/x-pack/plugins/uptime/public/contexts/uptime_theme_context.tsx @@ -26,6 +26,7 @@ export interface UptimeThemeContextValues { const defaultContext: UptimeThemeContextValues = { colors: { danger: euiLightVars.euiColorDanger, + dangerBehindText: euiDarkVars.euiColorVis9_behindText, mean: euiLightVars.euiColorPrimary, range: euiLightVars.euiFocusBackgroundColor, success: euiLightVars.euiColorSuccess, @@ -49,7 +50,8 @@ export const UptimeThemeContextProvider: React.FC = ({ darkMo let colors: UptimeAppColors; if (darkMode) { colors = { - danger: euiDarkVars.euiColorDanger, + danger: euiDarkVars.euiColorVis9, + dangerBehindText: euiDarkVars.euiColorVis9_behindText, mean: euiDarkVars.euiColorPrimary, gray: euiDarkVars.euiColorLightShade, range: euiDarkVars.euiFocusBackgroundColor, @@ -59,7 +61,8 @@ export const UptimeThemeContextProvider: React.FC = ({ darkMo }; } else { colors = { - danger: euiLightVars.euiColorDanger, + danger: euiLightVars.euiColorVis9, + dangerBehindText: euiLightVars.euiColorVis9_behindText, mean: euiLightVars.euiColorPrimary, gray: euiLightVars.euiColorLightShade, range: euiLightVars.euiFocusBackgroundColor, diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/uptime/public/pages/overview.tsx index 9594819e385c0..4dcf620a3e977 100644 --- a/x-pack/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/plugins/uptime/public/pages/overview.tsx @@ -93,7 +93,7 @@ export const OverviewPageComponent = React.memo( - + ); diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts index 3e49a32881f54..3bf38a87eb596 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts @@ -151,6 +151,7 @@ export const getHistogramForMonitors = async ( }, }, }; + const result = await queryContext.search(params); const histoBuckets: any[] = result.aggregations.histogram.buckets; diff --git a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts index a864bfa591424..6e1c51f250444 100644 --- a/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts +++ b/x-pack/plugins/uptime/server/lib/requests/search/refine_potential_matches.ts @@ -86,6 +86,7 @@ export const summaryPingsToSummary = (summaryPings: Ping[]): MonitorSummary => { timestamp: latest.timestamp, monitor: { name: latest.monitor?.name, + type: latest.monitor?.type, }, url: latest.url ?? {}, summary: { From e8dfad2115d0b95ac91152dd9e6e10aacea64ee7 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 4 Nov 2020 13:34:41 +0100 Subject: [PATCH 02/22] update snapshots --- .../__snapshots__/monitor_list.test.tsx.snap | 194 +++++----- .../monitor_list_status_column.test.tsx.snap | 353 +++++++++--------- .../monitor_status_list.test.tsx.snap | 52 ++- .../monitor_status_row.test.tsx.snap | 48 +-- .../actions_popover/actions_popover.tsx | 7 +- 5 files changed, 342 insertions(+), 312 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index 56a62b18785d8..afeb3c02dfc01 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -820,7 +820,7 @@ exports[`MonitorList component renders loading state 1`] = ` exports[`MonitorList component renders the monitor list 1`] = ` .c3 { - padding-left: 17px; + padding-left: 5px; } .c5 { @@ -1104,59 +1104,52 @@ exports[`MonitorList component renders the monitor list 1`] = `
-
+
-
-
- -
-
-
+
- -
- 5m ago +
+ 5m ago +
-
+
- +
+
-
- in 0/1 Location -
+ in 0/1 Location
@@ -1172,17 +1165,30 @@ exports[`MonitorList component renders the monitor list 1`] = `
-
+
-
-
- -
-
-
+
- -
- 5m ago +
+ 5m ago +
-
+
- +
+
-
- in 0/1 Location -
+ in 0/1 Location
@@ -1395,17 +1394,30 @@ exports[`MonitorList component renders the monitor list 1`] = `
- + - - Up - - - + Up + + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > - Thu May 09 2019 10:15:11 GMT-0400 + a few seconds ago - } - delay="regular" - position="top" - > - - a few seconds ago - - - - - + + + + + - - in 0/0 Location - - - + in 0/0 Location + +
`; exports[`MonitorListStatusColumn provides expected tooltip and display times 1`] = ` - - + - - Up - - - + Up + + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > - Thu May 09 2019 10:15:11 GMT-0400 + a few seconds ago - } - delay="regular" - position="top" - > - - a few seconds ago - - - - - + + + + + - - in 0/0 Location - -
- + in 0/0 Location + + `; exports[`MonitorListStatusColumn will display location status 1`] = ` - - + - - Up - - - + Up + + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > - Thu May 09 2019 10:15:11 GMT-0400 + a few seconds ago - } - delay="regular" - position="top" - > - - a few seconds ago - - - - - + + + + + - - in 1/3 Locations - -
- + in 1/3 Locations + + `; exports[`MonitorListStatusColumn will render display location status 1`] = ` .c1 { - padding-left: 17px; + padding-left: 5px; } @media (max-width:574px) { @@ -188,61 +200,58 @@ exports[`MonitorListStatusColumn will render display location status 1`] = ` } } -
+
-
-
-
-
- Up -
-
+ class="euiBadge__text" + > + Up + + +
- -
- a few seconds ago +
+ a few seconds ago +
-
+
- +
+
-
- in 1/3 Locations -
+ in 1/3 Locations
`; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap index 27ce47ff28b77..a9880339f7973 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap @@ -2,18 +2,24 @@ exports[`MonitorStatusList component renders checks 1`] = ` - - + > + + + + @@ -38,18 +44,24 @@ exports[`MonitorStatusList component renders checks 1`] = ` exports[`MonitorStatusList component renders null in place of child status with missing ip 1`] = ` - - + > + + + + diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_row.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_row.test.tsx.snap index 8e4aa984c1e89..42d6b522b4f3b 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_row.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_row.test.tsx.snap @@ -1,43 +1,35 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`MonitorStatusRow component renders status row when status is down 1`] = ` - - + - - + Down + + + Berlin, Islamabad, London - + `; exports[`MonitorStatusRow component renders status row when status is up 1`] = ` - - + - - + Up + + + Berlin, Islamabad, London - + `; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx index 9e96f0ca76535..3e1276b26b727 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/actions_popover/actions_popover.tsx @@ -46,7 +46,12 @@ export const ActionsPopoverComponent = ({ iconType="arrowDown" iconSide="right" > - Integrations + {i18n.translate( + 'xpack.uptime.monitorList.observabilityInvestigateColumn.popoverIconButton.label', + { + defaultMessage: 'Investigate', + } + )} } closePopover={() => togglePopoverIsVisible({ id: popoverId, open: false })} From c7dea6426fe44bb01b134f6b89867985a1b7ccda Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 4 Nov 2020 15:07:01 +0100 Subject: [PATCH 03/22] update --- .../monitor_list/columns/filter_label.tsx | 5 +++++ .../overview/monitor_list/monitor_list.tsx | 20 +++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx new file mode 100644 index 0000000000000..41bc2aa258807 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx @@ -0,0 +1,5 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index b6cc4b22a2335..25f5a4899ff75 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -9,13 +9,11 @@ import { EuiBasicTable, EuiFlexGroup, EuiFlexItem, - EuiIcon, EuiLink, EuiPanel, EuiSpacer, } from '@elastic/eui'; import React, { useState } from 'react'; -import styled from 'styled-components'; import { HistogramPoint, X509Expiry } from '../../../../common/runtime_types'; import { MonitorSummary } from '../../../../common/runtime_types'; import { MonitorListStatusColumn } from './monitor_list_status_column'; @@ -40,12 +38,6 @@ interface Props extends MonitorListProps { monitorList: MonitorList; } -const TruncatedEuiLink = styled(EuiLink)` - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -`; - export const noItemsMessage = (loading: boolean, filters?: string) => { if (loading) return labels.LOADING; return !!filters ? labels.NO_MONITOR_ITEM_SELECTED : labels.NO_DATA_MESSAGE; @@ -109,10 +101,11 @@ export const MonitorListComponent: ({ align: 'left' as const, field: 'state.url.full', name: URL_LABEL, - render: (url: string, summary: MonitorSummary) => ( - - {url} - + truncate: true, + render: (url: string) => ( + + {url} + ), }, { @@ -136,7 +129,7 @@ export const MonitorListComponent: ({ align: 'center' as const, field: '', name: STATUS_ALERT_COLUMN, - width: '150px', + width: '100px', render: (item: MonitorSummary) => ( From f69f184ed783403daecc27140ce8b2c60587e35c Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 11:16:02 +0100 Subject: [PATCH 04/22] update --- .../monitor_list/columns/monitor_name_col.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx index e0276f3004ba7..c7566269f331f 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx @@ -6,7 +6,7 @@ import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiBadge } from '@elastic/eui'; +import { EuiButtonEmpty, EuiText } from '@elastic/eui'; import { MonitorPageLink } from '../../../common/monitor_page_link'; import { useGetUrlParams } from '../../../../hooks'; import { stringifyUrlParams } from '../../../../lib/helper/stringify_url_params'; @@ -29,9 +29,9 @@ const parseCurrentFilters = (filters: string) => { const MONITOR_TYPES: Record = { browser: 'Browser', - http: 'HTTP', - tcp: 'TCP', - icmp: 'ICMP', + http: 'HTTP Ping', + tcp: 'TCP Ping', + icmp: 'ICMP Ping', }; export const MonitorNameColumn = ({ summary }: Props) => { @@ -60,16 +60,17 @@ export const MonitorNameColumn = ({ summary }: Props) => { : `Unnamed - ${summary.monitor_id}`}
- { setFilterType([summary.state.monitor.type]); }} - onClickAriaLabel={filterLabel} + size="xs" + flush="left" > - {MONITOR_TYPES[summary.state.monitor.type]} - + {MONITOR_TYPES[summary.state.monitor.type]} +
); From ccde474377b9d4ed45c9cacbad48a422f7966257 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 11:58:35 +0100 Subject: [PATCH 05/22] Fix monitor list down histogram --- .../uptime/server/lib/requests/get_monitor_states.ts | 2 +- x-pack/test/api_integration/apis/uptime/rest/index.ts | 3 +++ .../apis/uptime/rest/monitor_states_real_data.ts | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts index 020fcf5331188..2ff1043d79e84 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_monitor_states.ts @@ -151,7 +151,7 @@ export const getHistogramForMonitors = async ( }, }, }; - const result = await queryContext.search(params); + const { body: result } = await queryContext.search(params); const histoBuckets: any[] = result.aggregations?.histogram.buckets ?? []; const simplified = histoBuckets.map((histoBucket: any): { timestamp: number; byId: any } => { diff --git a/x-pack/test/api_integration/apis/uptime/rest/index.ts b/x-pack/test/api_integration/apis/uptime/rest/index.ts index f59b79a6b7bfc..6f410add0fa4d 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -9,12 +9,15 @@ import { settingsObjectId, settingsObjectType, } from '../../../../../plugins/uptime/server/lib/saved_objects'; +import { registerMochaHooksForSnapshots } from '../../../../apm_api_integration/common/match_snapshot'; export default function ({ getService, loadTestFile }: FtrProviderContext) { const esArchiver = getService('esArchiver'); const server = getService('kibanaServer'); describe('uptime REST endpoints', () => { + registerMochaHooksForSnapshots(); + beforeEach('clear settings', async () => { try { await server.savedObjects.delete({ diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index d3c49bb49ff52..077720ac0588b 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -9,6 +9,7 @@ import { isRight } from 'fp-ts/lib/Either'; import { FtrProviderContext } from '../../../ftr_provider_context'; import { MonitorSummariesResultType } from '../../../../../plugins/uptime/common/runtime_types'; import { API_URLS } from '../../../../../plugins/uptime/common/constants'; +import { expectSnapshot } from '../../../../apm_api_integration/common/match_snapshot'; interface ExpectedMonitorStatesPage { response: any; @@ -90,6 +91,16 @@ export default function ({ getService }: FtrProviderContext) { }); }); + it('will fetch monitor state data for the given down filters', async () => { + const statusFilter = 'down'; + const size = 10; + const { body } = await supertest.get( + `${API_URLS.MONITOR_LIST}?dateRangeStart=${from}&dateRangeEnd=${to}&statusFilter=${statusFilter}&pageSize=${size}` + ); + + expectSnapshot(body).toMatch(); + }); + it('can navigate forward and backward using pagination', async () => { const expectedResultsCount = 100; const size = 10; From a8d741bca2c9e49dc1ab92bd94cfa0787cbb7f5d Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:21:20 +0100 Subject: [PATCH 06/22] snapshots --- .../monitor_states_real_data.snap | 1257 +++++++++++++++++ 1 file changed, 1257 insertions(+) create mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap new file mode 100644 index 0000000000000..8e7ab2023722d --- /dev/null +++ b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap @@ -0,0 +1,1257 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` +Object { + "nextPagePagination": null, + "prevPagePagination": null, + "summaries": Array [ + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0010-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "rZtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 41, + }, + "response_header": Object { + "us": 36777, + }, + "total": Object { + "us": 37821, + }, + "validate": Object { + "us": 36818, + }, + "write_request": Object { + "us": 53, + }, + }, + }, + "monitor": Object { + "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 37926, + }, + "id": "0010-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 56, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 890, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0020-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "X5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 54, + }, + "response_header": Object { + "us": 180, + }, + "total": Object { + "us": 555, + }, + "validate": Object { + "us": 234, + }, + "write_request": Object { + "us": 63, + }, + }, + }, + "monitor": Object { + "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 14900, + }, + "id": "0020-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 14294, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 105, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "timestamp": 1568172624744, + }, + Object { + "timestamp": 1568172677247, + }, + Object { + "timestamp": 1568172729750, + }, + Object { + "timestamp": 1568172782253, + }, + Object { + "timestamp": 1568172834756, + }, + Object { + "down": 1, + "timestamp": 1568172887259, + }, + Object { + "timestamp": 1568172939762, + }, + Object { + "down": 1, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 1, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0030-intermittent", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.373Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "eJtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "500 Internal Server Error", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "500", + "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", + }, + "status_code": 500, + }, + "rtt": Object { + "content": Object { + "us": 28, + }, + "response_header": Object { + "us": 197, + }, + "total": Object { + "us": 17068, + }, + "validate": Object { + "us": 225, + }, + "write_request": Object { + "us": 58, + }, + }, + }, + "monitor": Object { + "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 17146, + }, + "id": "0030-intermittent", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 33, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 16662, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.373Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.373Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=200x5,500x1", + "path": "/pattern", + "port": 5678, + "query": "r=200x5,500x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0040-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "eZtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 29, + }, + "response_header": Object { + "us": 172, + }, + "total": Object { + "us": 18023, + }, + "validate": Object { + "us": 201, + }, + "write_request": Object { + "us": 28, + }, + }, + }, + "monitor": Object { + "check_group": "d76f5490-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 18106, + }, + "id": "0040-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 39, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 17766, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0050-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.386Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "dJtoHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 36, + }, + "response_header": Object { + "us": 213, + }, + "total": Object { + "us": 1011, + }, + "validate": Object { + "us": 249, + }, + "write_request": Object { + "us": 20, + }, + }, + }, + "monitor": Object { + "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 4258, + }, + "id": "0050-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 3215, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 84, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.386Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.386Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0070-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.375Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "a5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 33, + }, + "response_header": Object { + "us": 190, + }, + "total": Object { + "us": 2015, + }, + "validate": Object { + "us": 223, + }, + "write_request": Object { + "us": 21, + }, + }, + }, + "monitor": Object { + "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 15117, + }, + "id": "0070-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 13061, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 84, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.375Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.375Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0080-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "oJtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 34, + }, + "response_header": Object { + "us": 34569, + }, + "total": Object { + "us": 36089, + }, + "validate": Object { + "us": 34604, + }, + "write_request": Object { + "us": 60, + }, + }, + }, + "monitor": Object { + "check_group": "d7715884-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 36171, + }, + "id": "0080-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 37, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 1033, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + ], + "totalSummaryCount": 2000, +} +`; From f2c1c0927fa0021f838b03626d4a14540e7d2684 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:25:48 +0100 Subject: [PATCH 07/22] UP --- .../monitor_states_real_data.snap | 1257 ----------------- .../uptime/rest/monitor_states_real_data.ts | 2 +- 2 files changed, 1 insertion(+), 1258 deletions(-) delete mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap deleted file mode 100644 index 8e7ab2023722d..0000000000000 --- a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap +++ /dev/null @@ -1,1257 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` -Object { - "nextPagePagination": null, - "prevPagePagination": null, - "summaries": Array [ - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0010-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "rZtoHm0B0I9WX_CznN_V", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 41, - }, - "response_header": Object { - "us": 36777, - }, - "total": Object { - "us": 37821, - }, - "validate": Object { - "us": 36818, - }, - "write_request": Object { - "us": 53, - }, - }, - }, - "monitor": Object { - "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 37926, - }, - "id": "0010-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 56, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 890, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0020-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.372Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "X5toHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 54, - }, - "response_header": Object { - "us": 180, - }, - "total": Object { - "us": 555, - }, - "validate": Object { - "us": 234, - }, - "write_request": Object { - "us": 63, - }, - }, - }, - "monitor": Object { - "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 14900, - }, - "id": "0020-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 14294, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 105, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "timestamp": 1568172624744, - }, - Object { - "timestamp": 1568172677247, - }, - Object { - "timestamp": 1568172729750, - }, - Object { - "timestamp": 1568172782253, - }, - Object { - "timestamp": 1568172834756, - }, - Object { - "down": 1, - "timestamp": 1568172887259, - }, - Object { - "timestamp": 1568172939762, - }, - Object { - "down": 1, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 1, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0030-intermittent", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.373Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "eJtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "500 Internal Server Error", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "500", - "hash": "0604cd3138feed202ef293e062da2f4720f77a05d25ee036a7a01c9cfcdd1f0a", - }, - "status_code": 500, - }, - "rtt": Object { - "content": Object { - "us": 28, - }, - "response_header": Object { - "us": 197, - }, - "total": Object { - "us": 17068, - }, - "validate": Object { - "us": 225, - }, - "write_request": Object { - "us": 58, - }, - }, - }, - "monitor": Object { - "check_group": "d771299d-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 17146, - }, - "id": "0030-intermittent", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 33, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 16662, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.373Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.373Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x5,500x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x5,500x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0040-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.372Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "eZtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 29, - }, - "response_header": Object { - "us": 172, - }, - "total": Object { - "us": 18023, - }, - "validate": Object { - "us": 201, - }, - "write_request": Object { - "us": 28, - }, - }, - }, - "monitor": Object { - "check_group": "d76f5490-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 18106, - }, - "id": "0040-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 39, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 17766, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.372Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0050-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.386Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "dJtoHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 36, - }, - "response_header": Object { - "us": 213, - }, - "total": Object { - "us": 1011, - }, - "validate": Object { - "us": 249, - }, - "write_request": Object { - "us": 20, - }, - }, - }, - "monitor": Object { - "check_group": "d76f9a0c-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 4258, - }, - "id": "0050-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 3215, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 84, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.386Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.386Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0070-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.375Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "a5toHm0B0I9WX_CznN-6", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 33, - }, - "response_header": Object { - "us": 190, - }, - "total": Object { - "us": 2015, - }, - "validate": Object { - "us": 223, - }, - "write_request": Object { - "us": 21, - }, - }, - }, - "monitor": Object { - "check_group": "d7712c5a-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 15117, - }, - "id": "0070-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 13061, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 84, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.375Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.375Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - Object { - "histogram": Object { - "points": Array [ - Object { - "down": 1, - "timestamp": 1568172624744, - }, - Object { - "down": 2, - "timestamp": 1568172677247, - }, - Object { - "down": 1, - "timestamp": 1568172729750, - }, - Object { - "down": 2, - "timestamp": 1568172782253, - }, - Object { - "down": 2, - "timestamp": 1568172834756, - }, - Object { - "down": 2, - "timestamp": 1568172887259, - }, - Object { - "down": 1, - "timestamp": 1568172939762, - }, - Object { - "down": 2, - "timestamp": 1568172992265, - }, - Object { - "down": 2, - "timestamp": 1568173044768, - }, - Object { - "down": 2, - "timestamp": 1568173097271, - }, - Object { - "down": 1, - "timestamp": 1568173149774, - }, - Object { - "down": 2, - "timestamp": 1568173202277, - }, - ], - }, - "minInterval": 52503, - "monitor_id": "0080-down", - "state": Object { - "monitor": Object { - "name": "", - }, - "observer": Object { - "geo": Object { - "name": Array [ - "mpls", - ], - }, - }, - "summary": Object { - "down": 1, - "status": "down", - "up": 0, - }, - "summaryPings": Array [ - Object { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": Object { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0", - }, - "docId": "oJtoHm0B0I9WX_CznN_V", - "ecs": Object { - "version": "1.1.0", - }, - "error": Object { - "message": "400 Bad Request", - "type": "validate", - }, - "event": Object { - "dataset": "uptime", - }, - "host": Object { - "name": "avc-x1x", - }, - "http": Object { - "response": Object { - "body": Object { - "bytes": 3, - "content": "400", - "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", - }, - "status_code": 400, - }, - "rtt": Object { - "content": Object { - "us": 34, - }, - "response_header": Object { - "us": 34569, - }, - "total": Object { - "us": 36089, - }, - "validate": Object { - "us": 34604, - }, - "write_request": Object { - "us": 60, - }, - }, - }, - "monitor": Object { - "check_group": "d7715884-d445-11e9-88e3-3e80641b9c71", - "duration": Object { - "us": 36171, - }, - "id": "0080-down", - "ip": "127.0.0.1", - "name": "", - "status": "down", - "type": "http", - }, - "observer": Object { - "geo": Object { - "location": "37.926868, -78.024902", - "name": "mpls", - }, - "hostname": "avc-x1x", - }, - "resolve": Object { - "ip": "127.0.0.1", - "rtt": Object { - "us": 37, - }, - }, - "summary": Object { - "down": 1, - "up": 0, - }, - "tcp": Object { - "rtt": Object { - "connect": Object { - "us": 1033, - }, - }, - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - ], - "timestamp": "2019-09-11T03:40:34.371Z", - "url": Object { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=400x1", - "path": "/pattern", - "port": 5678, - "query": "r=400x1", - "scheme": "http", - }, - }, - }, - ], - "totalSummaryCount": 2000, -} -`; diff --git a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts index 077720ac0588b..08a339ed59326 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/monitor_states_real_data.ts @@ -93,7 +93,7 @@ export default function ({ getService }: FtrProviderContext) { it('will fetch monitor state data for the given down filters', async () => { const statusFilter = 'down'; - const size = 10; + const size = 2; const { body } = await supertest.get( `${API_URLS.MONITOR_LIST}?dateRangeStart=${from}&dateRangeEnd=${to}&statusFilter=${statusFilter}&pageSize=${size}` ); From 118cc486abf478b80b80aca601891d68ed31cf7f Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 12:26:19 +0100 Subject: [PATCH 08/22] UP --- .../monitor_states_real_data.snap | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap new file mode 100644 index 0000000000000..50625683b605d --- /dev/null +++ b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap @@ -0,0 +1,369 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`monitor states endpoint will fetch monitor state data for the given down filters 1`] = ` +Object { + "nextPagePagination": "{\\"cursorDirection\\":\\"AFTER\\",\\"sortOrder\\":\\"ASC\\",\\"cursorKey\\":{\\"monitor_id\\":\\"0020-down\\"}}", + "prevPagePagination": null, + "summaries": Array [ + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0010-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.371Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "rZtoHm0B0I9WX_CznN_V", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 41, + }, + "response_header": Object { + "us": 36777, + }, + "total": Object { + "us": 37821, + }, + "validate": Object { + "us": 36818, + }, + "write_request": Object { + "us": 53, + }, + }, + }, + "monitor": Object { + "check_group": "d76f07d1-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 37926, + }, + "id": "0010-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 56, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 890, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.371Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + Object { + "histogram": Object { + "points": Array [ + Object { + "down": 1, + "timestamp": 1568172624744, + }, + Object { + "down": 2, + "timestamp": 1568172677247, + }, + Object { + "down": 1, + "timestamp": 1568172729750, + }, + Object { + "down": 2, + "timestamp": 1568172782253, + }, + Object { + "down": 2, + "timestamp": 1568172834756, + }, + Object { + "down": 2, + "timestamp": 1568172887259, + }, + Object { + "down": 1, + "timestamp": 1568172939762, + }, + Object { + "down": 2, + "timestamp": 1568172992265, + }, + Object { + "down": 2, + "timestamp": 1568173044768, + }, + Object { + "down": 2, + "timestamp": 1568173097271, + }, + Object { + "down": 1, + "timestamp": 1568173149774, + }, + Object { + "down": 2, + "timestamp": 1568173202277, + }, + ], + }, + "minInterval": 52503, + "monitor_id": "0020-down", + "state": Object { + "monitor": Object { + "name": "", + }, + "observer": Object { + "geo": Object { + "name": Array [ + "mpls", + ], + }, + }, + "summary": Object { + "down": 1, + "status": "down", + "up": 0, + }, + "summaryPings": Array [ + Object { + "@timestamp": "2019-09-11T03:40:34.372Z", + "agent": Object { + "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", + "hostname": "avc-x1x", + "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", + "type": "heartbeat", + "version": "8.0.0", + }, + "docId": "X5toHm0B0I9WX_CznN-6", + "ecs": Object { + "version": "1.1.0", + }, + "error": Object { + "message": "400 Bad Request", + "type": "validate", + }, + "event": Object { + "dataset": "uptime", + }, + "host": Object { + "name": "avc-x1x", + }, + "http": Object { + "response": Object { + "body": Object { + "bytes": 3, + "content": "400", + "hash": "26d228663f13a88592a12d16cf9587caab0388b262d6d9f126ed62f9333aca94", + }, + "status_code": 400, + }, + "rtt": Object { + "content": Object { + "us": 54, + }, + "response_header": Object { + "us": 180, + }, + "total": Object { + "us": 555, + }, + "validate": Object { + "us": 234, + }, + "write_request": Object { + "us": 63, + }, + }, + }, + "monitor": Object { + "check_group": "d7712ecb-d445-11e9-88e3-3e80641b9c71", + "duration": Object { + "us": 14900, + }, + "id": "0020-down", + "ip": "127.0.0.1", + "name": "", + "status": "down", + "type": "http", + }, + "observer": Object { + "geo": Object { + "location": "37.926868, -78.024902", + "name": "mpls", + }, + "hostname": "avc-x1x", + }, + "resolve": Object { + "ip": "127.0.0.1", + "rtt": Object { + "us": 14294, + }, + }, + "summary": Object { + "down": 1, + "up": 0, + }, + "tcp": Object { + "rtt": Object { + "connect": Object { + "us": 105, + }, + }, + }, + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + ], + "timestamp": "2019-09-11T03:40:34.372Z", + "url": Object { + "domain": "localhost", + "full": "http://localhost:5678/pattern?r=400x1", + "path": "/pattern", + "port": 5678, + "query": "r=400x1", + "scheme": "http", + }, + }, + }, + ], + "totalSummaryCount": 2000, +} +`; From 073b2a49b0136d5815f3cbbb35922ca39e4306d0 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 15:32:53 +0100 Subject: [PATCH 09/22] fix type --- .../status_bar/ssl_certificate.tsx | 2 +- .../__snapshots__/monitor_list.test.tsx.snap | 172 ++++++------ .../monitor_list_status_column.test.tsx.snap | 257 ------------------ .../__tests__/monitor_list.test.tsx | 4 +- .../__tests__/monitor_status_column.test.tsx} | 14 +- .../{ => columns}/cert_status_column.tsx | 8 +- .../columns/monitor_status_column.tsx | 190 +++++++++++++ .../overview/monitor_list/monitor_list.tsx | 4 +- .../__tests__/integration_group.test.tsx | 4 +- .../__tests__/monitor_list_drawer.test.tsx | 2 +- .../monitor_list_status_column.tsx | 147 ---------- .../__tests__/get_apm_href.test.ts | 2 +- .../__tests__/get_infra_href.test.ts | 2 +- .../__tests__/get_logging_href.test.ts | 2 +- .../monitor_summary_iterator.test.ts | 2 +- 15 files changed, 301 insertions(+), 511 deletions(-) delete mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list_status_column.test.tsx.snap rename x-pack/plugins/uptime/public/components/overview/monitor_list/{__tests__/monitor_list_status_column.test.tsx => columns/__tests__/monitor_status_column.test.tsx} (94%) rename x-pack/plugins/uptime/public/components/overview/monitor_list/{ => columns}/cert_status_column.tsx (86%) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx delete mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx diff --git a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx b/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx index ffe4f5d759e03..4c0824b5dfa4f 100644 --- a/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx +++ b/x-pack/plugins/uptime/public/components/monitor/status_details/status_bar/ssl_certificate.tsx @@ -11,7 +11,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { Tls, X509Expiry } from '../../../../../common/runtime_types'; import { CERTIFICATES_ROUTE } from '../../../../../common/constants'; import { MonListDescription, MonListTitle } from './status_bar'; -import { CertStatusColumn } from '../../../overview/monitor_list/cert_status_column'; +import { CertStatusColumn } from '../../../overview/monitor_list/columns/cert_status_column'; interface Props { /** diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index afeb3c02dfc01..b9e55b098d7d6 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -820,10 +820,6 @@ exports[`MonitorList component renders loading state 1`] = ` exports[`MonitorList component renders the monitor list 1`] = ` .c3 { - padding-left: 5px; -} - -.c5 { padding-top: 12px; } @@ -837,12 +833,6 @@ exports[`MonitorList component renders the monitor list 1`] = ` position: relative; } -.c4 { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - @media (max-width:574px) { .c2 { min-width: 230px; @@ -966,7 +956,7 @@ exports[`MonitorList component renders the monitor list 1`] = ` @@ -1060,7 +1050,7 @@ exports[`MonitorList component renders the monitor list 1`] = ` data-test-subj="tableHeaderCell_Status alert_5" role="columnheader" scope="col" - style="width:150px" + style="width:100px" >
-
- - -
-
- 5m ago -
-
-
-
-
- in 0/1 Location + +
+
+ in 0/1 Location +
+
+
+ +
+
+ Checked 9:02:03 AM +
+
+
@@ -1179,13 +1174,21 @@ exports[`MonitorList component renders the monitor list 1`] = `
@@ -1203,15 +1206,9 @@ exports[`MonitorList component renders the monitor list 1`] = ` class="euiTableCellContent euiTableCellContent--overflowingContent" > + />
-
- - -
-
- 5m ago -
-
-
-
-
- in 0/1 Location + +
+
+ in 0/1 Location +
+
+
+ +
+
+ Checked 9:02:03 AM +
+
+
@@ -1408,13 +1410,21 @@ exports[`MonitorList component renders the monitor list 1`] = `
@@ -1432,15 +1442,9 @@ exports[`MonitorList component renders the monitor list 1`] = ` class="euiTableCellContent euiTableCellContent--overflowingContent" > + />
-`; - -exports[`MonitorListStatusColumn provides expected tooltip and display times 1`] = ` -
- - - - Up - - - - - - Thu May 09 2019 10:15:11 GMT-0400 - - } - delay="regular" - position="top" - > - - a few seconds ago - - - - - - - - in 0/0 Location - -
-`; - -exports[`MonitorListStatusColumn will display location status 1`] = ` -
- - - - Up - - - - - - Thu May 09 2019 10:15:11 GMT-0400 - - } - delay="regular" - position="top" - > - - a few seconds ago - - - - - - - - in 1/3 Locations - -
-`; - -exports[`MonitorListStatusColumn will render display location status 1`] = ` -.c1 { - padding-left: 5px; -} - -@media (max-width:574px) { - .c0 { - min-width: 230px; - } -} - -
-
-
- - - - Up - - - -
-
- - -
-
- a few seconds ago -
-
-
-
-
-
-
-
- in 1/3 Locations -
-
-`; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx index 8e5ae13836f47..6db9e8a810de6 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx @@ -58,7 +58,7 @@ const testFooPings: Ping[] = [ const testFooSummary: MonitorSummary = { monitor_id: 'foo', state: { - monitor: {}, + monitor: { type: 'http' }, summaryPings: testFooPings, summary: { up: 1, @@ -93,7 +93,7 @@ const testBarPings: Ping[] = [ const testBarSummary: MonitorSummary = { monitor_id: 'bar', state: { - monitor: {}, + monitor: { type: 'http' }, summaryPings: testBarPings, summary: { up: 2, diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx similarity index 94% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx rename to x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx index cc91f9ccc20a6..9a76946a2e8df 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list_status_column.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx @@ -7,9 +7,9 @@ import React from 'react'; import moment from 'moment'; import { renderWithIntl, shallowWithIntl } from '@kbn/test/jest'; -import { getLocationStatus, MonitorListStatusColumn } from '../monitor_list_status_column'; -import { Ping } from '../../../../../common/runtime_types'; -import { STATUS } from '../../../../../common/constants'; +import { Ping } from '../../../../../../common/runtime_types'; +import { STATUS } from '../../../../../../common/constants'; +import { getLocationStatus, MonitorListStatusColumn } from '../monitor_status_column'; describe('MonitorListStatusColumn', () => { beforeAll(() => { @@ -263,19 +263,19 @@ describe('MonitorListStatusColumn', () => { }); it(' will test getLocationStatus location', () => { - let statusMessage = getLocationStatus(summaryPings, STATUS.UP); + let { statusMessage } = getLocationStatus(summaryPings, STATUS.UP); expect(statusMessage).toBe('in 1/3 Locations'); - statusMessage = getLocationStatus(summaryPings, STATUS.DOWN); + statusMessage = getLocationStatus(summaryPings, STATUS.DOWN).statusMessage; expect(statusMessage).toBe('in 2/3 Locations'); - statusMessage = getLocationStatus(upChecks, STATUS.UP); + statusMessage = getLocationStatus(upChecks, STATUS.UP).statusMessage; expect(statusMessage).toBe('in 3/3 Locations'); - statusMessage = getLocationStatus(downChecks, STATUS.UP); + statusMessage = getLocationStatus(downChecks, STATUS.UP).statusMessage; expect(statusMessage).toBe('in 0/3 Locations'); }); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/cert_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx similarity index 86% rename from x-pack/plugins/uptime/public/components/overview/monitor_list/cert_status_column.tsx rename to x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx index 318e18385ba1f..4546eb5add901 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/cert_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx @@ -8,10 +8,10 @@ import React from 'react'; import moment from 'moment'; import styled from 'styled-components'; import { EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'; -import { X509Expiry } from '../../../../common/runtime_types'; -import { useCertStatus } from '../../../hooks'; -import { EXPIRED, EXPIRES, EXPIRES_SOON } from '../../certificates/translations'; -import { CERT_STATUS } from '../../../../common/constants'; +import { X509Expiry } from '../../../../../common/runtime_types'; +import { useCertStatus } from '../../../../hooks'; +import { EXPIRED, EXPIRES, EXPIRES_SOON } from '../../../certificates/translations'; +import { CERT_STATUS } from '../../../../../common/constants'; interface Props { expiry: X509Expiry; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx new file mode 100644 index 0000000000000..f8fa80f9991b4 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -0,0 +1,190 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React, { useContext } from 'react'; +import moment from 'moment'; +import { i18n } from '@kbn/i18n'; +import styled from 'styled-components'; +import { EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiBadge, EuiSpacer } from '@elastic/eui'; +import { parseTimestamp } from '../parse_timestamp'; +import { Ping } from '../../../../../common/runtime_types'; +import { + STATUS, + SHORT_TIMESPAN_LOCALE, + UNNAMED_LOCATION, + SHORT_TS_LOCALE, +} from '../../../../../common/constants'; + +import * as labels from '../translations'; +import { UptimeThemeContext } from '../../../../contexts'; + +interface MonitorListStatusColumnProps { + status: string; + timestamp: string; + summaryPings: Ping[]; +} + +const StatusColumnFlexG = styled(EuiFlexGroup)` + @media (max-width: 574px) { + min-width: 230px; + } +`; + +const getHealthMessage = (status: string): string | null => { + switch (status) { + case STATUS.UP: + return labels.UP; + case STATUS.DOWN: + return labels.DOWN; + default: + return null; + } +}; + +const getShortTimeStamp = (timeStamp: moment.Moment, relative = false) => { + if (relative) { + const prevLocale: string = moment.locale() ?? 'en'; + + const shortLocale = moment.locale(SHORT_TS_LOCALE) === SHORT_TS_LOCALE; + + if (!shortLocale) { + moment.defineLocale(SHORT_TS_LOCALE, SHORT_TIMESPAN_LOCALE); + } + + let shortTimestamp; + if (typeof timeStamp === 'string') { + shortTimestamp = parseTimestamp(timeStamp).fromNow(); + } else { + shortTimestamp = timeStamp.fromNow(); + } + + // Reset it so, it does't impact other part of the app + moment.locale(prevLocale); + return shortTimestamp; + } else { + if (moment().diff(timeStamp, 'd') > 1) { + return timeStamp.format('ll LTS'); + } + return timeStamp.format('LTS'); + } +}; + +export const getLocationStatus = (summaryPings: Ping[], status: string) => { + const upPings: Set = new Set(); + const downPings: Set = new Set(); + + summaryPings.forEach((summaryPing: Ping) => { + const location = summaryPing?.observer?.geo?.name ?? UNNAMED_LOCATION; + + if (summaryPing.monitor.status === STATUS.UP) { + upPings.add(location); + } else if (summaryPing.monitor.status === STATUS.DOWN) { + downPings.add(location); + } + }); + + const upsMessage = + upPings.size > 0 + ? i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage.tooltip.up', { + defaultMessage: 'Up in {locs}', + values: { locs: [...upPings].join(', ') }, + }) + : ''; + + const downMessage = + downPings.size > 0 + ? i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage.tooltip.down', { + defaultMessage: 'Down in {locs}', + values: { locs: [...downPings].join(', ') }, + }) + : ''; + + // if monitor is down in one dns, it will be considered down so removing it from up list + const absUpChecks: Set = new Set([...upPings].filter((item) => !downPings.has(item))); + + const totalLocations = absUpChecks.size + downPings.size; + let statusMessage = ''; + if (status === STATUS.DOWN) { + statusMessage = `${downPings.size}/${totalLocations}`; + } else { + statusMessage = `${absUpChecks.size}/${totalLocations}`; + } + + if (totalLocations > 1) { + return { + statusMessage: i18n.translate( + 'xpack.uptime.monitorList.statusColumn.locStatusMessage.multiple', + { + defaultMessage: 'in {noLoc} Locations', + values: { noLoc: statusMessage }, + } + ), + locTooltip: upsMessage + downMessage, + }; + } + + return { + statusMessage: i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage', { + defaultMessage: 'in {noLoc} Location', + values: { noLoc: statusMessage }, + }), + locTooltip: upsMessage + downMessage, + }; +}; + +export const MonitorListStatusColumn = ({ + status, + summaryPings = [], + timestamp: tsString, +}: MonitorListStatusColumnProps) => { + const timestamp = parseTimestamp(tsString); + + const { + colors: { dangerBehindText }, + } = useContext(UptimeThemeContext); + + const { statusMessage, locTooltip } = getLocationStatus(summaryPings, status); + + return ( +
+ + + + {getHealthMessage(status)} + + + + + + + {locTooltip} + + } + > + + {statusMessage}{' '} + + + + {timestamp.toLocaleString()} + + } + > + + Checked {getShortTimeStamp(timestamp)} + + + +
+ ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index d80b713d6bc34..0db16f603c05c 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -16,7 +16,7 @@ import { import React, { useState } from 'react'; import { HistogramPoint, X509Expiry } from '../../../../common/runtime_types'; import { MonitorSummary } from '../../../../common/runtime_types'; -import { MonitorListStatusColumn } from './monitor_list_status_column'; +import { MonitorListStatusColumn } from './columns/monitor_status_column'; import { ExpandedRowMap } from './types'; import { MonitorBarSeries } from '../../common/charts'; import { OverviewPageLink } from './overview_page_link'; @@ -25,7 +25,7 @@ import { MonitorListPageSizeSelect } from './monitor_list_page_size_select'; import { MonitorListDrawer } from './monitor_list_drawer/list_drawer_container'; import { MonitorListProps } from './monitor_list_container'; import { MonitorList } from '../../../state/reducers/monitor_list'; -import { CertStatusColumn } from './cert_status_column'; +import { CertStatusColumn } from './columns/cert_status_column'; import { MonitorListHeader } from './monitor_list_header'; import { URL_LABEL } from '../../common/translations'; import { EnableMonitorAlert } from './columns/enable_alert'; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx index 3e7860e4e6ab4..62e34354dd356 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/integration_group.test.tsx @@ -17,7 +17,7 @@ describe('IntegrationGroup', () => { monitor_id: '12345', state: { summary: {}, - monitor: {}, + monitor: { type: 'http' }, summaryPings: [], timestamp: '123', url: {}, @@ -48,7 +48,7 @@ describe('IntegrationGroup', () => { state: { timestamp: 'foo', summaryPings: [], - monitor: {}, + monitor: { type: 'http' }, summary: { up: 0, down: 0, diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx index 4e8ffc64cfe92..6da19b2ccc4d2 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/monitor_list_drawer.test.tsx @@ -17,7 +17,7 @@ describe('MonitorListDrawer component', () => { summary = { monitor_id: 'foo', state: { - monitor: {}, + monitor: { type: 'http' }, summaryPings: [ makePing({ docId: 'foo', diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx deleted file mode 100644 index 7d257abae9344..0000000000000 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_status_column.tsx +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import React, { useContext } from 'react'; -import moment from 'moment'; -import { i18n } from '@kbn/i18n'; -import styled from 'styled-components'; -import { EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip, EuiBadge, EuiSpacer } from '@elastic/eui'; -import { parseTimestamp } from './parse_timestamp'; -import { Ping } from '../../../../common/runtime_types'; -import { - STATUS, - SHORT_TIMESPAN_LOCALE, - UNNAMED_LOCATION, - SHORT_TS_LOCALE, -} from '../../../../common/constants'; - -import * as labels from './translations'; -import { UptimeThemeContext } from '../../../contexts'; - -interface MonitorListStatusColumnProps { - status: string; - timestamp: string; - summaryPings: Ping[]; -} - -const PaddedSpan = styled.span` - padding-left: 5px; -`; - -const StatusColumnFlexG = styled(EuiFlexGroup)` - @media (max-width: 574px) { - min-width: 230px; - } -`; - -const getHealthMessage = (status: string): string | null => { - switch (status) { - case STATUS.UP: - return labels.UP; - case STATUS.DOWN: - return labels.DOWN; - default: - return null; - } -}; - -const getRelativeShortTimeStamp = (timeStamp: any) => { - const prevLocale: string = moment.locale() ?? 'en'; - - const shortLocale = moment.locale(SHORT_TS_LOCALE) === SHORT_TS_LOCALE; - - if (!shortLocale) { - moment.defineLocale(SHORT_TS_LOCALE, SHORT_TIMESPAN_LOCALE); - } - - const shortTimestamp = parseTimestamp(timeStamp).fromNow(); - - // Reset it so, it does't impact other part of the app - moment.locale(prevLocale); - return shortTimestamp; -}; - -export const getLocationStatus = (summaryPings: Ping[], status: string) => { - const upPings: Set = new Set(); - const downPings: Set = new Set(); - - summaryPings.forEach((summaryPing: Ping) => { - const location = summaryPing?.observer?.geo?.name ?? UNNAMED_LOCATION; - - if (summaryPing.monitor.status === STATUS.UP) { - upPings.add(location); - } else if (summaryPing.monitor.status === STATUS.DOWN) { - downPings.add(location); - } - }); - - // if monitor is down in one dns, it will be considered down so removing it from up list - const absUpChecks: Set = new Set([...upPings].filter((item) => !downPings.has(item))); - - const totalLocations = absUpChecks.size + downPings.size; - let statusMessage = ''; - if (status === STATUS.DOWN) { - statusMessage = `${downPings.size}/${totalLocations}`; - } else { - statusMessage = `${absUpChecks.size}/${totalLocations}`; - } - - if (totalLocations > 1) { - return i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage.multiple', { - defaultMessage: 'in {noLoc} Locations', - values: { noLoc: statusMessage }, - }); - } - - return i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage', { - defaultMessage: 'in {noLoc} Location', - values: { noLoc: statusMessage }, - }); -}; - -export const MonitorListStatusColumn = ({ - status, - summaryPings = [], - timestamp: tsString, -}: MonitorListStatusColumnProps) => { - const timestamp = parseTimestamp(tsString); - - const { - colors: { dangerBehindText }, - } = useContext(UptimeThemeContext); - - return ( -
- - - - {getHealthMessage(status)} - - - - - - {timestamp.toLocaleString()} - - } - > - - {getRelativeShortTimeStamp(tsString)} - - - - - - - {getLocationStatus(summaryPings, status)} -
- ); -}; diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts index 2444cfbee63d5..bbd389195d9dc 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_apm_href.test.ts @@ -14,7 +14,7 @@ describe('getApmHref', () => { monitor_id: 'foo', state: { summary: {}, - monitor: {}, + monitor: { type: 'http' }, summaryPings: [ makePing({ docId: 'foo', diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts index b1247ad5b8935..44e29c81f43f8 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_infra_href.test.ts @@ -30,7 +30,7 @@ describe('getInfraHref', () => { summaryPings: [ping], summary: {}, url: {}, - monitor: {}, + monitor: { type: 'http' }, timestamp: '123', }, }; diff --git a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts index d2a7a96a8b6f9..ae94e6cadd541 100644 --- a/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts +++ b/x-pack/plugins/uptime/public/lib/helper/observability_integration/__tests__/get_logging_href.test.ts @@ -38,7 +38,7 @@ describe('getLoggingHref', () => { summary: {}, summaryPings: [ping], timestamp: '123', - monitor: {}, + monitor: { type: 'http' }, url: {}, }, }; diff --git a/x-pack/plugins/uptime/server/lib/requests/search/__tests__/monitor_summary_iterator.test.ts b/x-pack/plugins/uptime/server/lib/requests/search/__tests__/monitor_summary_iterator.test.ts index 8ba5be943304c..6705bcac3c0ff 100644 --- a/x-pack/plugins/uptime/server/lib/requests/search/__tests__/monitor_summary_iterator.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/search/__tests__/monitor_summary_iterator.test.ts @@ -98,7 +98,7 @@ const makeMonitorSummaries = (count: number): MonitorSummary[] => { summaries.push({ monitor_id: id, state: { - monitor: {}, + monitor: { type: 'http' }, timestamp: (123 + i).toString(), url: {}, summaryPings: [], From 88f9a126c3354f9d39f8eaf2d273a84c23936caf Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 15:37:38 +0100 Subject: [PATCH 10/22] Snapshots --- .../__snapshots__/monitor_list.test.tsx.snap | 48 ++- .../monitor_status_column.test.tsx.snap | 324 ++++++++++++++++++ .../monitor_list_drawer.test.tsx.snap | 8 +- .../plugins/uptime/public/pages/overview.tsx | 2 - 4 files changed, 364 insertions(+), 18 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/__snapshots__/monitor_status_column.test.tsx.snap diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index b9e55b098d7d6..e3813306f96df 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -199,7 +199,9 @@ exports[`MonitorList component MonitorListPagination component renders the pagin Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 2, "up": 1, @@ -255,7 +257,9 @@ exports[`MonitorList component MonitorListPagination component renders the pagin Object { "monitor_id": "bar", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 2, @@ -507,7 +511,9 @@ exports[`MonitorList component renders error list 1`] = ` Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 2, "up": 1, @@ -563,7 +569,9 @@ exports[`MonitorList component renders error list 1`] = ` Object { "monitor_id": "bar", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 2, @@ -710,7 +718,9 @@ exports[`MonitorList component renders loading state 1`] = ` Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 2, "up": 1, @@ -766,7 +776,9 @@ exports[`MonitorList component renders loading state 1`] = ` Object { "monitor_id": "bar", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 2, @@ -1141,7 +1153,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
- Checked 9:02:03 AM + Checked 9:31:38 AM
@@ -1175,7 +1187,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
@@ -1377,7 +1391,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
- Checked 9:02:03 AM + Checked 9:31:38 AM
@@ -1411,7 +1425,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
@@ -1734,7 +1750,9 @@ exports[`MonitorList component shallow renders the monitor list 1`] = ` Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 2, "up": 1, @@ -1790,7 +1808,9 @@ exports[`MonitorList component shallow renders the monitor list 1`] = ` Object { "monitor_id": "bar", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 2, diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/__snapshots__/monitor_status_column.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/__snapshots__/monitor_status_column.test.tsx.snap new file mode 100644 index 0000000000000..aaa128f5794fc --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/__snapshots__/monitor_status_column.test.tsx.snap @@ -0,0 +1,324 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`MonitorListStatusColumn can handle a non-numeric timestamp value 1`] = ` +
+ + + + Up + + + + + + + + + } + delay="regular" + position="top" + > + + in 0/0 Location + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > + + Checked + Dec 31, 2018 7:00:00 PM + + + +
+`; + +exports[`MonitorListStatusColumn provides expected tooltip and display times 1`] = ` +
+ + + + Up + + + + + + + + + } + delay="regular" + position="top" + > + + in 0/0 Location + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > + + Checked + Dec 31, 1969 7:38:34 PM + + + +
+`; + +exports[`MonitorListStatusColumn will display location status 1`] = ` +
+ + + + Up + + + + + + + Up in BerlinDown in Islamabad, st-paul + + } + delay="regular" + position="top" + > + + in 1/3 Locations + + + + + Thu May 09 2019 10:15:11 GMT-0400 + + } + delay="regular" + position="top" + > + + Checked + Dec 31, 2018 7:00:00 PM + + + +
+`; + +exports[`MonitorListStatusColumn will render display location status 1`] = ` +@media (max-width:574px) { + .c0 { + min-width: 230px; + } +} + +
+
+
+ + + + Up + + + +
+
+
+
+ +
+
+ in 1/3 Locations +
+
+
+ +
+
+ Checked Dec 31, 2018 7:00:00 PM +
+
+
+
+
+`; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_list_drawer.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_list_drawer.test.tsx.snap index e4450e67ae5b3..a07a55df6dbfa 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_list_drawer.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_list_drawer.test.tsx.snap @@ -100,7 +100,9 @@ exports[`MonitorListDrawer component renders a MonitorListDrawer when there are Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 1, @@ -276,7 +278,9 @@ exports[`MonitorListDrawer component renders a MonitorListDrawer when there is o Object { "monitor_id": "foo", "state": Object { - "monitor": Object {}, + "monitor": Object { + "type": "http", + }, "summary": Object { "down": 0, "up": 1, diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/uptime/public/pages/overview.tsx index 4dcf620a3e977..fb7fd46e21c87 100644 --- a/x-pack/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/plugins/uptime/public/pages/overview.tsx @@ -63,8 +63,6 @@ export const OverviewPageComponent = React.memo( dispatch(getMonitorAlertsAction.get()); }, [dispatch]); - const linkParameters = stringifyUrlParams(params, true); - const heading = i18n.translate('xpack.uptime.overviewPage.headerText', { defaultMessage: 'Overview', description: `The text that will be displayed in the app's heading when the Overview page loads.`, From 417b0a40d7396090bc8936d5981c3ce2d9be7310 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 16:02:07 +0100 Subject: [PATCH 11/22] fix tests --- .../__snapshots__/monitor_list.test.tsx.snap | 4 ++-- .../__tests__/monitor_list.test.tsx | 5 +++++ .../uptime/public/lib/helper/test_helpers.ts | 22 +++++++++++++++++++ .../plugins/uptime/public/pages/overview.tsx | 1 - 4 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 x-pack/plugins/uptime/public/lib/helper/test_helpers.ts diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index e3813306f96df..a8c08a9472321 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -1153,7 +1153,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
- Checked 9:31:38 AM + Checked Sept 4, 2020 9:31:38 AM
@@ -1391,7 +1391,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
- Checked 9:31:38 AM + Checked Sept 4, 2020 9:31:38 AM
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx index 6db9e8a810de6..6653a4e7e8b67 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx @@ -18,6 +18,7 @@ import { renderWithRouter, shallowWithRouter } from '../../../../lib'; import * as redux from 'react-redux'; import moment from 'moment'; import { IHttpFetchError } from '../../../../../../../../src/core/public'; +import { mockMoment } from '../../../../lib/helper/testHelpers'; jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { return { @@ -107,6 +108,10 @@ const testBarSummary: MonitorSummary = { describe('MonitorList component', () => { let localStorageMock: any; + beforeAll(() => { + mockMoment(); + }); + const getMonitorList = (timestamp?: string): MonitorSummariesResult => { if (timestamp) { testBarSummary.state.timestamp = timestamp; diff --git a/x-pack/plugins/uptime/public/lib/helper/test_helpers.ts b/x-pack/plugins/uptime/public/lib/helper/test_helpers.ts new file mode 100644 index 0000000000000..d18f2aa2a4e78 --- /dev/null +++ b/x-pack/plugins/uptime/public/lib/helper/test_helpers.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +/* global jest */ + +import moment from 'moment'; +import { Moment } from 'moment-timezone'; + +export function mockMoment() { + // avoid timezone issues + jest.spyOn(moment.prototype, 'format').mockImplementation(function (this: Moment) { + return `Sept 4, 2020 9:31:38 AM`; + }); + + // convert relative time to absolute time to avoid timing issues + jest.spyOn(moment.prototype, 'fromNow').mockImplementation(function (this: Moment) { + return `15 minutes ago`; + }); +} diff --git a/x-pack/plugins/uptime/public/pages/overview.tsx b/x-pack/plugins/uptime/public/pages/overview.tsx index fb7fd46e21c87..e2b8e911b5a88 100644 --- a/x-pack/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/plugins/uptime/public/pages/overview.tsx @@ -10,7 +10,6 @@ import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; import { useDispatch } from 'react-redux'; import { useGetUrlParams } from '../hooks'; -import { stringifyUrlParams } from '../lib/helper/stringify_url_params'; import { PageHeader } from './page_header'; import { IIndexPattern } from '../../../../../src/plugins/data/public'; import { useUpdateKueryString } from '../hooks'; From 88c62a2854bbb0e55cf74fa7574ff1b00d044309 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 16:48:52 +0100 Subject: [PATCH 12/22] update i18n --- x-pack/plugins/translations/translations/ja-JP.json | 2 -- x-pack/plugins/translations/translations/zh-CN.json | 2 -- 2 files changed, 4 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index ba6ac32f2e3d0..a3919dc5d4dc1 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -20735,8 +20735,6 @@ "xpack.uptime.monitorList.defineConnector.description": "アラートを有効にするには、デフォルトのアラートアクションコネクターを定義してください。", "xpack.uptime.monitorList.disableDownAlert": "ステータスアラートを無効にする", "xpack.uptime.monitorList.downLineSeries.downLabel": "ダウン", - "xpack.uptime.monitorList.drawer.locations.statusDown": "{locations}でダウン", - "xpack.uptime.monitorList.drawer.locations.statusUp": "{locations}でアップ", "xpack.uptime.monitorList.drawer.missingLocation": "一部のHeartbeatインスタンスには位置情報が定義されていません。Heartbeat構成への{link}。", "xpack.uptime.monitorList.enabledAlerts.noAlert": "このモニターではアラートが有効ではありません。", "xpack.uptime.monitorList.enabledAlerts.title": "有効なアラート:", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 822ccf5cc8409..a3cf16ae48c47 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -20755,8 +20755,6 @@ "xpack.uptime.monitorList.defineConnector.description": "要开始启用告警,请在以下位置定义默认告警操作连接器", "xpack.uptime.monitorList.disableDownAlert": "禁用状态告警", "xpack.uptime.monitorList.downLineSeries.downLabel": "关闭", - "xpack.uptime.monitorList.drawer.locations.statusDown": "在 {locations} 已关闭", - "xpack.uptime.monitorList.drawer.locations.statusUp": "在 {locations} 正运行", "xpack.uptime.monitorList.drawer.missingLocation": "某些 Heartbeat 实例未定义位置。{link}到您的 Heartbeat 配置。", "xpack.uptime.monitorList.enabledAlerts.noAlert": "没有为此监测启用告警。", "xpack.uptime.monitorList.enabledAlerts.title": "已启用的告警:", From 61454626de47b43f8083607f76d2ce742eb6a921 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 19:54:02 +0100 Subject: [PATCH 13/22] fix type --- .../overview/monitor_list/__tests__/monitor_list.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx index 6653a4e7e8b67..344ed167904f6 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/monitor_list.test.tsx @@ -18,7 +18,7 @@ import { renderWithRouter, shallowWithRouter } from '../../../../lib'; import * as redux from 'react-redux'; import moment from 'moment'; import { IHttpFetchError } from '../../../../../../../../src/core/public'; -import { mockMoment } from '../../../../lib/helper/testHelpers'; +import { mockMoment } from '../../../../lib/helper/test_helpers'; jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => { return { From dd2a31c7d210ac5e18a05e971d56d63bba29c3d8 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Mon, 16 Nov 2020 20:05:39 +0100 Subject: [PATCH 14/22] fix test --- .../uptime/rest/__snapshots__/monitor_states_real_data.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap index 50625683b605d..93abfaf67a009 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap +++ b/x-pack/test/api_integration/apis/uptime/rest/__snapshots__/monitor_states_real_data.snap @@ -63,6 +63,7 @@ Object { "state": Object { "monitor": Object { "name": "", + "type": "http", }, "observer": Object { "geo": Object { @@ -242,6 +243,7 @@ Object { "state": Object { "monitor": Object { "name": "", + "type": "http", }, "observer": Object { "geo": Object { From 4f117244b0b35d9dfc08b443ac366ef9c49d3b72 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Tue, 17 Nov 2020 11:52:53 +0100 Subject: [PATCH 15/22] PR feedback --- .../overview/monitor_list/columns/monitor_status_column.tsx | 6 +++--- .../monitor_list/monitor_list_drawer/monitor_status_row.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx index f8fa80f9991b4..e34aeb08d2fe5 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -118,7 +118,7 @@ export const getLocationStatus = (summaryPings: Ping[], status: string) => { statusMessage: i18n.translate( 'xpack.uptime.monitorList.statusColumn.locStatusMessage.multiple', { - defaultMessage: 'in {noLoc} Locations', + defaultMessage: 'in {noLoc} locations', values: { noLoc: statusMessage }, } ), @@ -128,7 +128,7 @@ export const getLocationStatus = (summaryPings: Ping[], status: string) => { return { statusMessage: i18n.translate('xpack.uptime.monitorList.statusColumn.locStatusMessage', { - defaultMessage: 'in {noLoc} Location', + defaultMessage: 'in {noLoc} location', values: { noLoc: statusMessage }, }), locTooltip: upsMessage + downMessage, @@ -176,7 +176,7 @@ export const MonitorListStatusColumn = ({ - {timestamp.toLocaleString()} + {timestamp.toLocaleString()}, } > diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx index 458303e704ee0..95997131e4ca7 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx @@ -37,7 +37,7 @@ export const MonitorStatusRow = ({ locationNames, status }: MonitorStatusRowProp return ( {status} - + {locations} From c56318a409f5ca4bec5a65fe6f9a7b9f32c84d11 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Tue, 17 Nov 2020 16:14:48 +0100 Subject: [PATCH 16/22] PR feedback --- .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - .../__snapshots__/monitor_list.test.tsx.snap | 6 +- .../monitor_status_column.test.tsx.snap | 14 ++--- .../__tests__/monitor_status_column.test.tsx | 8 +-- .../monitor_list/columns/monitor_name_col.tsx | 1 + .../columns/monitor_status_column.tsx | 6 +- .../monitor_status_list.test.tsx.snap | 12 ++++ .../monitor_status_row.test.tsx.snap | 12 ++-- .../most_recent_error.test.tsx.snap | 44 +++++++------- .../monitor_list_drawer/enabled_alerts.tsx | 58 ++++++++++++------- .../monitor_list_drawer.tsx | 31 +++------- .../monitor_status_list.tsx | 16 ++--- .../monitor_status_row.tsx | 9 +-- .../monitor_list_drawer/monitor_url.tsx | 34 +++++++++++ .../monitor_list_drawer/most_recent_error.tsx | 36 ++++++------ .../monitor_list_drawer/most_recent_run.tsx | 34 +++++++++++ 17 files changed, 196 insertions(+), 127 deletions(-) create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx create mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index d7b0aba2061bd..3c20835c33429 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -20722,7 +20722,6 @@ "xpack.uptime.monitorList.downLineSeries.downLabel": "ダウン", "xpack.uptime.monitorList.drawer.missingLocation": "一部のHeartbeatインスタンスには位置情報が定義されていません。Heartbeat構成への{link}。", "xpack.uptime.monitorList.enabledAlerts.noAlert": "このモニターではアラートが有効ではありません。", - "xpack.uptime.monitorList.enabledAlerts.title": "有効なアラート:", "xpack.uptime.monitorList.enableDownAlert": "ステータスアラートを有効にする", "xpack.uptime.monitorList.expandDrawerButton.ariaLabel": "ID {id}のモニターの行を展開", "xpack.uptime.monitorList.geoName.helpLinkAnnotation": "場所を追加", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 7a3cffe3fcdba..157441f194914 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -20742,7 +20742,6 @@ "xpack.uptime.monitorList.downLineSeries.downLabel": "关闭", "xpack.uptime.monitorList.drawer.missingLocation": "某些 Heartbeat 实例未定义位置。{link}到您的 Heartbeat 配置。", "xpack.uptime.monitorList.enabledAlerts.noAlert": "没有为此监测启用告警。", - "xpack.uptime.monitorList.enabledAlerts.title": "已启用的告警:", "xpack.uptime.monitorList.enableDownAlert": "启用状态告警", "xpack.uptime.monitorList.expandDrawerButton.ariaLabel": "展开 ID {id} 的监测行", "xpack.uptime.monitorList.geoName.helpLinkAnnotation": "添加位置", diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index a8c08a9472321..4fbcd429c8086 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -1140,7 +1140,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
- in 0/1 Location + in 0/1 location,
@@ -1187,6 +1187,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
@@ -1425,6 +1426,7 @@ exports[`MonitorList component renders the monitor list 1`] = `
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx index 9a76946a2e8df..13aa341fa3fa1 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/__tests__/monitor_status_column.test.tsx @@ -265,18 +265,18 @@ describe('MonitorListStatusColumn', () => { it(' will test getLocationStatus location', () => { let { statusMessage } = getLocationStatus(summaryPings, STATUS.UP); - expect(statusMessage).toBe('in 1/3 Locations'); + expect(statusMessage).toBe('in 1/3 locations'); statusMessage = getLocationStatus(summaryPings, STATUS.DOWN).statusMessage; - expect(statusMessage).toBe('in 2/3 Locations'); + expect(statusMessage).toBe('in 2/3 locations'); statusMessage = getLocationStatus(upChecks, STATUS.UP).statusMessage; - expect(statusMessage).toBe('in 3/3 Locations'); + expect(statusMessage).toBe('in 3/3 locations'); statusMessage = getLocationStatus(downChecks, STATUS.UP).statusMessage; - expect(statusMessage).toBe('in 0/3 Locations'); + expect(statusMessage).toBe('in 0/3 locations'); }); }); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx index c7566269f331f..9c744e5221d31 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_name_col.tsx @@ -68,6 +68,7 @@ export const MonitorNameColumn = ({ summary }: Props) => { }} size="xs" flush="left" + style={{ border: 'none' }} > {MONITOR_TYPES[summary.state.monitor.type]} diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx index e34aeb08d2fe5..c71efcdf04ee8 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -33,7 +33,7 @@ const StatusColumnFlexG = styled(EuiFlexGroup)` } `; -const getHealthMessage = (status: string): string | null => { +export const getHealthMessage = (status: string): string | null => { switch (status) { case STATUS.UP: return labels.UP; @@ -170,13 +170,13 @@ export const MonitorListStatusColumn = ({ } > - {statusMessage}{' '} + {statusMessage},
- {timestamp.toLocaleString()}, + {timestamp.toLocaleString()} } > diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap index a9880339f7973..1b5562cdd87ab 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/__tests__/__snapshots__/monitor_status_list.test.tsx.snap @@ -19,6 +19,12 @@ exports[`MonitorStatusList component renders checks 1`] = ` status="down" /> + + + + + + - Down - + /> Berlin, Islamabad, London - Up - + /> Berlin, Islamabad, London , -
+
-

- Most recent error (5 days ago) -

-
, -
, - , -] + + Get https://expired.badssl.com: x509: certificate has expired or is not yet valid + + + + `; exports[`MostRecentError component validates props with shallow render 1`] = ` diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx index d869c6d78ec11..b39162b70eda4 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/enabled_alerts.tsx @@ -5,9 +5,17 @@ */ import React, { useContext } from 'react'; -import { EuiCallOut, EuiListGroup, EuiLoadingSpinner, EuiSpacer, EuiText } from '@elastic/eui'; +import { + EuiCallOut, + EuiDescriptionList, + EuiDescriptionListDescription, + EuiDescriptionListTitle, + EuiListGroup, + EuiLoadingSpinner, +} from '@elastic/eui'; import { EuiListGroupItemProps } from '@elastic/eui/src/components/list_group/list_group_item'; import { i18n } from '@kbn/i18n'; +import styled from 'styled-components'; import { UptimeSettingsContext } from '../../../../contexts'; import { Alert } from '../../../../../../triggers_actions_ui/public'; @@ -16,6 +24,15 @@ interface Props { loading: boolean; } +const LinkGroupList = styled(EuiListGroup)` + &&& { + a { + padding-left: 0; + padding-top: 0; + } + } +`; + export const EnabledAlerts = ({ monitorAlerts, loading }: Props) => { const { basePath } = useContext(UptimeSettingsContext); @@ -31,27 +48,24 @@ export const EnabledAlerts = ({ monitorAlerts, loading }: Props) => { }); return ( - <> - - - -

- {i18n.translate('xpack.uptime.monitorList.enabledAlerts.title', { - defaultMessage: 'Enabled alerts:', - description: 'Alerts enabled for this monitor', + + + {i18n.translate('xpack.uptime.monitorList.enabledAlerts.title', { + defaultMessage: 'Enabled alerts', + description: 'Alerts enabled for this monitor', + })} + + + {listItems.length === 0 && !loading && ( + - - - {listItems.length === 0 && !loading && ( - - )} - {loading ? : } - + /> + )} + {loading ? : } + + ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx index 015bed96f71e0..ca7a608986e85 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_list_drawer.tsx @@ -6,15 +6,15 @@ import React from 'react'; import styled from 'styled-components'; -import moment from 'moment'; -import { EuiLink, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui'; -import { i18n } from '@kbn/i18n'; +import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { Alert } from '../../../../../../triggers_actions_ui/public'; import { MostRecentError } from './most_recent_error'; import { MonitorStatusList } from './monitor_status_list'; import { MonitorDetails, MonitorSummary } from '../../../../../common/runtime_types'; import { ActionsPopover } from './actions_popover/actions_popover_container'; import { EnabledAlerts } from './enabled_alerts'; +import { MonitorUrl } from './monitor_url'; +import { MostRecentRun } from './most_recent_run'; const ContainerDiv = styled.div` padding: 10px; @@ -51,29 +51,11 @@ export function MonitorListDrawerComponent({ - -

- {i18n.translate('xpack.uptime.monitorList.drawer.url', { - defaultMessage: 'Url', - })} -

-
- - - {monitorUrl} - - +
- -

- {i18n.translate('xpack.uptime.monitorList.drawer.mostRecentRun', { - defaultMessage: 'Most recent test run', - })} -

-
+ {/* TODO: add link to details page */} - {moment(summary.state.timestamp).format('LLL').toString()}
@@ -81,8 +63,11 @@ export function MonitorListDrawerComponent({ + + + {monitorDetails && monitorDetails.error && ( { return ( <> - {downChecks.size > 0 && ( - - - - )} - {absUpChecks.size > 0 && ( - - - - )} + + + + + + {(downChecks.has(UNNAMED_LOCATION) || upChecks.has(UNNAMED_LOCATION)) && ( <> diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx index 95997131e4ca7..5bcb4ef97c3a4 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_status_row.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { EuiBadge, EuiSpacer } from '@elastic/eui'; import { UNNAMED_LOCATION, STATUS } from '../../../../../common/constants'; +import { getHealthMessage } from '../columns/monitor_status_column'; interface MonitorStatusRowProps { /** @@ -29,16 +30,12 @@ export const MonitorStatusRow = ({ locationNames, status }: MonitorStatusRowProp checkListArray.push(UNNAMED_LOCATION); } - if (locationNames.size === 0) { - return null; - } - const locations = checkListArray.join(', '); return ( - {status} + {getHealthMessage(status)} - {locations} + {locations || '--'} ); diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx new file mode 100644 index 0000000000000..d988f5a582495 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/monitor_url.tsx @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import React from 'react'; +import { i18n } from '@kbn/i18n'; +import { + EuiLink, + EuiDescriptionList, + EuiDescriptionListDescription, + EuiDescriptionListTitle, +} from '@elastic/eui'; + +interface Props { + monitorUrl: string; +} +export const MonitorUrl = ({ monitorUrl }: Props) => { + return ( + + + {i18n.translate('xpack.uptime.monitorList.drawer.url', { + defaultMessage: 'Url', + })} + + + + {monitorUrl} + + + + ); +}; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx index 62f2f811aad98..0b9049f57e43b 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_error.tsx @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ import React from 'react'; -import { EuiText, EuiSpacer } from '@elastic/eui'; +import { + EuiDescriptionList, + EuiDescriptionListTitle, + EuiDescriptionListDescription, +} from '@elastic/eui'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; import { MonitorPageLink } from '../../../common/monitor_page_link'; @@ -37,21 +41,19 @@ export const MostRecentError = ({ error, monitorId, timestamp }: MostRecentError const timestampStr = timestamp ? moment(new Date(timestamp).valueOf()).fromNow() : ''; return ( - <> - - -

- {i18n.translate('xpack.uptime.monitorList.mostRecentError.title', { - defaultMessage: 'Most recent error ({timestamp})', - values: { timestamp: timestampStr }, - description: 'Most Recent Error title in Monitor List Expanded row', - })} -

-
- - - {error?.message} - - + + + {i18n.translate('xpack.uptime.monitorList.mostRecentError.title', { + defaultMessage: 'Most recent error ({timestamp})', + values: { timestamp: timestampStr }, + description: 'Most Recent Error title in Monitor List Expanded row', + })} + + + + {error?.message} + + + ); }; diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx new file mode 100644 index 0000000000000..cd9108a36f332 --- /dev/null +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list_drawer/most_recent_run.tsx @@ -0,0 +1,34 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +import React from 'react'; +import { + EuiDescriptionList, + EuiDescriptionListTitle, + EuiDescriptionListDescription, + EuiText, +} from '@elastic/eui'; +import moment from 'moment'; +import { i18n } from '@kbn/i18n'; +import { MonitorSummary } from '../../../../../common/runtime_types'; + +interface Props { + summary: MonitorSummary; +} + +export const MostRecentRun = ({ summary }: Props) => { + return ( + + + {i18n.translate('xpack.uptime.monitorList.drawer.mostRecentRun', { + defaultMessage: 'Most recent test run', + })} + + + {moment(summary.state.timestamp).format('LLL').toString()} + + + ); +}; From b6b1f20a282b701d021cd42f8fc2acb0c7847eca Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 18 Nov 2020 14:27:31 +0100 Subject: [PATCH 17/22] center align status badge --- .../__snapshots__/monitor_list.test.tsx.snap | 8 +++---- .../monitor_status_column.test.tsx.snap | 22 +++++-------------- .../columns/cert_status_column.tsx | 10 +++++++-- .../columns/monitor_status_column.tsx | 4 ++-- 4 files changed, 19 insertions(+), 25 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index aff4e8b3c1143..f055b56fc37c2 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -1115,8 +1115,8 @@ exports[`MonitorList component renders the monitor list 1`] = ` style="flex-basis:40px" > Up @@ -102,12 +98,8 @@ exports[`MonitorListStatusColumn provides expected tooltip and display times 1`] } > Up @@ -187,12 +179,8 @@ exports[`MonitorListStatusColumn will display location status 1`] = ` } > Up @@ -271,8 +259,8 @@ exports[`MonitorListStatusColumn will render display location status 1`] = ` style="flex-basis:40px" > = ({ expiry, boldStyle = false }) const notAfter = expiry?.not_after; const certStatus = useCertStatus(notAfter); - const relativeDate = moment(notAfter).fromNow(); + const relativeDate = getShortTimeStamp(moment(notAfter), true); const CertStatus = ({ color, text }: { color: string; text: string }) => { return ( diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx index c71efcdf04ee8..f397ab84d96cf 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -44,7 +44,7 @@ export const getHealthMessage = (status: string): string | null => { } }; -const getShortTimeStamp = (timeStamp: moment.Moment, relative = false) => { +export const getShortTimeStamp = (timeStamp: moment.Moment, relative = false) => { if (relative) { const prevLocale: string = moment.locale() ?? 'en'; @@ -153,8 +153,8 @@ export const MonitorListStatusColumn = ({ {getHealthMessage(status)} From 5d1deae4b68a72d3027311216814ee084cb1a255 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 18 Nov 2020 15:24:22 +0100 Subject: [PATCH 18/22] fix types --- .../monitor_list/columns/cert_status_column.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx index 0676d7586f4e6..4546eb5add901 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/cert_status_column.tsx @@ -11,13 +11,7 @@ import { EuiIcon, EuiText, EuiToolTip } from '@elastic/eui'; import { X509Expiry } from '../../../../../common/runtime_types'; import { useCertStatus } from '../../../../hooks'; import { EXPIRED, EXPIRES, EXPIRES_SOON } from '../../../certificates/translations'; -import { - CERT_STATUS, - SHORT_TIMESPAN_LOCALE, - SHORT_TS_LOCALE, -} from '../../../../../common/constants'; -import { parseTimestamp } from '../parse_timestamp'; -import { getShortTimeStamp } from './monitor_status_column'; +import { CERT_STATUS } from '../../../../../common/constants'; interface Props { expiry: X509Expiry; @@ -41,7 +35,7 @@ export const CertStatusColumn: React.FC = ({ expiry, boldStyle = false }) const notAfter = expiry?.not_after; const certStatus = useCertStatus(notAfter); - const relativeDate = getShortTimeStamp(moment(notAfter), true); + const relativeDate = moment(notAfter).fromNow(); const CertStatus = ({ color, text }: { color: string; text: string }) => { return ( From a6b7a47c4ef31dc41a1423598888aaf89818fd1d Mon Sep 17 00:00:00 2001 From: Shahzad Date: Wed, 25 Nov 2020 12:33:19 +0100 Subject: [PATCH 19/22] fix table exapnd arrow alignment --- .../public/components/overview/monitor_list/monitor_list.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx index 0db16f603c05c..1732602b39d8d 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/monitor_list.tsx @@ -101,7 +101,7 @@ export const MonitorListComponent: ({ align: 'left' as const, field: 'state.url.full', name: URL_LABEL, - truncate: true, + width: '40%', render: (url: string) => ( {url} @@ -143,7 +143,7 @@ export const MonitorListComponent: ({ name: '', sortable: true, isExpander: true, - width: '24px', + width: '40px', render: (id: string) => { return ( Date: Wed, 25 Nov 2020 12:43:43 +0100 Subject: [PATCH 20/22] update snaps --- .../__tests__/__snapshots__/monitor_list.test.tsx.snap | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index f055b56fc37c2..c14dda8cd63c0 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -1014,6 +1014,7 @@ exports[`MonitorList component renders the monitor list 1`] = ` data-test-subj="tableHeaderCell_state.url.full_2" role="columnheader" scope="col" + style="width:40%" >

Date: Thu, 26 Nov 2020 17:49:25 +0100 Subject: [PATCH 21/22] PR feedback --- .../plugins/uptime/public/apps/uptime_app.tsx | 39 ++++++++++--------- .../monitor_list/columns/filter_label.tsx | 5 --- .../columns/monitor_status_column.tsx | 9 ++++- 3 files changed, 28 insertions(+), 25 deletions(-) delete mode 100644 x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx diff --git a/x-pack/plugins/uptime/public/apps/uptime_app.tsx b/x-pack/plugins/uptime/public/apps/uptime_app.tsx index 2948755c58b41..9535cfdb8c8b0 100644 --- a/x-pack/plugins/uptime/public/apps/uptime_app.tsx +++ b/x-pack/plugins/uptime/public/apps/uptime_app.tsx @@ -32,6 +32,7 @@ import { import { store } from '../state'; import { kibanaService } from '../state/kibana_service'; import { ScopedHistory } from '../../../../../src/core/public'; +import { EuiThemeProvider } from '../../../observability/public'; export interface UptimeAppColors { danger: string; @@ -104,24 +105,26 @@ const Application = (props: UptimeAppProps) => { services={{ ...core, ...plugins, triggersActionsUi: startPlugins.triggersActionsUi }} > - - - - - - - -
- - -
-
-
-
-
-
-
-
+ + + + + + + + +
+ + +
+
+
+
+
+
+
+
+
diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx deleted file mode 100644 index 41bc2aa258807..0000000000000 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/filter_label.tsx +++ /dev/null @@ -1,5 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx index f397ab84d96cf..5b76e6c5e371f 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/columns/monitor_status_column.tsx @@ -20,6 +20,7 @@ import { import * as labels from '../translations'; import { UptimeThemeContext } from '../../../../contexts'; +import { euiStyled } from '../../../../../../observability/public'; interface MonitorListStatusColumnProps { status: string; @@ -169,9 +170,9 @@ export const MonitorListStatusColumn = ({ } > - + {statusMessage}, - + ); }; + +const PaddedText = euiStyled(EuiText)` + padding-right: ${(props) => props.theme.eui.paddingSizes.xs}; +`; From 825535ba6f2f50911d1457a610c4b0fc77fa74e5 Mon Sep 17 00:00:00 2001 From: Shahzad Date: Thu, 26 Nov 2020 17:57:48 +0100 Subject: [PATCH 22/22] update snaps --- .../__snapshots__/monitor_list.test.tsx.snap | 14 ++++---- .../__tests__/monitor_list.test.tsx | 19 ++++++----- .../monitor_status_column.test.tsx.snap | 34 ++++++------------- .../__tests__/monitor_status_column.test.tsx | 13 ++++--- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap index c14dda8cd63c0..edd901253f509 100644 --- a/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap +++ b/x-pack/plugins/uptime/public/components/overview/monitor_list/__tests__/__snapshots__/monitor_list.test.tsx.snap @@ -832,6 +832,10 @@ exports[`MonitorList component renders loading state 1`] = ` exports[`MonitorList component renders the monitor list 1`] = ` .c3 { + padding-right: 4px; +} + +.c4 { padding-top: 12px; } @@ -1135,8 +1139,7 @@ exports[`MonitorList component renders the monitor list 1`] = ` class="euiToolTipAnchor" >