diff --git a/x-pack/legacy/plugins/uptime/common/constants/rest_api.ts b/x-pack/legacy/plugins/uptime/common/constants/rest_api.ts index 7fafe6584d8313..86e2b03e13f22c 100644 --- a/x-pack/legacy/plugins/uptime/common/constants/rest_api.ts +++ b/x-pack/legacy/plugins/uptime/common/constants/rest_api.ts @@ -10,7 +10,6 @@ export enum API_URLS { MONITOR_LOCATIONS = `/api/uptime/monitor/locations`, MONITOR_DURATION = `/api/uptime/monitor/duration`, MONITOR_DETAILS = `/api/uptime/monitor/details`, - MONITOR_SELECTED = `/api/uptime/monitor/selected`, MONITOR_STATUS = `/api/uptime/monitor/status`, PINGS = '/api/uptime/pings', PING_HISTOGRAM = `/api/uptime/ping/histogram`, diff --git a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx index 9e7834ae6f242e..dd6f7a89cf9a33 100644 --- a/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/connected/monitor/status_bar_container.tsx @@ -8,9 +8,9 @@ import React, { useContext, useEffect } from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; import { AppState } from '../../../state'; -import { monitorLocationsSelector, selectMonitorStatus } from '../../../state/selectors'; +import { monitorLocationsSelector, monitorStatusSelector } from '../../../state/selectors'; import { MonitorStatusBarComponent } from '../../functional/monitor_status_details/monitor_status_bar'; -import { getMonitorStatusAction, getSelectedMonitorAction } from '../../../state/actions'; +import { getMonitorStatusAction } from '../../../state/actions'; import { useUrlParams } from '../../../hooks'; import { Ping } from '../../../../common/graphql/types'; import { MonitorLocations } from '../../../../common/runtime_types/monitor'; @@ -23,7 +23,6 @@ interface StateProps { interface DispatchProps { loadMonitorStatus: typeof getMonitorStatusAction; - loadSelectedMonitor: typeof getSelectedMonitorAction; } interface OwnProps { @@ -34,7 +33,6 @@ type Props = OwnProps & StateProps & DispatchProps; const Container: React.FC = ({ loadMonitorStatus, - loadSelectedMonitor, monitorId, monitorStatus, monitorLocations, @@ -46,8 +44,7 @@ const Container: React.FC = ({ useEffect(() => { loadMonitorStatus({ dateStart, dateEnd, monitorId }); - loadSelectedMonitor({ monitorId }); - }, [monitorId, dateStart, dateEnd, loadMonitorStatus, lastRefresh, loadSelectedMonitor]); + }, [monitorId, dateStart, dateEnd, loadMonitorStatus, lastRefresh]); return ( = ({ }; const mapStateToProps = (state: AppState, ownProps: OwnProps) => ({ - monitorStatus: selectMonitorStatus(state), + monitorStatus: monitorStatusSelector(state), monitorLocations: monitorLocationsSelector(state, ownProps.monitorId), }); const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ - loadSelectedMonitor: params => dispatch(getSelectedMonitorAction(params)), loadMonitorStatus: params => dispatch(getMonitorStatusAction(params)), }); diff --git a/x-pack/legacy/plugins/uptime/public/pages/__tests__/__snapshots__/monitor.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/pages/__tests__/__snapshots__/monitor.test.tsx.snap index f637af397bbeb5..6064caa868bf82 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/__tests__/__snapshots__/monitor.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/pages/__tests__/__snapshots__/monitor.test.tsx.snap @@ -51,6 +51,6 @@ exports[`MonitorPage shallow renders expected elements for valid props 1`] = ` } } > - + `; diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 3de636cac6ecd8..21124b7323d680 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -5,45 +5,23 @@ */ import { EuiSpacer } from '@elastic/eui'; -import React, { useContext, useState, useEffect } from 'react'; +import React, { useContext, useState } from 'react'; import { useParams } from 'react-router-dom'; -import { connect, MapDispatchToPropsFunction, MapStateToPropsParam } from 'react-redux'; +import { useSelector } from 'react-redux'; import { MonitorCharts, PingList } from '../components/functional'; import { UptimeRefreshContext } from '../contexts'; import { useUptimeTelemetry, useUrlParams, UptimePage } from '../hooks'; import { useTrackPageview } from '../../../../../plugins/observability/public'; import { MonitorStatusDetails } from '../components/connected'; -import { Ping } from '../../common/graphql/types'; -import { AppState } from '../state'; -import { selectSelectedMonitor } from '../state/selectors'; -import { getSelectedMonitorAction } from '../state/actions'; +import { monitorStatusSelector } from '../state/selectors'; import { PageHeader } from './page_header'; import { useBreadcrumbs } from '../hooks/use_breadcrumbs'; -interface StateProps { - selectedMonitor: Ping | null; -} - -interface DispatchProps { - dispatchGetMonitorStatus: (monitorId: string) => void; -} - -type Props = StateProps & DispatchProps; - -export const MonitorPageComponent: React.FC = ({ - selectedMonitor, - dispatchGetMonitorStatus, -}: Props) => { +export const MonitorPage: React.FC = () => { // decode 64 base string, it was decoded to make it a valid url, since monitor id can be a url let { monitorId } = useParams(); monitorId = atob(monitorId || ''); - useEffect(() => { - if (monitorId) { - dispatchGetMonitorStatus(monitorId); - } - }, [dispatchGetMonitorStatus, monitorId]); - const [pingListPageCount, setPingListPageCount] = useState(10); const { refreshApp } = useContext(UptimeRefreshContext); const [getUrlParams, updateUrlParams] = useUrlParams(); @@ -53,11 +31,13 @@ export const MonitorPageComponent: React.FC = ({ const [selectedLocation, setSelectedLocation] = useState(undefined); const [pingListIndex, setPingListIndex] = useState(0); + const selectedMonitor = useSelector(monitorStatusSelector); + const sharedVariables = { dateRangeStart, dateRangeEnd, - location: selectedLocation, monitorId, + location: selectedLocation, }; useUptimeTelemetry(UptimePage.Monitor); @@ -65,7 +45,7 @@ export const MonitorPageComponent: React.FC = ({ useTrackPageview({ app: 'uptime', path: 'monitor' }); useTrackPageview({ app: 'uptime', path: 'monitor', delay: 15000 }); - const nameOrId = selectedMonitor?.monitor?.name || selectedMonitor?.monitor?.id || ''; + const nameOrId = selectedMonitor?.monitor?.name || monitorId || ''; useBreadcrumbs([{ text: nameOrId }]); return ( <> @@ -97,21 +77,3 @@ export const MonitorPageComponent: React.FC = ({ ); }; - -const mapStateToProps: MapStateToPropsParam = state => ({ - selectedMonitor: selectSelectedMonitor(state), -}); - -const mapDispatchToProps: MapDispatchToPropsFunction = (dispatch, own) => { - return { - dispatchGetMonitorStatus: (monitorId: string) => { - dispatch( - getSelectedMonitorAction({ - monitorId, - }) - ); - }, - }; -}; - -export const MonitorPage = connect(mapStateToProps, mapDispatchToProps)(MonitorPageComponent); diff --git a/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts index 7917628abf7dae..a8f37d38ebae6c 100644 --- a/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/actions/monitor_status.ts @@ -7,10 +7,6 @@ import { createAction } from 'redux-actions'; import { QueryParams } from './types'; import { Ping } from '../../../common/graphql/types'; -export const getSelectedMonitorAction = createAction<{ monitorId: string }>('GET_SELECTED_MONITOR'); -export const getSelectedMonitorActionSuccess = createAction('GET_SELECTED_MONITOR_SUCCESS'); -export const getSelectedMonitorActionFail = createAction('GET_SELECTED_MONITOR_FAIL'); - export const getMonitorStatusAction = createAction('GET_MONITOR_STATUS'); export const getMonitorStatusActionSuccess = createAction('GET_MONITOR_STATUS_SUCCESS'); export const getMonitorStatusActionFail = createAction('GET_MONITOR_STATUS_FAIL'); diff --git a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts index 0f7608ba57ea7f..f9e171adda3348 100644 --- a/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/api/monitor_status.ts @@ -7,19 +7,7 @@ import { QueryParams } from '../actions/types'; import { Ping } from '../../../common/graphql/types'; import { apiService } from './utils'; -import { API_URLS } from '../../../common/constants/rest_api'; - -export interface APIParams { - monitorId: string; -} - -export const fetchSelectedMonitor = async ({ monitorId }: APIParams): Promise => { - const queryParams = { - monitorId, - }; - - return await apiService.get(API_URLS.MONITOR_SELECTED, queryParams); -}; +import { API_URLS } from '../../../common/constants'; export const fetchMonitorStatus = async ({ monitorId, diff --git a/x-pack/legacy/plugins/uptime/public/state/effects/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/effects/monitor_status.ts index 1207ab20bc7113..2669629ed34f5f 100644 --- a/x-pack/legacy/plugins/uptime/public/state/effects/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/effects/monitor_status.ts @@ -6,14 +6,11 @@ import { takeLatest } from 'redux-saga/effects'; import { - getSelectedMonitorAction, - getSelectedMonitorActionSuccess, - getSelectedMonitorActionFail, getMonitorStatusAction, getMonitorStatusActionSuccess, getMonitorStatusActionFail, } from '../actions'; -import { fetchSelectedMonitor, fetchMonitorStatus } from '../api'; +import { fetchMonitorStatus } from '../api'; import { fetchEffectFactory } from './fetch_effect'; export function* fetchMonitorStatusEffect() { @@ -25,13 +22,4 @@ export function* fetchMonitorStatusEffect() { getMonitorStatusActionFail ) ); - - yield takeLatest( - getSelectedMonitorAction, - fetchEffectFactory( - fetchSelectedMonitor, - getSelectedMonitorActionSuccess, - getSelectedMonitorActionFail - ) - ); } diff --git a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts index c2dfbd7f90ff23..6cfaa9f8f59c1f 100644 --- a/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts +++ b/x-pack/legacy/plugins/uptime/public/state/reducers/monitor_status.ts @@ -5,9 +5,6 @@ */ import { handleActions, Action } from 'redux-actions'; import { - getSelectedMonitorAction, - getSelectedMonitorActionSuccess, - getSelectedMonitorActionFail, getMonitorStatusAction, getMonitorStatusActionSuccess, getMonitorStatusActionFail, @@ -17,13 +14,11 @@ import { QueryParams } from '../actions/types'; export interface MonitorStatusState { status: Ping | null; - monitor: Ping | null; loading: boolean; } const initialState: MonitorStatusState = { status: null, - monitor: null, loading: false, }; @@ -31,32 +26,22 @@ type MonitorStatusPayload = QueryParams & Ping; export const monitorStatusReducer = handleActions( { - [String(getSelectedMonitorAction)]: (state, action: Action) => ({ - ...state, - loading: true, - }), - - [String(getSelectedMonitorActionSuccess)]: (state, action: Action) => ({ - ...state, - loading: false, - monitor: { ...action.payload } as Ping, - }), - - [String(getSelectedMonitorActionFail)]: (state, action: Action) => ({ - ...state, - loading: false, - }), - [String(getMonitorStatusAction)]: (state, action: Action) => ({ ...state, loading: true, }), - [String(getMonitorStatusActionSuccess)]: (state, action: Action) => ({ - ...state, - loading: false, - status: { ...action.payload } as Ping, - }), + [String(getMonitorStatusActionSuccess)]: (state, action: Action) => { + return { + ...state, + loading: false, + // Keeping url from prev request to display, if there is no latest status + status: { + url: action.payload?.url || state.status?.url, + ...action.payload, + } as Ping, + }; + }, [String(getMonitorStatusActionFail)]: (state, action: Action) => ({ ...state, diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts index 573d5b1906082f..3b4547514a11ec 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/__tests__/index.test.ts @@ -46,7 +46,6 @@ describe('state selectors', () => { }, monitorStatus: { status: null, - monitor: null, loading: false, }, indexPattern: { diff --git a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts index 21e01bd7d82796..0fc3c7151cb3b8 100644 --- a/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts +++ b/x-pack/legacy/plugins/uptime/public/state/selectors/index.ts @@ -22,9 +22,7 @@ export const monitorLocationsSelector = (state: AppState, monitorId: string) => return state.monitor.monitorLocationsList?.get(monitorId); }; -export const selectSelectedMonitor = (state: AppState) => state.monitorStatus.monitor; - -export const selectMonitorStatus = (state: AppState) => state.monitorStatus.status; +export const monitorStatusSelector = (state: AppState) => state.monitorStatus.status; export const selectDynamicSettings = (state: AppState) => { return state.dynamicSettings; diff --git a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts index b7e340fddbd2cc..112c8e97d4c009 100644 --- a/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts +++ b/x-pack/plugins/uptime/server/lib/requests/__tests__/get_latest_monitor.test.ts @@ -31,49 +31,25 @@ describe('getLatestMonitor', () => { ], }, }, - aggs: { - by_id: { - terms: { - field: 'monitor.id', - size: 1000, - }, - aggs: { - latest: { - top_hits: { - size: 1, - sort: { - '@timestamp': { order: 'desc' }, - }, - }, - }, - }, - }, + size: 1, + _source: ['url', 'monitor', 'observer', 'tls', '@timestamp'], + sort: { + '@timestamp': { order: 'desc' }, }, - size: 0, }, }; mockEsSearchResult = { - aggregations: { - by_id: { - buckets: [ - { - latest: { - hits: { - hits: [ - { - _source: { - '@timestamp': 123456, - monitor: { - id: 'testMonitor', - }, - }, - }, - ], - }, + hits: { + hits: [ + { + _source: { + timestamp: 123456, + monitor: { + id: 'testMonitor', }, }, - ], - }, + }, + ], }, }; }); @@ -87,6 +63,7 @@ describe('getLatestMonitor', () => { dateEnd: 'now', monitorId: 'testMonitor', }); + expect(result.timestamp).toBe(123456); expect(result.monitor).not.toBeFalsy(); expect(result?.monitor?.id).toBe('testMonitor'); diff --git a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts index 176963a998685c..299e3eb6ca3cf9 100644 --- a/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts +++ b/x-pack/plugins/uptime/server/lib/requests/get_latest_monitor.ts @@ -26,8 +26,6 @@ export const getLatestMonitor: UMElasticsearchQueryFn { - // TODO: Write tests for this function - const params = { index: dynamicSettings.heartbeatIndices, body: { @@ -46,33 +44,20 @@ export const getLatestMonitor: UMElasticsearchQueryFn = async ({ - callES, - dynamicSettings, - monitorId, -}) => { - const params = { - index: dynamicSettings.heartbeatIndices, - body: { - size: 1, - _source: ['url', 'monitor', 'observer'], - query: { - bool: { - filter: [ - { - term: { - 'monitor.id': monitorId, - }, - }, - ], - }, - }, - sort: [ - { - '@timestamp': { - order: 'desc', - }, - }, - ], - }, - }; - - const result = await callES('search', params); - - return result.hits.hits[0]?._source; -}; diff --git a/x-pack/plugins/uptime/server/lib/requests/index.ts b/x-pack/plugins/uptime/server/lib/requests/index.ts index 7225d329d3c7f8..445adc3c15a930 100644 --- a/x-pack/plugins/uptime/server/lib/requests/index.ts +++ b/x-pack/plugins/uptime/server/lib/requests/index.ts @@ -7,7 +7,6 @@ export { getFilterBar, GetFilterBarParams } from './get_filter_bar'; export { getUptimeIndexPattern as getIndexPattern } from './get_index_pattern'; export { getLatestMonitor, GetLatestMonitorParams } from './get_latest_monitor'; -export { getMonitor, GetMonitorParams } from './get_monitor'; export { getMonitorDurationChart, GetMonitorChartsParams } from './get_monitor_duration'; export { getMonitorDetails, GetMonitorDetailsParams } from './get_monitor_details'; export { getMonitorLocations, GetMonitorLocationsParams } from './get_monitor_locations'; diff --git a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts index 6eeea5ba4c3e9c..9d3fa5aa08aedb 100644 --- a/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts +++ b/x-pack/plugins/uptime/server/lib/requests/uptime_requests.ts @@ -9,7 +9,6 @@ import { Ping, PingResults } from '../../../../../legacy/plugins/uptime/common/g import { GetFilterBarParams, GetLatestMonitorParams, - GetMonitorParams, GetMonitorChartsParams, GetMonitorDetailsParams, GetMonitorLocationsParams, @@ -39,7 +38,6 @@ export interface UptimeRequests { getFilterBar: ESQ; getIndexPattern: ESQ<{}, {}>; getLatestMonitor: ESQ; - getMonitor: ESQ; getMonitorDurationChart: ESQ; getMonitorDetails: ESQ; getMonitorLocations: ESQ; diff --git a/x-pack/plugins/uptime/server/rest_api/index.ts b/x-pack/plugins/uptime/server/rest_api/index.ts index 561997c3567d05..c84ea71037953e 100644 --- a/x-pack/plugins/uptime/server/rest_api/index.ts +++ b/x-pack/plugins/uptime/server/rest_api/index.ts @@ -11,7 +11,6 @@ import { createLogPageViewRoute } from './telemetry'; import { createGetSnapshotCount } from './snapshot'; import { UMRestApiRouteFactory } from './types'; import { - createGetMonitorRoute, createGetMonitorDetailsRoute, createGetMonitorLocationsRoute, createGetStatusBarRoute, @@ -31,7 +30,6 @@ export const restApiRoutes: UMRestApiRouteFactory[] = [ createGetIndexStatusRoute, createGetDynamicSettingsRoute, createPostDynamicSettingsRoute, - createGetMonitorRoute, createGetMonitorDetailsRoute, createGetMonitorLocationsRoute, createGetStatusBarRoute, diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/index.ts b/x-pack/plugins/uptime/server/rest_api/monitors/index.ts index 7f1f10081dc4ec..7da717b50c1496 100644 --- a/x-pack/plugins/uptime/server/rest_api/monitors/index.ts +++ b/x-pack/plugins/uptime/server/rest_api/monitors/index.ts @@ -6,4 +6,4 @@ export { createGetMonitorDetailsRoute } from './monitors_details'; export { createGetMonitorLocationsRoute } from './monitor_locations'; -export { createGetMonitorRoute, createGetStatusBarRoute } from './status'; +export { createGetStatusBarRoute } from './status'; diff --git a/x-pack/plugins/uptime/server/rest_api/monitors/status.ts b/x-pack/plugins/uptime/server/rest_api/monitors/status.ts index e1fcaf54f2824a..9bccd64c4bd659 100644 --- a/x-pack/plugins/uptime/server/rest_api/monitors/status.ts +++ b/x-pack/plugins/uptime/server/rest_api/monitors/status.ts @@ -7,30 +7,7 @@ import { schema } from '@kbn/config-schema'; import { UMServerLibs } from '../../lib/lib'; import { UMRestApiRouteFactory } from '../types'; -import { API_URLS } from '../../../../../legacy/plugins/uptime/common/constants/rest_api'; - -export const createGetMonitorRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ - method: 'GET', - path: API_URLS.MONITOR_SELECTED, - - validate: { - query: schema.object({ - monitorId: schema.string(), - }), - }, - options: { - tags: ['access:uptime-read'], - }, - handler: async ({ callES, dynamicSettings }, _context, request, response): Promise => { - const { monitorId } = request.query; - - return response.ok({ - body: { - ...(await libs.requests.getMonitor({ callES, dynamicSettings, monitorId })), - }, - }); - }, -}); +import { API_URLS } from '../../../../../legacy/plugins/uptime/common/constants'; export const createGetStatusBarRoute: UMRestApiRouteFactory = (libs: UMServerLibs) => ({ method: 'GET', diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json index 1702cb2c21007e..5d41cdf6118242 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json +++ b/x-pack/test/api_integration/apis/uptime/rest/fixtures/monitor_latest_status.json @@ -1,89 +1,29 @@ { - "@timestamp": "2019-09-11T03:40:34.371Z", - "agent": { - "ephemeral_id": "412a92a8-2142-4b1a-a7a2-1afd32e12f85", - "hostname": "avc-x1x", - "id": "04e1d082-65bc-4929-8d65-d0768a2621c4", - "type": "heartbeat", - "version": "8.0.0" - }, - "ecs": { - "version": "1.1.0" - }, - "event": { - "dataset": "uptime" - }, - "host": { - "name": "avc-x1x" - }, - "http": { - "response": { - "body": { - "bytes": 3, - "hash": "27badc983df1780b60c2b3fa9d3a19a00e46aac798451f0febdca52920faaddf" - }, - "status_code": 200 - }, - "rtt": { - "content": { - "us": 57 - }, - "response_header": { - "us": 262 - }, - "total": { - "us": 20331 - }, - "validate": { - "us": 319 - }, - "write_request": { - "us": 82 - } - } - }, - "monitor": { - "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", - "duration": { - "us": 24627 - }, - "id": "0002-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "location": "37.926868, -78.024902", - "name": "mpls" - }, - "hostname": "avc-x1x" - }, - "resolve": { - "ip": "127.0.0.1", - "rtt": { - "us": 4218 - } - }, - "summary": { - "down": 0, - "up": 1 - }, - "tcp": { - "rtt": { - "connect": { - "us": 103 - } - } - }, - "timestamp": "2019-09-11T03:40:34.371Z", - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } + "timestamp": "2019-09-11T03:40:34.371Z", + "observer": { + "geo": { + "name": "mpls", + "location": "37.926868, -78.024902" + }, + "hostname": "avc-x1x" + }, + "monitor": { + "duration": { + "us": 24627 + }, + "ip": "127.0.0.1", + "name": "", + "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", + "id": "0002-up", + "type": "http", + "status": "up" + }, + "url": { + "path": "/pattern", + "scheme": "http", + "port": 5678, + "domain": "localhost", + "query": "r=200x1", + "full": "http://localhost:5678/pattern?r=200x1" } +} \ No newline at end of file diff --git a/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json b/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json deleted file mode 100644 index d8367ea67052fa..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/rest/fixtures/selected_monitor.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "monitor": { - "check_group": "d76f0762-d445-11e9-88e3-3e80641b9c71", - "duration": { - "us": 24627 - }, - "id": "0002-up", - "ip": "127.0.0.1", - "name": "", - "status": "up", - "type": "http" - }, - "observer": { - "geo": { - "location": "37.926868, -78.024902", - "name": "mpls" - }, - "hostname": "avc-x1x" - }, - "url": { - "domain": "localhost", - "full": "http://localhost:5678/pattern?r=200x1", - "path": "/pattern", - "port": 5678, - "query": "r=200x1", - "scheme": "http" - } -} 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 b2236e1bb63083..f89bec589847ec 100644 --- a/x-pack/test/api_integration/apis/uptime/rest/index.ts +++ b/x-pack/test/api_integration/apis/uptime/rest/index.ts @@ -47,7 +47,6 @@ export default function({ getService, loadTestFile }: FtrProviderContext) { before('load heartbeat data', async () => await esArchiver.load('uptime/full_heartbeat')); after('unload', async () => await esArchiver.unload('uptime/full_heartbeat')); loadTestFile(require.resolve('./monitor_latest_status')); - loadTestFile(require.resolve('./selected_monitor')); loadTestFile(require.resolve('./ping_histogram')); loadTestFile(require.resolve('./monitor_duration')); loadTestFile(require.resolve('./doc_count')); diff --git a/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts b/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts deleted file mode 100644 index ed034f58a5f59c..00000000000000 --- a/x-pack/test/api_integration/apis/uptime/rest/selected_monitor.ts +++ /dev/null @@ -1,23 +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 { expectFixtureEql } from '../graphql/helpers/expect_fixture_eql'; -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export default function({ getService }: FtrProviderContext) { - describe('get selected monitor by ID', () => { - const monitorId = '0002-up'; - - const supertest = getService('supertest'); - - it('returns the monitor for give ID', async () => { - const apiResponse = await supertest.get( - `/api/uptime/monitor/selected?monitorId=${monitorId}` - ); - expectFixtureEql(apiResponse.body, 'selected_monitor'); - }); - }); -}