Skip to content

Commit

Permalink
[Uptime] Overview link to Exploratory View should not filter by monit…
Browse files Browse the repository at this point in the history
…or (elastic#122907)

* Modify Exploratory View link to prevent filtering by monitor from Overview page.

* Modify route match so only detail page will include monitor name filter on exploratory view link.

* Remove unnecessary comment.
  • Loading branch information
justinkambic authored Jan 14, 2022
1 parent 5309868 commit 939a642
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import React from 'react';
import { EuiHeaderLinks, EuiToolTip, EuiHeaderLink } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { useHistory } from 'react-router-dom';
import { useHistory, useRouteMatch } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { createExploratoryViewUrl } from '../../../../../observability/public';
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
import { useUptimeSettingsContext } from '../../../contexts/uptime_settings_context';
import { useGetUrlParams } from '../../../hooks';
import { ToggleAlertFlyoutButton } from '../../overview/alerts/alerts_containers';
import { MONITOR_MANAGEMENT, SETTINGS_ROUTE } from '../../../../common/constants';
import { MONITOR_MANAGEMENT, MONITOR_ROUTE, SETTINGS_ROUTE } from '../../../../common/constants';
import { stringifyUrlParams } from '../../../lib/helper/stringify_url_params';
import { InspectorHeaderLink } from './inspector_header_link';
import { monitorStatusSelector } from '../../../state/selectors';
Expand Down Expand Up @@ -44,6 +44,7 @@ export function ActionMenuContent({ config }: { config: UptimeConfig }): React.R

const selectedMonitor = useSelector(monitorStatusSelector);

const detailRouteMatch = useRouteMatch(MONITOR_ROUTE);
const monitorId = selectedMonitor?.monitor?.id;

const syntheticExploratoryViewLink = createExploratoryViewUrl(
Expand All @@ -57,7 +58,10 @@ export function ActionMenuContent({ config }: { config: UptimeConfig }): React.R
time: { from: dateRangeStart, to: dateRangeEnd },
breakdown: monitorId ? 'observer.geo.name' : 'monitor.type',
reportDefinitions: {
'monitor.name': selectedMonitor?.monitor?.name ? [selectedMonitor?.monitor?.name] : [],
'monitor.name':
selectedMonitor?.monitor?.name && detailRouteMatch?.isExact === true
? [selectedMonitor?.monitor?.name]
: [],
'url.full': ['ALL_VALUES'],
},
name: monitorId ? `${monitorId}-response-duration` : 'All monitors response duration',
Expand Down

0 comments on commit 939a642

Please sign in to comment.