mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PanelChrome: Show pointer when hovering cancel query button (#69391)
This commit is contained in:
@@ -140,7 +140,11 @@ export function PanelChrome({
|
|||||||
{loadingState === LoadingState.Loading && onCancelQuery && (
|
{loadingState === LoadingState.Loading && onCancelQuery && (
|
||||||
<DelayRender delay={2000}>
|
<DelayRender delay={2000}>
|
||||||
<Tooltip content="Cancel query">
|
<Tooltip content="Cancel query">
|
||||||
<TitleItem className={dragClassCancel} data-testid="panel-cancel-query" onClick={onCancelQuery}>
|
<TitleItem
|
||||||
|
className={cx(dragClassCancel, styles.pointer)}
|
||||||
|
data-testid="panel-cancel-query"
|
||||||
|
onClick={onCancelQuery}
|
||||||
|
>
|
||||||
<Icon name="sync-slash" size="md" />
|
<Icon name="sync-slash" size="md" />
|
||||||
</TitleItem>
|
</TitleItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -297,6 +301,9 @@ const getStyles = (theme: GrafanaTheme2) => {
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}),
|
}),
|
||||||
|
pointer: css({
|
||||||
|
cursor: 'pointer',
|
||||||
|
}),
|
||||||
streaming: css({
|
streaming: css({
|
||||||
label: 'panel-streaming',
|
label: 'panel-streaming',
|
||||||
marginRight: 0,
|
marginRight: 0,
|
||||||
|
|||||||
@@ -9,14 +9,11 @@ interface Props {
|
|||||||
* Delay the rendering of the children by N amount of milliseconds
|
* Delay the rendering of the children by N amount of milliseconds
|
||||||
*/
|
*/
|
||||||
export function DelayRender({ children, delay }: Props) {
|
export function DelayRender({ children, delay }: Props) {
|
||||||
const [shouldRender, setRender] = useState(false);
|
const [shouldRender, setShouldRender] = useState(false);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const intervalId = setInterval(() => {
|
window.setTimeout(() => {
|
||||||
setRender(true);
|
setShouldRender(true);
|
||||||
}, delay);
|
}, delay);
|
||||||
return () => {
|
|
||||||
clearInterval(intervalId);
|
|
||||||
};
|
|
||||||
}, [children, delay]);
|
}, [children, delay]);
|
||||||
|
|
||||||
return <>{shouldRender ? children : null}</>;
|
return <>{shouldRender ? children : null}</>;
|
||||||
|
|||||||
Reference in New Issue
Block a user