fix some anys (#53789)
This commit is contained in:
+15
-69
@@ -8,7 +8,7 @@ exports[`no enzyme tests`] = {
|
||||
"packages/grafana-ui/src/components/Graph/Graph.test.tsx:1664091255": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:943686035": [
|
||||
"packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:3786619094": [
|
||||
[0, 17, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/QueryField/QueryField.test.tsx:375894800": [
|
||||
@@ -113,9 +113,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"e2e/dashboards-suite/dashboard-templating.spec.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"e2e/dashboards-suite/textbox-variables.spec.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@@ -138,8 +135,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/CircularDataFrame.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/DataFrameJSON.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@@ -207,9 +203,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-data/src/dataframe/processDataFrame.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@@ -1341,18 +1335,9 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/ColorPicker/ColorPickerPopover.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/CustomScrollbar/CustomScrollbar.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "7"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/DataLinks/DataLinkInput.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@@ -1389,20 +1374,10 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/DateTimePickers/TimeOfDayPicker.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/DateTimePickers/TimeZonePicker/TimeZoneOption.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Dropdown/ButtonSelect.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/ErrorBoundary/ErrorBoundary.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/FileDropzone/FileDropzone.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/FilterInput/FilterInput.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@@ -1410,8 +1385,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Forms/FieldArray.story.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Forms/Form.story.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@@ -1428,8 +1402,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Forms/Legacy/Select/Select.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Forms/Legacy/Select/SelectOption.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@@ -1441,10 +1414,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Gauge/Gauge.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Graph/Graph.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@@ -1499,20 +1468,15 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Input/AutoSizeInput.story.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Input/Input.story.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/JSONFormatter/json_explorer/helpers.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@@ -1530,28 +1494,17 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/List/List.story.internal.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Logs/LogRowContext.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Logs/LogRowContextProvider.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Logs/LogRowContextProvider.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "6"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Logs/LogRows.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@@ -1593,9 +1546,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Portal/Portal.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/QueryField/QueryField.test.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@@ -1650,12 +1600,8 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/Select/IndicatorsContainer.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Select/InputControl.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Select/MultiValue.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Select/Select.story.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
|
||||
@@ -2,7 +2,7 @@ import client from './client';
|
||||
import * as setup from './setup';
|
||||
|
||||
describe('/api/dashboards', () => {
|
||||
let state: any = {};
|
||||
let state = {};
|
||||
|
||||
beforeAll(async () => {
|
||||
state = await setup.ensureState({
|
||||
|
||||
@@ -2,10 +2,8 @@ import client from './client';
|
||||
import * as setup from './setup';
|
||||
|
||||
describe('/api/folders', () => {
|
||||
let state: any = {};
|
||||
|
||||
beforeAll(async () => {
|
||||
state = await setup.ensureState({
|
||||
await setup.ensureState({
|
||||
orgName: 'api-test-org',
|
||||
users: [
|
||||
{ user: setup.admin, role: 'Admin' },
|
||||
|
||||
@@ -10,7 +10,7 @@ e2e.scenario({
|
||||
// Open dashboard global variables and interpolation
|
||||
e2e.flows.openDashboard({ uid: 'HYaGDGIMk' });
|
||||
|
||||
const items: any = [];
|
||||
const items: string[] = [];
|
||||
const expectedItems: string[] = [
|
||||
'__dashboard = Templating - Global variables and interpolation',
|
||||
'__dashboard.name = Templating - Global variables and interpolation',
|
||||
|
||||
@@ -13,7 +13,7 @@ interface CircularOptions {
|
||||
*/
|
||||
export class CircularDataFrame<T = any> extends MutableDataFrame<T> {
|
||||
constructor(options: CircularOptions) {
|
||||
super(undefined, (buffer?: any[]) => {
|
||||
super(undefined, (buffer) => {
|
||||
return new CircularVector({
|
||||
...options,
|
||||
buffer,
|
||||
|
||||
@@ -92,7 +92,7 @@ export function compareArrayValues<T>(a: T[], b: T[], cmp: (a: T, b: T) => boole
|
||||
return true;
|
||||
}
|
||||
|
||||
type Cmp = (valA: any, valB: any) => boolean;
|
||||
type Cmp = (valA: unknown, valB: unknown) => boolean;
|
||||
|
||||
const defaultCmp: Cmp = (a, b) => a === b;
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class UnThemedColorPickerPopover<T extends CustomPickersDescriptor> extends Comp
|
||||
return `ColorPickerPopover__tab ${activePicker === tabName && 'ColorPickerPopover__tab--active'}`;
|
||||
};
|
||||
|
||||
handleChange = (color: any) => {
|
||||
handleChange = (color: string) => {
|
||||
const { onChange, enableNamedColors, theme } = this.props;
|
||||
if (enableNamedColors) {
|
||||
return onChange(color);
|
||||
|
||||
@@ -75,7 +75,7 @@ export const CustomScrollbar: FC<Props> = ({
|
||||
}, updateAfterMountMs);
|
||||
}, [updateAfterMountMs]);
|
||||
|
||||
function renderTrack(className: string, hideTrack: boolean | undefined, passedProps: any) {
|
||||
function renderTrack(className: string, hideTrack: boolean | undefined, passedProps: JSX.IntrinsicElements['div']) {
|
||||
if (passedProps.style && hideTrack) {
|
||||
passedProps.style.display = 'none';
|
||||
}
|
||||
@@ -84,28 +84,28 @@ export const CustomScrollbar: FC<Props> = ({
|
||||
}
|
||||
|
||||
const renderTrackHorizontal = useCallback(
|
||||
(passedProps: any) => {
|
||||
(passedProps: JSX.IntrinsicElements['div']) => {
|
||||
return renderTrack('track-horizontal', hideHorizontalTrack, passedProps);
|
||||
},
|
||||
[hideHorizontalTrack]
|
||||
);
|
||||
|
||||
const renderTrackVertical = useCallback(
|
||||
(passedProps: any) => {
|
||||
(passedProps: JSX.IntrinsicElements['div']) => {
|
||||
return renderTrack('track-vertical', hideVerticalTrack, passedProps);
|
||||
},
|
||||
[hideVerticalTrack]
|
||||
);
|
||||
|
||||
const renderThumbHorizontal = useCallback((passedProps: any) => {
|
||||
const renderThumbHorizontal = useCallback((passedProps: JSX.IntrinsicElements['div']) => {
|
||||
return <div {...passedProps} className="thumb-horizontal" />;
|
||||
}, []);
|
||||
|
||||
const renderThumbVertical = useCallback((passedProps: any) => {
|
||||
const renderThumbVertical = useCallback((passedProps: JSX.IntrinsicElements['div']) => {
|
||||
return <div {...passedProps} className="thumb-vertical" />;
|
||||
}, []);
|
||||
|
||||
const renderView = useCallback((passedProps: any) => {
|
||||
const renderView = useCallback((passedProps: JSX.IntrinsicElements['div']) => {
|
||||
return <div {...passedProps} className="scrollbar-view" />;
|
||||
}, []);
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import { TimeZoneTitle } from './TimeZoneTitle';
|
||||
interface Props {
|
||||
isFocused: boolean;
|
||||
isSelected: boolean;
|
||||
innerProps: any;
|
||||
innerProps: JSX.IntrinsicElements['div'];
|
||||
data: SelectableZone;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export interface ErrorBoundaryApi {
|
||||
interface Props {
|
||||
children: (r: ErrorBoundaryApi) => ReactNode;
|
||||
/** Will re-render children after error if recover values changes */
|
||||
dependencies?: any[];
|
||||
dependencies?: unknown[];
|
||||
/** Callback called on error */
|
||||
onError?: (error: Error) => void;
|
||||
/** Callback error state is cleared due to recover props change */
|
||||
@@ -89,7 +89,7 @@ export interface ErrorBoundaryAlertProps {
|
||||
style?: 'page' | 'alertbox';
|
||||
|
||||
/** Will re-render children after error if recover values changes */
|
||||
dependencies?: any[];
|
||||
dependencies?: unknown[];
|
||||
}
|
||||
|
||||
export class ErrorBoundaryAlert extends PureComponent<ErrorBoundaryAlertProps> {
|
||||
|
||||
@@ -127,7 +127,7 @@ describe('The FileDropzone component', () => {
|
||||
});
|
||||
});
|
||||
|
||||
function dispatchEvt(node: HTMLElement, type: string, data: any) {
|
||||
function dispatchEvt(node: HTMLElement, type: string, data: unknown) {
|
||||
const event = new Event(type, { bubbles: true });
|
||||
Object.assign(event, data);
|
||||
fireEvent(node, event);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Meta, Story } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { FieldValues } from 'react-hook-form';
|
||||
|
||||
import { Form, Input, Button, HorizontalGroup } from '@grafana/ui';
|
||||
|
||||
@@ -28,7 +29,7 @@ export default {
|
||||
} as Meta;
|
||||
|
||||
export const Simple: Story = (args) => {
|
||||
const defaultValues: any = {
|
||||
const defaultValues: FieldValues = {
|
||||
people: [{ firstName: 'Janis', lastName: 'Joplin' }],
|
||||
};
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Libraries
|
||||
import classNames from 'classnames';
|
||||
import React, { PureComponent } from 'react';
|
||||
import { default as ReactSelect, components } from 'react-select';
|
||||
import { default as ReactSelect, components, MenuListProps } from 'react-select';
|
||||
import { default as ReactAsyncSelect } from 'react-select/async';
|
||||
import Creatable from 'react-select/creatable';
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface LegacySelectProps<T> extends LegacyCommonProps<T> {
|
||||
value?: SelectableValue<T>;
|
||||
}
|
||||
|
||||
export const MenuList = (props: any) => {
|
||||
export const MenuList = (props: MenuListProps) => {
|
||||
return (
|
||||
<components.MenuList {...props}>
|
||||
<CustomScrollbar autoHide={false} autoHeightMax="inherit">
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface Props extends Themeable {
|
||||
}
|
||||
|
||||
export class Gauge extends PureComponent<Props> {
|
||||
canvasElement: any;
|
||||
canvasElement: HTMLDivElement | null = null;
|
||||
|
||||
static defaultProps: Partial<Props> = {
|
||||
showThresholdMarkers: true,
|
||||
@@ -90,7 +90,7 @@ export class Gauge extends PureComponent<Props> {
|
||||
max = +max.toFixed(decimals);
|
||||
}
|
||||
|
||||
const options: any = {
|
||||
const options = {
|
||||
series: {
|
||||
gauges: {
|
||||
gauge: {
|
||||
@@ -133,7 +133,9 @@ export class Gauge extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
try {
|
||||
$.plot(this.canvasElement, [plotSeries], options);
|
||||
if (this.canvasElement) {
|
||||
$.plot(this.canvasElement, [plotSeries], options);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Gauge rendering error', err, options, value);
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ export const Simple: Story = (args) => {
|
||||
const addonBefore = <div style={{ display: 'flex', alignItems: 'center', padding: '5px' }}>AutoSizeInput</div>;
|
||||
const prefix = args.prefixVisible;
|
||||
const suffix = args.suffixVisible;
|
||||
let prefixEl: any = prefix;
|
||||
let prefixEl = prefix;
|
||||
if (prefix && prefix.match(/icon-/g)) {
|
||||
prefixEl = <Icon name={prefix.replace(/icon-/g, '') as IconName} />;
|
||||
}
|
||||
let suffixEl: any = suffix;
|
||||
let suffixEl = suffix;
|
||||
if (suffix && suffix.match(/icon-/g)) {
|
||||
suffixEl = <Icon name={suffix.replace(/icon-/g, '') as IconName} />;
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ export const Simple: Story = (args) => {
|
||||
const addonBefore = <div style={{ display: 'flex', alignItems: 'center', padding: '5px' }}>Input</div>;
|
||||
const prefix = args.prefixVisible;
|
||||
const suffix = args.suffixVisible;
|
||||
let prefixEl: any = prefix;
|
||||
let prefixEl = prefix;
|
||||
if (prefix && prefix.match(/icon-/g)) {
|
||||
prefixEl = <Icon name={prefix.replace(/icon-/g, '') as IconName} />;
|
||||
}
|
||||
let suffixEl: any = suffix;
|
||||
let suffixEl = suffix;
|
||||
if (suffix && suffix.match(/icon-/g)) {
|
||||
suffixEl = <Icon name={suffix.replace(/icon-/g, '') as IconName} />;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import React, { PureComponent, createRef } from 'react';
|
||||
|
||||
import { JsonExplorer } from './json_explorer/json_explorer'; // We have made some monkey-patching of json-formatter-js so we can't switch right now
|
||||
import { JsonExplorer, JsonExplorerConfig } from './json_explorer/json_explorer'; // We have made some monkey-patching of json-formatter-js so we can't switch right now
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
json: {};
|
||||
config?: any;
|
||||
config?: JsonExplorerConfig;
|
||||
open?: number;
|
||||
onDidRender?: (formattedJson: any) => void;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ const generateListItems = (numberOfItems: number) => {
|
||||
};
|
||||
|
||||
const getItem = (inline = false) => {
|
||||
const rawRenderer = (item: any) => <>{item.name}</>;
|
||||
const customRenderer = (item: any, index: number) => (
|
||||
const rawRenderer = (item: ReturnType<typeof generateListItems>[0]) => <>{item.name}</>;
|
||||
const customRenderer = (item: ReturnType<typeof generateListItems>[0], index: number) => (
|
||||
<div
|
||||
className={cx([
|
||||
css`
|
||||
|
||||
@@ -4,7 +4,7 @@ import { act } from 'react-dom/test-utils';
|
||||
|
||||
import { FieldType, LogRowModel, MutableDataFrame, DataQueryResponse } from '@grafana/data';
|
||||
|
||||
import { getRowContexts, LogRowContextProvider } from './LogRowContextProvider';
|
||||
import { getRowContexts, LogRowContextProvider, RowContextOptions } from './LogRowContextProvider';
|
||||
import { createLogRow } from './__mocks__/logRow';
|
||||
|
||||
const row = createLogRow({ entry: '4', timeEpochMs: 4 });
|
||||
@@ -29,7 +29,7 @@ describe('getRowContexts', () => {
|
||||
],
|
||||
});
|
||||
let called = false;
|
||||
const getRowContextMock = (row: LogRowModel, options?: any): Promise<DataQueryResponse> => {
|
||||
const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise<DataQueryResponse> => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
return Promise.resolve({ data: [firstResult] });
|
||||
@@ -64,7 +64,7 @@ describe('getRowContexts', () => {
|
||||
],
|
||||
});
|
||||
let called = false;
|
||||
const getRowContextMock = (row: LogRowModel, options?: any): Promise<DataQueryResponse> => {
|
||||
const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise<DataQueryResponse> => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
return Promise.resolve({ data: [firstResult] });
|
||||
@@ -89,7 +89,7 @@ describe('getRowContexts', () => {
|
||||
const firstError = new Error('Error 1');
|
||||
const secondError = new Error('Error 2');
|
||||
let called = false;
|
||||
const getRowContextMock = (row: LogRowModel, options?: any): Promise<DataQueryResponse> => {
|
||||
const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise<DataQueryResponse> => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
return Promise.reject(firstError);
|
||||
@@ -136,7 +136,7 @@ describe('LogRowContextProvider', () => {
|
||||
});
|
||||
|
||||
let called = false;
|
||||
const getRowContextMock = (row: LogRowModel, options?: any): Promise<DataQueryResponse> => {
|
||||
const getRowContextMock = (row: LogRowModel, options?: RowContextOptions): Promise<DataQueryResponse> => {
|
||||
if (!called) {
|
||||
called = true;
|
||||
return Promise.resolve({ data: [firstResult] });
|
||||
@@ -145,7 +145,7 @@ describe('LogRowContextProvider', () => {
|
||||
};
|
||||
let updateLimitCalled = false;
|
||||
|
||||
const mockedChildren = jest.fn((mockState: any) => {
|
||||
const mockedChildren = jest.fn((mockState) => {
|
||||
const { result, errors, hasMoreContextRows, updateLimit, limit } = mockState;
|
||||
if (!updateLimitCalled && result.before.length === 0) {
|
||||
expect(result).toEqual({ before: [], after: [] });
|
||||
|
||||
@@ -73,7 +73,7 @@ export const getRowContexts = async (
|
||||
return [];
|
||||
}
|
||||
|
||||
const data: any[] = [];
|
||||
const data = [];
|
||||
for (let index = 0; index < dataResult.data.length; index++) {
|
||||
const dataFrame = toDataFrame(dataResult.data[index]);
|
||||
const fieldCache = new FieldCache(dataFrame);
|
||||
@@ -166,7 +166,7 @@ export const LogRowContextProvider: React.FunctionComponent<LogRowContextProvide
|
||||
// The side effect changes the hasMoreContextRows state if there are more context rows before or after the current result
|
||||
useEffect(() => {
|
||||
if (value) {
|
||||
setResult((currentResult: any) => {
|
||||
setResult((currentResult) => {
|
||||
let hasMoreLogsBefore = true,
|
||||
hasMoreLogsAfter = true;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { useTheme2 } from '../../themes';
|
||||
interface Props {
|
||||
className?: string;
|
||||
root?: HTMLElement;
|
||||
forwardedRef?: any;
|
||||
forwardedRef?: React.ForwardedRef<HTMLDivElement>;
|
||||
}
|
||||
|
||||
export function Portal(props: PropsWithChildren<Props>) {
|
||||
|
||||
@@ -14,7 +14,7 @@ interface InputControlProps {
|
||||
focused: boolean;
|
||||
invalid: boolean;
|
||||
disabled: boolean;
|
||||
innerProps: any;
|
||||
innerProps: JSX.IntrinsicElements['div'];
|
||||
}
|
||||
|
||||
const getInputControlStyles = stylesFactory((theme: GrafanaTheme2, invalid: boolean, withPrefix: boolean) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { IconButton } from '../IconButton/IconButton';
|
||||
import { getSelectStyles } from './getSelectStyles';
|
||||
|
||||
interface MultiValueContainerProps {
|
||||
innerProps: any;
|
||||
innerProps: JSX.IntrinsicElements['div'];
|
||||
}
|
||||
|
||||
export const MultiValueContainer: React.FC<MultiValueContainerProps> = ({ innerProps, children }) => {
|
||||
|
||||
Reference in New Issue
Block a user