2025-04-03 01:50:36 +08:00
|
|
|
import { css } from '@emotion/css';
|
|
|
|
|
|
|
|
import { GrafanaTheme2 } from '@grafana/data';
|
2025-06-12 17:03:52 +08:00
|
|
|
import { t } from '@grafana/i18n';
|
2025-04-03 01:50:36 +08:00
|
|
|
import { Icon, Tooltip, useStyles2 } from '@grafana/ui';
|
|
|
|
|
|
|
|
export const ConditionalRenderingOverlay = () => {
|
|
|
|
const styles = useStyles2(getStyles);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.container}>
|
2025-10-07 15:23:57 +08:00
|
|
|
<Tooltip content={t('dashboard.conditional-rendering.overlay.tooltip', 'Element is hidden by show/hide rules.')}>
|
2025-04-03 01:50:36 +08:00
|
|
|
<Icon name="eye-slash" />
|
|
|
|
</Tooltip>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const getStyles = (theme: GrafanaTheme2) => ({
|
|
|
|
container: css({
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
position: 'absolute',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
2025-04-03 20:14:42 +08:00
|
|
|
zIndex: 1,
|
2025-04-03 01:50:36 +08:00
|
|
|
|
|
|
|
[theme.transitions.handleMotion('no-preference', 'reduce')]: {
|
|
|
|
transition: 'all 0.2s ease',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:before': css({
|
|
|
|
content: '""',
|
|
|
|
opacity: 0.6,
|
|
|
|
position: 'absolute',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
backgroundColor: theme.colors.background.canvas,
|
|
|
|
pointerEvents: 'none',
|
|
|
|
}),
|
|
|
|
|
|
|
|
'& > svg': css({
|
|
|
|
height: '48px',
|
|
|
|
width: '48px',
|
|
|
|
maxWidth: '75%',
|
|
|
|
maxHeight: '75%',
|
|
|
|
}),
|
|
|
|
|
|
|
|
'.dashboard-visible-hidden-element:hover > &': css({
|
|
|
|
width: '30px',
|
|
|
|
height: '30px',
|
|
|
|
top: 'unset',
|
|
|
|
left: 'unset',
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
});
|