forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[9.0] [Synthetics] Fix overview error popover !! (elastic#211431) (el…
…astic#212123) # Backport This will backport the following commits from `main` to `9.0`: - [[Synthetics] Fix overview error popover !! (elastic#211431)](elastic#211431) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2025-02-21T16:38:54Z","message":"[Synthetics] Fix overview error popover !! (elastic#211431)\n\n## Summary\n\nFix overview error popover !!\n\nPings aren't being returned as part of overview data anymore, so had to\nadd redux actions to fetch it separately via an existing API\n\nFixes https://github.com/elastic/kibana/issues/211745\n\n\n<img width=\"1728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2244948f-e42d-443d-b6e7-42e0a72b1bfa\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Justin Kambic <jk@elastic.co>","sha":"aaf73ff5f67a9163773ff43868f329e3b5693242","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:obs-ux-management","backport:version","v8.18.0","v9.1.0"],"title":"[Synthetics] Fix overview error popover !!","number":211431,"url":"https://github.com/elastic/kibana/pull/211431","mergeCommit":{"message":"[Synthetics] Fix overview error popover !! (elastic#211431)\n\n## Summary\n\nFix overview error popover !!\n\nPings aren't being returned as part of overview data anymore, so had to\nadd redux actions to fetch it separately via an existing API\n\nFixes https://github.com/elastic/kibana/issues/211745\n\n\n<img width=\"1728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2244948f-e42d-443d-b6e7-42e0a72b1bfa\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Justin Kambic <jk@elastic.co>","sha":"aaf73ff5f67a9163773ff43868f329e3b5693242"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/211431","number":211431,"mergeCommit":{"message":"[Synthetics] Fix overview error popover !! (elastic#211431)\n\n## Summary\n\nFix overview error popover !!\n\nPings aren't being returned as part of overview data anymore, so had to\nadd redux actions to fetch it separately via an existing API\n\nFixes https://github.com/elastic/kibana/issues/211745\n\n\n<img width=\"1728\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/2244948f-e42d-443d-b6e7-42e0a72b1bfa\"\n/>\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Justin Kambic <jk@elastic.co>","sha":"aaf73ff5f67a9163773ff43868f329e3b5693242"}}]}] BACKPORT--> Co-authored-by: Shahzad <shahzad31comp@gmail.com>
- Loading branch information
1 parent
2e7ba5b
commit 83e37ba
Showing
17 changed files
with
235 additions
and
100 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
...s/synthetics/components/monitors_page/overview/overview/metric_item/metric_error_icon.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiButtonIcon, useEuiShadow, useEuiTheme } from '@elastic/eui'; | ||
import * as React from 'react'; | ||
import { useRef } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { css } from '@emotion/react'; | ||
import { useSyntheticsSettingsContext } from '../../../../../contexts'; | ||
import { selectErrorPopoverState, toggleErrorPopoverOpen } from '../../../../../state'; | ||
|
||
export const MetricErrorIcon = ({ configIdByLocation }: { configIdByLocation: string }) => { | ||
const isPopoverOpen = useSelector(selectErrorPopoverState); | ||
const dispatch = useDispatch(); | ||
|
||
const setIsPopoverOpen = () => { | ||
dispatch(toggleErrorPopoverOpen(configIdByLocation)); | ||
}; | ||
const timer = useRef<NodeJS.Timeout | null>(null); | ||
const euiShadow = useEuiShadow('s'); | ||
|
||
const theme = useEuiTheme().euiTheme; | ||
const { darkMode } = useSyntheticsSettingsContext(); | ||
|
||
return ( | ||
<div | ||
css={css` | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 10px; | ||
width: 32px; | ||
height: 32px; | ||
background: ${darkMode ? theme.colors.backgroundBaseSubdued : theme.colors.lightestShade}; | ||
border: 1px solid ${darkMode ? theme.colors.darkShade : theme.colors.lightShade}; | ||
box-shadow: ${euiShadow}; | ||
border-radius: 16px; | ||
flex: none; | ||
order: 0; | ||
flex-grow: 0; | ||
`} | ||
onMouseEnter={() => { | ||
// show popover with delay | ||
if (timer.current) { | ||
clearTimeout(timer.current); | ||
} | ||
timer.current = setTimeout(() => { | ||
setIsPopoverOpen(); | ||
}, 300); | ||
}} | ||
onMouseLeave={() => { | ||
if (isPopoverOpen) { | ||
return; | ||
} else if (timer.current) { | ||
clearTimeout(timer.current); | ||
} | ||
}} | ||
onClick={() => { | ||
if (configIdByLocation === isPopoverOpen) { | ||
dispatch(toggleErrorPopoverOpen(null)); | ||
} else { | ||
dispatch(toggleErrorPopoverOpen(configIdByLocation)); | ||
} | ||
}} | ||
onKeyDown={(e) => { | ||
if (e.key === 'Enter') { | ||
if (configIdByLocation === isPopoverOpen) { | ||
dispatch(toggleErrorPopoverOpen(null)); | ||
} else { | ||
dispatch(toggleErrorPopoverOpen(configIdByLocation)); | ||
} | ||
} | ||
}} | ||
> | ||
<EuiButtonIcon | ||
data-test-subj="syntheticsMetricItemIconButton" | ||
iconType="warning" | ||
color="danger" | ||
size="m" | ||
aria-label={ERROR_DETAILS} | ||
/> | ||
</div> | ||
); | ||
}; | ||
const ERROR_DETAILS = i18n.translate('xpack.synthetics.errorDetails.label', { | ||
defaultMessage: 'Error details', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.