mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Some type fixes needed for react 18 (#65600)
some type fixes needed for react 18
This commit is contained in:
parent
6f6ebf5b18
commit
98e66654d6
@ -30,6 +30,7 @@ export interface TimelineProps extends Omit<GraphNGProps, 'prepConfig' | 'propsT
|
||||
const propsToDiff = ['rowHeight', 'colWidth', 'showValue', 'mergeValues', 'alignValue'];
|
||||
|
||||
export class TimelineChart extends React.Component<TimelineProps> {
|
||||
declare context: React.ContextType<typeof PanelContextRoot>;
|
||||
static contextType = PanelContextRoot;
|
||||
panelContext: PanelContext = {} as PanelContext;
|
||||
|
||||
|
@ -85,7 +85,7 @@ export const DashboardPicker = ({ dashboardUid, panelId, isOpen, onChange, onDis
|
||||
const selectedDashboardIsInPageResult = selectedDashboardIndex >= 0;
|
||||
|
||||
const scrollToItem = useCallback(
|
||||
(node) => {
|
||||
(node: FixedSizeList) => {
|
||||
const canScroll = selectedDashboardIndex >= 0;
|
||||
|
||||
if (isDefaultSelection && canScroll) {
|
||||
|
@ -63,8 +63,7 @@ const MetricValueEdit = (props: CanvasElementProps<TextConfig, TextData>) => {
|
||||
panelData = context.instanceState?.scene?.data.series;
|
||||
|
||||
const onFieldChange = useCallback(
|
||||
(field) => {
|
||||
console.log('onfieldchange', field);
|
||||
(field: string | undefined) => {
|
||||
let selectedElement: ElementState;
|
||||
selectedElement = context.instanceState?.selected[0];
|
||||
if (selectedElement) {
|
||||
|
@ -27,7 +27,7 @@ export const PanelEditorTabs = React.memo(({ panel, dashboard, tabs, onChangeTab
|
||||
const styles = useStyles2(getStyles);
|
||||
|
||||
const instrumentedOnChangeTab = useCallback(
|
||||
(tab) => {
|
||||
(tab: PanelEditorTab) => {
|
||||
if (!tab.active) {
|
||||
reportInteraction('panel_editor_tabs_changed', { tab_id: tab.id });
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ const NativeSearch = ({ datasource, query, onChange, onBlur, onRunQuery }: Props
|
||||
};
|
||||
|
||||
const handleOnChange = useCallback(
|
||||
(value) => {
|
||||
(value: string) => {
|
||||
onChange({
|
||||
...query,
|
||||
search: value,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { css, cx } from '@emotion/css';
|
||||
import React, { useCallback, useMemo } from 'react';
|
||||
import React, { CSSProperties, useCallback, useMemo } from 'react';
|
||||
import { SortByFn, useSortBy, useAbsoluteLayout, useTable, CellProps } from 'react-table';
|
||||
import { FixedSizeList } from 'react-window';
|
||||
|
||||
@ -104,7 +104,7 @@ const FlameGraphTopTable = ({
|
||||
const { headerGroups, rows, prepareRow } = useTable(options, useSortBy, useAbsoluteLayout);
|
||||
|
||||
const renderRow = React.useCallback(
|
||||
({ index, style }) => {
|
||||
({ index, style }: { index: number; style: CSSProperties }) => {
|
||||
let row = rows[index];
|
||||
prepareRow(row);
|
||||
|
||||
@ -180,7 +180,7 @@ const FlameGraphTopTable = ({
|
||||
);
|
||||
};
|
||||
|
||||
const SymbolCell = ({ cell: { value } }: CellProps<TopTableValue, TopTableValue>) => {
|
||||
const SymbolCell = ({ cell: { value } }: CellProps<TopTableValue, string>) => {
|
||||
return <div>{value}</div>;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user