mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: fixing some any
s/type assertions (#54661)
* fixing some anys/type assertions * make types consistent
This commit is contained in:
parent
d2bb72fb3c
commit
0ab548a8b5
@ -14,7 +14,7 @@ exports[`no enzyme tests`] = {
|
||||
"packages/grafana-ui/src/components/QueryField/QueryField.test.tsx:375894800": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/slate-plugins/braces.test.tsx:1440546721": [
|
||||
"packages/grafana-ui/src/slate-plugins/braces.test.tsx:4104231341": [
|
||||
[0, 19, 13, "RegExp match", "2409514259"]
|
||||
],
|
||||
"packages/grafana-ui/src/slate-plugins/clear.test.tsx:1085648664": [
|
||||
@ -669,12 +669,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "8"]
|
||||
],
|
||||
"packages/grafana-data/src/types/logs.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/types/logsVolume.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"packages/grafana-data/src/types/options.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -702,10 +700,8 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"packages/grafana-data/src/types/query.ts: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-data/src/types/select.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -823,17 +819,11 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"packages/grafana-data/src/utils/Registry.ts: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"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/anyToNumber.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/arrayUtils.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.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/csv.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -904,8 +894,7 @@ exports[`better eslint`] = {
|
||||
[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, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/makeClassES5Compatible.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -913,10 +902,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/object.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-data/src/utils/testdata/testTheme.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
@ -1034,9 +1019,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-e2e/src/index.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-e2e/src/support/localStorage.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -1440,9 +1422,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/JSONFormatter/JSONFormatter.tsx:5381": [
|
||||
[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"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/JSONFormatter/json_explorer/json_explorer.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -1562,9 +1541,6 @@ 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/MultiValue.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Select/Select.story.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
@ -1627,10 +1603,7 @@ exports[`better eslint`] = {
|
||||
[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.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/SingleStatShared/SingleStatBaseOptions.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -1754,10 +1727,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.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/Tags/Tag.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
@ -1789,9 +1758,6 @@ exports[`better eslint`] = {
|
||||
"packages/grafana-ui/src/components/Tooltip/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/Typeahead/TypeaheadItem.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/UnitPicker/UnitPicker.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -1854,9 +1820,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/components/uPlot/types.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -1891,8 +1854,7 @@ exports[`better eslint`] = {
|
||||
[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.", "6"]
|
||||
],
|
||||
"packages/grafana-ui/src/slate-plugins/braces.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -1988,9 +1950,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
],
|
||||
"packages/grafana-ui/src/utils/colors.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"packages/grafana-ui/src/utils/debug.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
@ -2838,8 +2797,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/core/components/TagFilter/TagBadge.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"]
|
||||
],
|
||||
"public/app/core/components/TagFilter/TagFilter.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -2859,8 +2817,7 @@ exports[`better eslint`] = {
|
||||
[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"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/core/components/connectWithCleanUp.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -2888,8 +2845,7 @@ exports[`better eslint`] = {
|
||||
[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.", "8"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "9"]
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "8"]
|
||||
],
|
||||
"public/app/core/logsModel.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -3068,9 +3024,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/core/services/keybindingSrv.ts: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.", "1"]
|
||||
],
|
||||
"public/app/core/services/search_srv.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -3177,9 +3131,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
],
|
||||
"public/app/core/utils/dag.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/core/utils/deferred.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
|
@ -165,7 +165,7 @@ export interface DataSourceWithLogsContextSupport<TQuery extends DataQuery = Dat
|
||||
showContextToggle(row?: LogRowModel): boolean;
|
||||
}
|
||||
|
||||
export const hasLogsContextSupport = (datasource: any): datasource is DataSourceWithLogsContextSupport => {
|
||||
export const hasLogsContextSupport = (datasource: unknown): datasource is DataSourceWithLogsContextSupport => {
|
||||
if (!datasource) {
|
||||
return false;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ export interface DataSourceWithLogsVolumeSupport<TQuery extends DataQuery> {
|
||||
* @internal
|
||||
*/
|
||||
export const hasLogsVolumeSupport = <TQuery extends DataQuery>(
|
||||
datasource: any
|
||||
datasource: unknown
|
||||
): datasource is DataSourceWithLogsVolumeSupport<TQuery> => {
|
||||
return (datasource as DataSourceWithLogsVolumeSupport<TQuery>).getLogsVolumeDataProvider !== undefined;
|
||||
};
|
||||
|
@ -98,7 +98,7 @@ export interface DataSourceWithQueryExportSupport<TQuery extends DataQuery> {
|
||||
* @internal
|
||||
*/
|
||||
export const hasQueryImportSupport = <TQuery extends DataQuery>(
|
||||
datasource: any
|
||||
datasource: unknown
|
||||
): datasource is DataSourceWithQueryImportSupport<TQuery> => {
|
||||
return (datasource as DataSourceWithQueryImportSupport<TQuery>).importFromAbstractQueries !== undefined;
|
||||
};
|
||||
@ -107,7 +107,7 @@ export const hasQueryImportSupport = <TQuery extends DataQuery>(
|
||||
* @internal
|
||||
*/
|
||||
export const hasQueryExportSupport = <TQuery extends DataQuery>(
|
||||
datasource: any
|
||||
datasource: unknown
|
||||
): datasource is DataSourceWithQueryExportSupport<TQuery> => {
|
||||
return (datasource as DataSourceWithQueryExportSupport<TQuery>).exportToAbstractQueries !== undefined;
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ export class Registry<T extends RegistryItem> {
|
||||
/**
|
||||
* Return a list of values by ID, or all values if not specified
|
||||
*/
|
||||
list(ids?: any[]): T[] {
|
||||
list(ids?: string[]): T[] {
|
||||
if (!this.initialized) {
|
||||
this.initialize();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { toNumber } from 'lodash';
|
||||
*
|
||||
* @internal
|
||||
* */
|
||||
export function anyToNumber(value: any): number {
|
||||
export function anyToNumber(value: unknown): number {
|
||||
if (typeof value === 'number') {
|
||||
return value;
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ const collator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'bas
|
||||
const numericCompare = (a: number, b: number) => a - b;
|
||||
|
||||
export function sortValues(sort: SortOrder.Ascending | SortOrder.Descending) {
|
||||
return (a: any, b: any) => {
|
||||
return (a: unknown, b: unknown) => {
|
||||
if (a === b) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ export function calculateLogsLabelStats(rows: LogRowModel[], label: string): Log
|
||||
return getSortedCounts(countsByValue, rowCount);
|
||||
}
|
||||
|
||||
export function calculateStats(values: any[]): LogLabelStatsModel[] {
|
||||
export function calculateStats(values: unknown[]): LogLabelStatsModel[] {
|
||||
const nonEmptyValues = values.filter((value) => value !== undefined && value !== null);
|
||||
const countsByValue = countBy(nonEmptyValues);
|
||||
return getSortedCounts(countsByValue, nonEmptyValues.length);
|
||||
|
@ -1,5 +1,5 @@
|
||||
export const objRemoveUndefined = (obj: any) => {
|
||||
return Object.keys(obj).reduce((acc: any, key) => {
|
||||
export const objRemoveUndefined = (obj: { [key: string]: unknown }) => {
|
||||
return Object.keys(obj).reduce((acc: { [key: string]: unknown }, key) => {
|
||||
if (obj[key] !== undefined) {
|
||||
acc[key] = obj[key];
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import * as typings from './typings';
|
||||
const e2eObject = {
|
||||
env: (args: string) => Cypress.env(args),
|
||||
config: () => Cypress.config(),
|
||||
blobToBase64String: (blob: any) => Cypress.Blob.blobToBase64String(blob),
|
||||
blobToBase64String: (blob: Blob) => Cypress.Blob.blobToBase64String(blob),
|
||||
imgSrcToBlob: (url: string) => Cypress.Blob.imgSrcToBlob(url),
|
||||
scenario: (args: ScenarioArguments) => e2eScenario(args),
|
||||
benchmark,
|
||||
|
@ -11,7 +11,7 @@ export function formatString(str: string): string {
|
||||
/*
|
||||
* Determines if a value is an object
|
||||
*/
|
||||
export function isObject(value: any): boolean {
|
||||
export function isObject(value: unknown): boolean {
|
||||
const type = typeof value;
|
||||
return !!value && type === 'object';
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import { useTheme2 } from '../../themes';
|
||||
import { IconButton } from '../IconButton/IconButton';
|
||||
import { IconButton, Props as IconButtonProps } from '../IconButton/IconButton';
|
||||
|
||||
import { getSelectStyles } from './getSelectStyles';
|
||||
|
||||
@ -21,7 +21,7 @@ export const MultiValueContainer: React.FC<MultiValueContainerProps> = ({ innerP
|
||||
};
|
||||
|
||||
export type MultiValueRemoveProps = {
|
||||
innerProps: any;
|
||||
innerProps: IconButtonProps;
|
||||
};
|
||||
|
||||
export const MultiValueRemove: React.FC<MultiValueRemoveProps> = ({ children, innerProps }) => {
|
||||
|
@ -181,7 +181,7 @@ describe('sharedSingleStatMigrationHandler', () => {
|
||||
});
|
||||
|
||||
it('change from angular singlestat with no enabled gauge', () => {
|
||||
const old: any = {
|
||||
const old = {
|
||||
angular: {
|
||||
format: 'ms',
|
||||
decimals: 7,
|
||||
@ -200,7 +200,7 @@ describe('sharedSingleStatMigrationHandler', () => {
|
||||
});
|
||||
|
||||
it('change from angular singlestat with tableColumn set', () => {
|
||||
const old: any = {
|
||||
const old = {
|
||||
angular: {
|
||||
tableColumn: 'info',
|
||||
},
|
||||
@ -212,7 +212,7 @@ describe('sharedSingleStatMigrationHandler', () => {
|
||||
});
|
||||
|
||||
it('change from angular singlestat with no enabled gauge', () => {
|
||||
const old: any = {
|
||||
const old = {
|
||||
angular: {
|
||||
format: 'ms',
|
||||
decimals: 7,
|
||||
|
@ -36,7 +36,7 @@ export class UnThemedTableInputCSV extends PureComponent<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
readCSV: any = debounce(() => {
|
||||
readCSV = debounce(() => {
|
||||
const { config } = this.props;
|
||||
const { text } = this.state;
|
||||
|
||||
@ -60,7 +60,7 @@ export class UnThemedTableInputCSV extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
onTextChange = (event: any) => {
|
||||
onTextChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
|
||||
this.setState({ text: event.target.value });
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ import { PartialHighlighter } from './PartialHighlighter';
|
||||
interface Props {
|
||||
isSelected: boolean;
|
||||
item: CompletionItem;
|
||||
style: any;
|
||||
style: React.CSSProperties;
|
||||
prefix?: string;
|
||||
|
||||
onClickItem?: (event: React.MouseEvent) => void;
|
||||
|
@ -217,7 +217,7 @@ export const TooltipPlugin: React.FC<TooltipPluginProps> = ({
|
||||
let series: SeriesTableRowProps[] = [];
|
||||
const frame = otherProps.data;
|
||||
const fields = frame.fields;
|
||||
const sortIdx: any[] = [];
|
||||
const sortIdx: unknown[] = [];
|
||||
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
const field = frame.fields[i];
|
||||
|
@ -6,12 +6,6 @@ import { Editor } from '@grafana/slate-react';
|
||||
|
||||
import { BracesPlugin } from './braces';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
KeyboardEvent: any;
|
||||
}
|
||||
}
|
||||
|
||||
describe('braces', () => {
|
||||
const handler = BracesPlugin().onKeyDown!;
|
||||
const nextMock = () => {};
|
||||
|
@ -108,7 +108,7 @@ function hexToHsl(color: string) {
|
||||
return tinycolor(color).toHsl();
|
||||
}
|
||||
|
||||
function hslToHex(color: any) {
|
||||
function hslToHex(color: tinycolor.ColorFormats.HSLA) {
|
||||
return tinycolor(color).toHexString();
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ export interface Props {
|
||||
label: string;
|
||||
removeIcon: boolean;
|
||||
count: number;
|
||||
onClick?: any;
|
||||
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
||||
}
|
||||
|
||||
export class TagBadge extends React.Component<Props, any> {
|
||||
@ -15,7 +15,7 @@ export class TagBadge extends React.Component<Props, any> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { label, removeIcon, count } = this.props;
|
||||
const { label, removeIcon, count, onClick } = this.props;
|
||||
const { color } = getTagColorsFromName(label);
|
||||
|
||||
const tagStyle = {
|
||||
@ -26,7 +26,7 @@ export class TagBadge extends React.Component<Props, any> {
|
||||
|
||||
return (
|
||||
<span className={`label label-tag`} style={tagStyle}>
|
||||
{removeIcon && <Icon name="times" />}
|
||||
{removeIcon && <Icon onClick={onClick} name="times" />}
|
||||
{label} {countLabel}
|
||||
</span>
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ import { TagBadge } from './TagBadge';
|
||||
export interface Props {
|
||||
value: any;
|
||||
className: any;
|
||||
onClick: any;
|
||||
onClick: React.MouseEventHandler<HTMLDivElement>;
|
||||
onRemove: any;
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export class TagValue extends React.Component<Props, any> {
|
||||
this.onClick = this.onClick.bind(this);
|
||||
}
|
||||
|
||||
onClick(event: React.SyntheticEvent) {
|
||||
onClick(event: React.MouseEvent<HTMLDivElement>) {
|
||||
this.props.onRemove(this.props.value, event);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ describe('filterLogLevels()', () => {
|
||||
});
|
||||
});
|
||||
|
||||
const emptyLogsModel: any = {
|
||||
const emptyLogsModel = {
|
||||
hasUniqueLabels: false,
|
||||
rows: [],
|
||||
meta: [],
|
||||
|
@ -154,7 +154,7 @@ export class KeybindingSrv {
|
||||
bind(keyArg: string | string[], fn: () => void) {
|
||||
Mousetrap.bind(
|
||||
keyArg,
|
||||
(evt: any) => {
|
||||
(evt) => {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
evt.returnValue = false;
|
||||
@ -167,7 +167,7 @@ export class KeybindingSrv {
|
||||
bindGlobal(keyArg: string, fn: () => void) {
|
||||
Mousetrap.bindGlobal(
|
||||
keyArg,
|
||||
(evt: any) => {
|
||||
(evt) => {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
evt.returnValue = false;
|
||||
|
@ -101,7 +101,7 @@ export class Node {
|
||||
}
|
||||
|
||||
getOptimizedInputEdges(): Edge[] {
|
||||
const toBeRemoved: any[] = [];
|
||||
const toBeRemoved: Edge[] = [];
|
||||
this.inputEdges.forEach((e) => {
|
||||
const inputEdgesNodes = e.inputNode?.inputEdges.map((e) => e.inputNode);
|
||||
|
||||
|
@ -77,7 +77,7 @@ export class TeamMemberRow extends PureComponent<Props> {
|
||||
return (
|
||||
<td>
|
||||
{labels.map((label) => (
|
||||
<TagBadge key={label} label={label} removeIcon={false} count={0} onClick={() => {}} />
|
||||
<TagBadge key={label} label={label} removeIcon={false} count={0} />
|
||||
))}
|
||||
</td>
|
||||
);
|
||||
|
@ -75,7 +75,7 @@ export class TeamMembers extends PureComponent<Props, State> {
|
||||
return (
|
||||
<td>
|
||||
{labels.map((label) => (
|
||||
<TagBadge key={label} label={label} removeIcon={false} count={0} onClick={() => {}} />
|
||||
<TagBadge key={label} label={label} removeIcon={false} count={0} />
|
||||
))}
|
||||
</td>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user