mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: noImplicitAny Sub 500 errors (#18287)
This commit is contained in:
@@ -32,11 +32,11 @@ interface State {
|
||||
}
|
||||
|
||||
export class EditorTabBody extends PureComponent<Props, State> {
|
||||
static defaultProps = {
|
||||
static defaultProps: Partial<Props> = {
|
||||
toolbarItems: [],
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -61,10 +61,10 @@ export class EditorTabBody extends PureComponent<Props, State> {
|
||||
this.setState({ isOpen: false });
|
||||
};
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
static getDerivedStateFromProps(props: Props, state: State) {
|
||||
if (state.openView) {
|
||||
const activeToolbarItem = props.toolbarItems.find(
|
||||
item => item.title === state.openView.title && item.icon === state.openView.icon
|
||||
(item: any) => item.title === state.openView.title && item.icon === state.openView.icon
|
||||
);
|
||||
if (activeToolbarItem) {
|
||||
return {
|
||||
|
||||
@@ -20,7 +20,7 @@ export class GeneralTab extends PureComponent<Props> {
|
||||
element: any;
|
||||
component: AngularComponent;
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ export class QueriesTab extends PureComponent<Props, State> {
|
||||
return this.datasources.find(datasource => datasource.value === panel.datasource) || this.datasources[0];
|
||||
}
|
||||
|
||||
onChangeDataSource = datasource => {
|
||||
onChangeDataSource = (datasource: any) => {
|
||||
const { panel } = this.props;
|
||||
const { currentDS } = this.state;
|
||||
|
||||
@@ -194,7 +194,7 @@ export class QueriesTab extends PureComponent<Props, State> {
|
||||
);
|
||||
};
|
||||
|
||||
onAddMixedQuery = datasource => {
|
||||
onAddMixedQuery = (datasource: any) => {
|
||||
this.onAddQuery({ datasource: datasource.name });
|
||||
this.setState({ isAddingMixed: false, scrollTop: this.state.scrollTop + 10000 });
|
||||
};
|
||||
@@ -203,7 +203,7 @@ export class QueriesTab extends PureComponent<Props, State> {
|
||||
this.setState({ isAddingMixed: false });
|
||||
};
|
||||
|
||||
onQueryChange = (query: DataQuery, index) => {
|
||||
onQueryChange = (query: DataQuery, index: number) => {
|
||||
this.props.panel.changeQuery(query, index);
|
||||
this.forceUpdate();
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
formattedJson: any;
|
||||
clipboard: any;
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
allNodesExpanded: null,
|
||||
@@ -56,7 +56,7 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
panel.events.off('refresh', this.onPanelRefresh);
|
||||
}
|
||||
|
||||
handleMocking(response) {
|
||||
handleMocking(response: any) {
|
||||
const { mockedResponse } = this.state;
|
||||
let mockedData;
|
||||
try {
|
||||
@@ -126,7 +126,7 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
}));
|
||||
};
|
||||
|
||||
setFormattedJson = formattedJson => {
|
||||
setFormattedJson = (formattedJson: any) => {
|
||||
this.formattedJson = formattedJson;
|
||||
};
|
||||
|
||||
@@ -161,7 +161,7 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
return 1;
|
||||
};
|
||||
|
||||
setMockedResponse = evt => {
|
||||
setMockedResponse = (evt: any) => {
|
||||
const mockedResponse = evt.target.value;
|
||||
this.setState(prevState => ({
|
||||
...prevState,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Libraries
|
||||
import React, { PureComponent, ChangeEvent, FocusEvent } from 'react';
|
||||
import React, { PureComponent, ChangeEvent, FocusEvent, ReactText } from 'react';
|
||||
|
||||
// Utils
|
||||
import { rangeUtil } from '@grafana/data';
|
||||
@@ -46,13 +46,13 @@ interface State {
|
||||
relativeTime: string;
|
||||
timeShift: string;
|
||||
cacheTimeout: string;
|
||||
maxDataPoints: string;
|
||||
maxDataPoints: string | ReactText;
|
||||
interval: string;
|
||||
hideTimeOverride: boolean;
|
||||
}
|
||||
|
||||
export class QueryOptions extends PureComponent<Props, State> {
|
||||
allOptions = {
|
||||
allOptions: any = {
|
||||
cacheTimeout: {
|
||||
label: 'Cache timeout',
|
||||
placeholder: '60',
|
||||
@@ -91,7 +91,7 @@ export class QueryOptions extends PureComponent<Props, State> {
|
||||
},
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -147,6 +147,7 @@ export class QueryOptions extends PureComponent<Props, State> {
|
||||
onDataSourceOptionBlur = (panelKey: string) => () => {
|
||||
const { panel } = this.props;
|
||||
|
||||
// @ts-ignore
|
||||
panel[panelKey] = this.state[panelKey];
|
||||
panel.refresh();
|
||||
};
|
||||
@@ -172,6 +173,7 @@ export class QueryOptions extends PureComponent<Props, State> {
|
||||
{...options}
|
||||
onChange={this.onDataSourceOptionChange(panelKey)}
|
||||
onBlur={this.onDataSourceOptionBlur(panelKey)}
|
||||
// @ts-ignore
|
||||
value={this.state[panelKey]}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user