VizTooltip: Remove use of LayoutItemContext (#83542)

This commit is contained in:
Leon Sorokin 2024-02-27 13:33:33 -06:00 committed by GitHub
parent 0f1cefa942
commit 5c60f4d468
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 20 deletions

View File

@ -1,19 +1,9 @@
import { css } from '@emotion/css';
import React, { useContext, useEffect, useRef } from 'react';
import React, { useRef } from 'react';
import { useAsyncFn, useClickAway } from 'react-use';
import { AnnotationEventUIModel, GrafanaTheme2, dateTimeFormat, systemDateFormats } from '@grafana/data';
import {
Button,
Field,
Form,
HorizontalGroup,
InputControl,
LayoutItemContext,
TextArea,
usePanelContext,
useStyles2,
} from '@grafana/ui';
import { Button, Field, Form, HorizontalGroup, InputControl, TextArea, usePanelContext, useStyles2 } from '@grafana/ui';
import { TagFilter } from 'app/core/components/TagFilter/TagFilter';
import { getAnnotationTags } from 'app/features/annotations/api';
@ -37,9 +27,6 @@ export const AnnotationEditor2 = ({ annoVals, annoIdx, dismiss, timeZone, ...oth
useClickAway(clickAwayRef, dismiss);
const layoutCtx = useContext(LayoutItemContext);
useEffect(() => layoutCtx.boostZIndex(), [layoutCtx]);
const [createAnnotationState, createAnnotation] = useAsyncFn(async (event: AnnotationEventUIModel) => {
const result = await onAnnotationCreate!(event);
dismiss();

View File

@ -1,8 +1,8 @@
import { css } from '@emotion/css';
import React, { useContext, useEffect } from 'react';
import React from 'react';
import { GrafanaTheme2, dateTimeFormat, systemDateFormats, textUtil } from '@grafana/data';
import { HorizontalGroup, IconButton, LayoutItemContext, Tag, usePanelContext, useStyles2 } from '@grafana/ui';
import { HorizontalGroup, IconButton, Tag, usePanelContext, useStyles2 } from '@grafana/ui';
import alertDef from 'app/features/alerting/state/alertDef';
interface Props {
@ -25,9 +25,6 @@ export const AnnotationTooltip2 = ({ annoVals, annoIdx, timeZone, onEdit }: Prop
const canEdit = canEditAnnotations(dashboardUID);
const canDelete = canDeleteAnnotations(dashboardUID) && onAnnotationDelete != null;
const layoutCtx = useContext(LayoutItemContext);
useEffect(() => layoutCtx.boostZIndex(), [layoutCtx]);
const timeFormatter = (value: number) =>
dateTimeFormat(value, {
format: systemDateFormats.fullDate,