Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { DARK_THEME } from '@elastic/charts';
import { useTheme } from '@kbn/observability-plugin/public';
import { useDispatch, useSelector } from 'react-redux';
import moment from 'moment';
import { toggleErrorPopoverOpen } from '../../../../state';
import { selectErrorPopoverState, toggleErrorPopoverOpen } from '../../../../state';
import { useLocationName, useStatusByLocationOverview } from '../../../../hooks';
import { formatDuration } from '../../../../utils/formatting';
import { MonitorOverviewItem } from '../../../../../../../common/runtime_types';
Expand Down Expand Up @@ -63,6 +63,7 @@ export const MetricItem = ({
}) => {
const [isMouseOver, setIsMouseOver] = useState(false);
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const isErrorPopoverOpen = useSelector(selectErrorPopoverState);
const locationName =
useLocationName({ locationId: monitor.location?.id })?.label || monitor.location?.id;
const { status, timestamp, ping, configIdByLocation } = useStatusByLocationOverview(
Expand All @@ -86,6 +87,9 @@ export const MetricItem = ({
}
}}
onMouseLeave={() => {
if (isErrorPopoverOpen) {
dispatch(toggleErrorPopoverOpen(null));
}
if (isMouseOver) {
setIsMouseOver(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ export const MetricItemIcon = ({
onMouseLeave={() => {
if (isPopoverOpen) {
return;
}
if (timer.current) {
} else if (timer.current) {
clearTimeout(timer.current);
}
}}
Expand Down