From 3ad697b74fdf09049464c4a7a8f2cd44550709f0 Mon Sep 17 00:00:00 2001 From: Dominique Clarke Date: Mon, 16 Sep 2024 12:20:33 -0400 Subject: [PATCH] [Synthetics] persist refresh interval in local storage (#191333) ## Summary Stores refresh interval and refresh paused state in local storage. Also defaults refresh to paused rather than active. --------- Co-authored-by: Shahzad --- .../constants/synthetics/client_defaults.ts | 6 +- .../common/components/auto_refresh_button.tsx | 64 ++----------------- .../common/components/last_refreshed.tsx | 6 +- .../hooks/use_selected_monitor.tsx | 5 +- .../contexts/synthetics_refresh_context.tsx | 55 ++++++++++++++-- .../apps/synthetics/state/ui/actions.ts | 2 - .../public/apps/synthetics/state/ui/index.ts | 14 ---- .../apps/synthetics/state/ui/selectors.ts | 9 --- .../__mocks__/synthetics_store.mock.ts | 2 - .../get_supported_url_params.test.ts | 9 +-- .../url_params/get_supported_url_params.ts | 11 +--- .../url_params/stringify_url_params.test.ts | 10 +-- .../utils/url_params/stringify_url_params.ts | 9 +-- 13 files changed, 64 insertions(+), 138 deletions(-) diff --git a/x-pack/plugins/observability_solution/synthetics/common/constants/synthetics/client_defaults.ts b/x-pack/plugins/observability_solution/synthetics/common/constants/synthetics/client_defaults.ts index 6ae9dbfef955f..3e5722ce59f10 100644 --- a/x-pack/plugins/observability_solution/synthetics/common/constants/synthetics/client_defaults.ts +++ b/x-pack/plugins/observability_solution/synthetics/common/constants/synthetics/client_defaults.ts @@ -16,11 +16,11 @@ export const CLIENT_DEFAULTS_SYNTHETICS = { DATE_RANGE_END: 'now', /** - * The application auto refreshes every 30s by default. + * The application auto refreshes every 60s by default. */ AUTOREFRESH_INTERVAL_SECONDS: 60, /** - * The application's autorefresh feature is enabled. + * The application's autorefresh feature is disabled by default. */ - AUTOREFRESH_IS_PAUSED: false, + AUTOREFRESH_IS_PAUSED: true, }; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/auto_refresh_button.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/auto_refresh_button.tsx index 6f40b000a6873..cea6a7d726926 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/auto_refresh_button.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/auto_refresh_button.tsx @@ -5,69 +5,17 @@ * 2.0. */ -import React, { useEffect, useRef } from 'react'; +import React from 'react'; import { EuiAutoRefreshButton, OnRefreshChangeProps } from '@elastic/eui'; -import { useDispatch, useSelector } from 'react-redux'; -import { CLIENT_DEFAULTS_SYNTHETICS } from '../../../../../../common/constants/synthetics/client_defaults'; -import { SyntheticsUrlParams } from '../../../utils/url_params'; -import { useUrlParams } from '../../../hooks'; -import { - selectRefreshInterval, - selectRefreshPaused, - setRefreshIntervalAction, - setRefreshPausedAction, -} from '../../../state'; -const { AUTOREFRESH_INTERVAL_SECONDS, AUTOREFRESH_IS_PAUSED } = CLIENT_DEFAULTS_SYNTHETICS; +import { useSyntheticsRefreshContext } from '../../../contexts/synthetics_refresh_context'; -const replaceDefaults = ({ refreshPaused, refreshInterval }: Partial) => { - return { - refreshInterval: refreshInterval === AUTOREFRESH_INTERVAL_SECONDS ? undefined : refreshInterval, - refreshPaused: refreshPaused === AUTOREFRESH_IS_PAUSED ? undefined : refreshPaused, - }; -}; export const AutoRefreshButton = () => { - const dispatch = useDispatch(); - - const refreshPaused = useSelector(selectRefreshPaused); - const refreshInterval = useSelector(selectRefreshInterval); - - const [getUrlsParams, updateUrlParams] = useUrlParams(); - - const { refreshInterval: urlRefreshInterval, refreshPaused: urlIsPaused } = getUrlsParams(); - - const isFirstRender = useRef(true); - - useEffect(() => { - if (isFirstRender.current) { - // sync url state with redux state on first render - dispatch(setRefreshIntervalAction(urlRefreshInterval)); - dispatch(setRefreshPausedAction(urlIsPaused)); - isFirstRender.current = false; - } else { - // sync redux state with url state on subsequent renders - if (urlRefreshInterval !== refreshInterval || urlIsPaused !== refreshPaused) { - updateUrlParams( - replaceDefaults({ - refreshInterval, - refreshPaused, - }), - true - ); - } - } - }, [updateUrlParams, refreshInterval, refreshPaused, urlRefreshInterval, urlIsPaused, dispatch]); + const { refreshInterval, setRefreshInterval, refreshPaused, setRefreshPaused } = + useSyntheticsRefreshContext(); const onRefreshChange = (newProps: OnRefreshChangeProps) => { - dispatch(setRefreshIntervalAction(newProps.refreshInterval / 1000)); - dispatch(setRefreshPausedAction(newProps.isPaused)); - - updateUrlParams( - replaceDefaults({ - refreshInterval: newProps.refreshInterval / 1000, - refreshPaused: newProps.isPaused, - }), - true - ); + setRefreshPaused(newProps.isPaused); + setRefreshInterval(newProps.refreshInterval / 1000); }; return ( diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/last_refreshed.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/last_refreshed.tsx index bc086f67c822b..210170b7e3b8f 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/last_refreshed.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/components/last_refreshed.tsx @@ -9,16 +9,12 @@ import React, { useEffect, useState } from 'react'; import moment from 'moment'; import { EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { useSelector } from 'react-redux'; import { useSyntheticsRefreshContext } from '../../../contexts'; -import { selectRefreshPaused } from '../../../state'; export function LastRefreshed() { - const { lastRefresh: lastRefreshed } = useSyntheticsRefreshContext(); + const { lastRefresh: lastRefreshed, refreshPaused } = useSyntheticsRefreshContext(); const [refresh, setRefresh] = useState(() => Date.now()); - const refreshPaused = useSelector(selectRefreshPaused); - useEffect(() => { const interVal = setInterval(() => { setRefresh(Date.now()); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/hooks/use_selected_monitor.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/hooks/use_selected_monitor.tsx index 622dcff46e902..1f2eadb7c09fc 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/hooks/use_selected_monitor.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/hooks/use_selected_monitor.tsx @@ -4,7 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ - import { useEffect, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useParams } from 'react-router-dom'; @@ -16,7 +15,6 @@ import { selectMonitorListState, selectorMonitorDetailsState, selectorError, - selectRefreshInterval, } from '../../../state'; export const useSelectedMonitor = (monId?: string) => { @@ -27,14 +25,13 @@ export const useSelectedMonitor = (monId?: string) => { } const monitorsList = useSelector(selectEncryptedSyntheticsSavedMonitors); const { loading: monitorListLoading } = useSelector(selectMonitorListState); - const refreshInterval = useSelector(selectRefreshInterval); const monitorFromList = useMemo( () => monitorsList.find((monitor) => monitor[ConfigKey.CONFIG_ID] === monitorId) ?? null, [monitorId, monitorsList] ); const error = useSelector(selectorError); - const { lastRefresh } = useSyntheticsRefreshContext(); + const { lastRefresh, refreshInterval } = useSyntheticsRefreshContext(); const { syntheticsMonitor, syntheticsMonitorLoading, syntheticsMonitorDispatchedAt } = useSelector(selectorMonitorDetailsState); const dispatch = useDispatch(); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx index b53620921fdd1..9f3902b8ccaf2 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx @@ -14,15 +14,21 @@ import React, { useState, FC, } from 'react'; -import { useSelector } from 'react-redux'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import { useEvent } from 'react-use'; import moment from 'moment'; import { Subject } from 'rxjs'; -import { selectRefreshInterval, selectRefreshPaused } from '../state'; +import { i18n } from '@kbn/i18n'; +import { CLIENT_DEFAULTS_SYNTHETICS } from '../../../../common/constants/synthetics/client_defaults'; +const { AUTOREFRESH_INTERVAL_SECONDS, AUTOREFRESH_IS_PAUSED } = CLIENT_DEFAULTS_SYNTHETICS; interface SyntheticsRefreshContext { lastRefresh: number; refreshApp: () => void; + refreshInterval: number; + refreshPaused: boolean; + setRefreshInterval: (interval: number) => void; + setRefreshPaused: (paused: boolean) => void; } const defaultContext: SyntheticsRefreshContext = { @@ -30,6 +36,22 @@ const defaultContext: SyntheticsRefreshContext = { refreshApp: () => { throw new Error('App refresh was not initialized, set it when you invoke the context'); }, + refreshInterval: AUTOREFRESH_INTERVAL_SECONDS, + refreshPaused: AUTOREFRESH_IS_PAUSED, + setRefreshInterval: () => { + throw new Error( + i18n.translate('xpack.synthetics.refreshContext.intervalNotInitialized', { + defaultMessage: 'Refresh interval was not initialized, set it when you invoke the context', + }) + ); + }, + setRefreshPaused: () => { + throw new Error( + i18n.translate('xpack.synthetics.refreshContext.pausedNotInitialized', { + defaultMessage: 'Refresh paused was not initialized, set it when you invoke the context', + }) + ); + }, }; export const SyntheticsRefreshContext = createContext(defaultContext); @@ -41,8 +63,14 @@ export const SyntheticsRefreshContextProvider: FC< > = ({ children, reload$ }) => { const [lastRefresh, setLastRefresh] = useState(Date.now()); - const refreshPaused = useSelector(selectRefreshPaused); - const refreshInterval = useSelector(selectRefreshInterval); + const [refreshInterval, setRefreshInterval] = useLocalStorage( + 'xpack.synthetics.refreshInterval', + AUTOREFRESH_INTERVAL_SECONDS + ); + const [refreshPaused, setRefreshPaused] = useLocalStorage( + 'xpack.synthetics.refreshPaused', + AUTOREFRESH_IS_PAUSED + ); const refreshApp = useCallback(() => { const refreshTime = Date.now(); @@ -66,13 +94,26 @@ export const SyntheticsRefreshContextProvider: FC< return { lastRefresh, refreshApp, + refreshInterval: refreshInterval ?? AUTOREFRESH_INTERVAL_SECONDS, + refreshPaused: refreshPaused ?? AUTOREFRESH_IS_PAUSED, + setRefreshInterval, + setRefreshPaused, }; - }, [lastRefresh, refreshApp]); + }, [ + lastRefresh, + refreshApp, + refreshInterval, + refreshPaused, + setRefreshInterval, + setRefreshPaused, + ]); useEvent( 'visibilitychange', () => { - const isOutdated = moment().diff(new Date(lastRefresh), 'seconds') > refreshInterval; + const isOutdated = + moment().diff(new Date(lastRefresh), 'seconds') > + (refreshInterval || AUTOREFRESH_INTERVAL_SECONDS); if (document.visibilityState !== 'hidden' && !refreshPaused && isOutdated) { refreshApp(); } @@ -88,7 +129,7 @@ export const SyntheticsRefreshContextProvider: FC< if (document.visibilityState !== 'hidden') { refreshApp(); } - }, refreshInterval * 1000); + }, (refreshInterval || AUTOREFRESH_INTERVAL_SECONDS) * 1000); return () => clearInterval(interval); }, [refreshPaused, refreshApp, refreshInterval]); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/actions.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/actions.ts index e3738f3737cf0..06b9506ead191 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/actions.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/actions.ts @@ -31,5 +31,3 @@ export const toggleIntegrationsPopover = createAction( ); export const setSelectedMonitorId = createAction('[UI] SET MONITOR ID'); -export const setRefreshPausedAction = createAction('[UI] SET REFRESH PAUSED'); -export const setRefreshIntervalAction = createAction('[UI] SET REFRESH INTERVAL'); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/index.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/index.ts index 6c6ef93bbf3a7..2c7d5e5ce3d4c 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/index.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/index.ts @@ -11,7 +11,6 @@ import { SYNTHETICS_STATUS_RULE, SYNTHETICS_TLS_RULE, } from '../../../../../common/constants/synthetics_alerts'; -import { CLIENT_DEFAULTS_SYNTHETICS } from '../../../../../common/constants/synthetics/client_defaults'; import { PopoverState, toggleIntegrationsPopover, @@ -20,10 +19,7 @@ import { setAlertFlyoutVisible, setSearchTextAction, setSelectedMonitorId, - setRefreshPausedAction, - setRefreshIntervalAction, } from './actions'; -const { AUTOREFRESH_INTERVAL_SECONDS, AUTOREFRESH_IS_PAUSED } = CLIENT_DEFAULTS_SYNTHETICS; export interface UiState { alertFlyoutVisible: typeof SYNTHETICS_TLS_RULE | typeof SYNTHETICS_STATUS_RULE | null; @@ -32,8 +28,6 @@ export interface UiState { searchText: string; integrationsPopoverOpen: PopoverState | null; monitorId: string; - refreshInterval: number; - refreshPaused: boolean; } const initialState: UiState = { @@ -43,8 +37,6 @@ const initialState: UiState = { searchText: '', integrationsPopoverOpen: null, monitorId: '', - refreshInterval: AUTOREFRESH_INTERVAL_SECONDS, - refreshPaused: AUTOREFRESH_IS_PAUSED, }; export const uiReducer = createReducer(initialState, (builder) => { @@ -66,12 +58,6 @@ export const uiReducer = createReducer(initialState, (builder) => { }) .addCase(setSelectedMonitorId, (state, action) => { state.monitorId = action.payload; - }) - .addCase(setRefreshPausedAction, (state, action) => { - state.refreshPaused = action.payload; - }) - .addCase(setRefreshIntervalAction, (state, action) => { - state.refreshInterval = action.payload; }); }); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/selectors.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/selectors.ts index 4e365d8343555..f02b1fb564c37 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/selectors.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/state/ui/selectors.ts @@ -14,12 +14,3 @@ export const selectAlertFlyoutVisibility = createSelector( uiStateSelector, ({ alertFlyoutVisible }) => alertFlyoutVisible ); - -export const selectRefreshPaused = createSelector( - uiStateSelector, - ({ refreshPaused }) => refreshPaused -); -export const selectRefreshInterval = createSelector( - uiStateSelector, - ({ refreshInterval }) => refreshInterval -); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts index b861fe36b9b96..aa52c54c21b78 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/testing/__mocks__/synthetics_store.mock.ts @@ -30,8 +30,6 @@ export const mockState: SyntheticsAppState = { integrationsPopoverOpen: null, searchText: '', monitorId: '', - refreshInterval: 60, - refreshPaused: true, }, serviceLocations: { throttling: DEFAULT_THROTTLING, diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.test.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.test.ts index efabb2034e434..2a01b9d7aeefb 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.test.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.test.ts @@ -51,12 +51,7 @@ describe('getSupportedUrlParams', () => { it('returns default values', () => { const { FILTERS, SEARCH, STATUS_FILTER } = CLIENT_DEFAULTS; - const { - DATE_RANGE_START, - DATE_RANGE_END, - AUTOREFRESH_INTERVAL_SECONDS, - AUTOREFRESH_IS_PAUSED, - } = CLIENT_DEFAULTS_SYNTHETICS; + const { DATE_RANGE_START, DATE_RANGE_END } = CLIENT_DEFAULTS_SYNTHETICS; const result = getSupportedUrlParams({}); expect(result).toEqual({ absoluteDateRangeStart: MOCK_DATE_VALUE, @@ -75,8 +70,6 @@ describe('getSupportedUrlParams', () => { projects: [], schedules: [], tags: [], - refreshInterval: AUTOREFRESH_INTERVAL_SECONDS, - refreshPaused: AUTOREFRESH_IS_PAUSED, }); }); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.ts index ce2eb6f30829f..8b4612b1e0f39 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/get_supported_url_params.ts @@ -7,8 +7,6 @@ import { MonitorOverviewState } from '../../state'; import { CLIENT_DEFAULTS_SYNTHETICS } from '../../../../../common/constants/synthetics/client_defaults'; -import { parseIsPaused } from './parse_is_paused'; -import { parseUrlInt } from './parse_url_int'; import { CLIENT_DEFAULTS } from '../../../../../common/constants'; import { parseAbsoluteDate } from './parse_absolute_date'; @@ -16,8 +14,6 @@ import { parseAbsoluteDate } from './parse_absolute_date'; export interface SyntheticsUrlParams { absoluteDateRangeStart: number; absoluteDateRangeEnd: number; - refreshInterval: number; - refreshPaused: boolean; dateRangeStart: string; dateRangeEnd: string; pagination?: string; @@ -43,8 +39,7 @@ export interface SyntheticsUrlParams { const { ABSOLUTE_DATE_RANGE_START, ABSOLUTE_DATE_RANGE_END, SEARCH, FILTERS, STATUS_FILTER } = CLIENT_DEFAULTS; -const { DATE_RANGE_START, DATE_RANGE_END, AUTOREFRESH_INTERVAL_SECONDS, AUTOREFRESH_IS_PAUSED } = - CLIENT_DEFAULTS_SYNTHETICS; +const { DATE_RANGE_START, DATE_RANGE_END } = CLIENT_DEFAULTS_SYNTHETICS; /** * Gets the current URL values for the application. If no item is present @@ -76,8 +71,6 @@ export const getSupportedUrlParams = (params: { }); const { - refreshInterval, - refreshPaused, dateRangeStart, dateRangeEnd, filters, @@ -112,8 +105,6 @@ export const getSupportedUrlParams = (params: { ABSOLUTE_DATE_RANGE_END, { roundUp: true } ), - refreshInterval: parseUrlInt(refreshInterval, AUTOREFRESH_INTERVAL_SECONDS), - refreshPaused: parseIsPaused(refreshPaused, AUTOREFRESH_IS_PAUSED), dateRangeStart: dateRangeStart || DATE_RANGE_START, dateRangeEnd: dateRangeEnd || DATE_RANGE_END, filters: filters || FILTERS, diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.test.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.test.ts index 6f9ace8634d64..c8f8649fd56db 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.test.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.test.ts @@ -12,8 +12,6 @@ describe('stringifyUrlParams', () => { const result = stringifyUrlParams({ absoluteDateRangeStart: 1000, absoluteDateRangeEnd: 2000, - refreshInterval: 50000, - refreshPaused: false, dateRangeStart: 'now-15m', dateRangeEnd: 'now', filters: 'monitor.id: bar', @@ -22,7 +20,7 @@ describe('stringifyUrlParams', () => { statusFilter: 'up', }); expect(result).toMatchInlineSnapshot( - `"?absoluteDateRangeStart=1000&absoluteDateRangeEnd=2000&refreshInterval=50000&refreshPaused=false&dateRangeStart=now-15m&dateRangeEnd=now&filters=monitor.id%3A%20bar&focusConnectorField=true&search=monitor.id%3A%20foo&statusFilter=up"` + `"?absoluteDateRangeStart=1000&absoluteDateRangeEnd=2000&dateRangeStart=now-15m&dateRangeEnd=now&filters=monitor.id%3A%20bar&focusConnectorField=true&search=monitor.id%3A%20foo&statusFilter=up"` ); }); @@ -31,8 +29,6 @@ describe('stringifyUrlParams', () => { { absoluteDateRangeStart: 1000, absoluteDateRangeEnd: 2000, - refreshInterval: 50000, - refreshPaused: false, dateRangeStart: 'now-15m', dateRangeEnd: 'now', filters: 'monitor.id: bar', @@ -43,9 +39,7 @@ describe('stringifyUrlParams', () => { }, true ); - expect(result).toMatchInlineSnapshot( - `"?refreshInterval=50000&dateRangeStart=now-15m&filters=monitor.id%3A%20bar"` - ); + expect(result).toMatchInlineSnapshot(`"?dateRangeStart=now-15m&filters=monitor.id%3A%20bar"`); expect(result.includes('pagination')).toBeFalsy(); expect(result.includes('search')).toBeFalsy(); diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.ts index 7f0dd94237593..7f465e7272dc6 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/url_params/stringify_url_params.ts @@ -12,8 +12,7 @@ import { CLIENT_DEFAULTS } from '../../../../../common/constants'; const { FOCUS_CONNECTOR_FIELD } = CLIENT_DEFAULTS; -const { DATE_RANGE_START, DATE_RANGE_END, AUTOREFRESH_INTERVAL_SECONDS, AUTOREFRESH_IS_PAUSED } = - CLIENT_DEFAULTS_SYNTHETICS; +const { DATE_RANGE_START, DATE_RANGE_END } = CLIENT_DEFAULTS_SYNTHETICS; export const stringifyUrlParams = (params: Partial, ignoreEmpty = false) => { if (ignoreEmpty) { @@ -41,12 +40,6 @@ const replaceDefaults = (params: Partial) => { if (key === 'dateRangeEnd' && val === DATE_RANGE_END) { delete params[key]; } - if (key === 'refreshPaused' && val === AUTOREFRESH_IS_PAUSED) { - delete params[key]; - } - if (key === 'refreshInterval' && val === AUTOREFRESH_INTERVAL_SECONDS) { - delete params[key]; - } if (key === 'focusConnectorField' && val === FOCUS_CONNECTOR_FIELD) { delete params[key]; }