Skip to content

Commit

Permalink
Move use_status_by_location hook to main hooks directory and allow …
Browse files Browse the repository at this point in the history
…it to take arbitrary monitor IDs as an arg. (#135957)
  • Loading branch information
justinkambic authored Jul 8, 2022
1 parent 88d9a8b commit 3c13cfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react';
import { EuiBadge, EuiBadgeGroup, EuiIcon, EuiLoadingSpinner } from '@elastic/eui';
import { useTheme } from '@kbn/observability-plugin/public';
import { useStatusByLocation } from '../hooks/use_status_by_location';
import { useStatusByLocation } from '../../../../../hooks/use_status_by_location';

export const LocationsStatus = () => {
const { locations, loading } = useStatusByLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
import { useEsSearch } from '@kbn/observability-plugin/public';
import { useParams } from 'react-router-dom';
import { useMemo } from 'react';
import { Ping } from '../../../../../../common/runtime_types';
import { Ping } from '../../common/runtime_types';
import {
EXCLUDE_RUN_ONCE_FILTER,
getTimeSpanFilter,
SUMMARY_FILTER,
} from '../../../../../../common/constants/client_defaults';
import { useSyntheticsRefreshContext } from '../../../contexts/synthetics_refresh_context';
import { SYNTHETICS_INDEX_PATTERN, UNNAMED_LOCATION } from '../../../../../../common/constants';
} from '../../common/constants/client_defaults';
import { SYNTHETICS_INDEX_PATTERN, UNNAMED_LOCATION } from '../../common/constants';
import { useSyntheticsRefreshContext } from '../apps/synthetics/contexts';

export function useStatusByLocation() {
export function useStatusByLocation(monitorIdArg?: string) {
const { lastRefresh } = useSyntheticsRefreshContext();

const { monitorId } = useParams<{ monitorId: string }>();
Expand All @@ -35,7 +35,7 @@ export function useStatusByLocation() {
getTimeSpanFilter(),
{
term: {
config_id: monitorId,
config_id: monitorIdArg ?? monitorId,
},
},
],
Expand All @@ -60,7 +60,7 @@ export function useStatusByLocation() {
},
},
},
[lastRefresh, monitorId],
[lastRefresh, monitorId, monitorIdArg],
{ name: 'getMonitorStatusByLocation' }
);

Expand Down

0 comments on commit 3c13cfe

Please sign in to comment.