mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Fix some more typescript strict errors (#37750)
This commit is contained in:
@@ -1,29 +1,33 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { dateTimeFormat } from '@grafana/data';
|
||||
import { Legend, Form } from '@grafana/ui';
|
||||
import { connect, MapDispatchToProps, MapStateToProps } from 'react-redux';
|
||||
import { connect, ConnectedProps } from 'react-redux';
|
||||
import { ImportDashboardForm } from './ImportDashboardForm';
|
||||
import { clearLoadedDashboard, importDashboard } from '../state/actions';
|
||||
import { DashboardInputs, DashboardSource, ImportDashboardDTO } from '../state/reducers';
|
||||
import { DashboardSource, ImportDashboardDTO } from '../state/reducers';
|
||||
import { StoreState } from 'app/types';
|
||||
import { locationService } from '@grafana/runtime';
|
||||
|
||||
interface OwnProps {}
|
||||
const mapStateToProps = (state: StoreState) => {
|
||||
const searchObj = locationService.getSearchObject();
|
||||
|
||||
interface ConnectedProps {
|
||||
dashboard: ImportDashboardDTO;
|
||||
inputs: DashboardInputs;
|
||||
source: DashboardSource;
|
||||
meta?: any;
|
||||
folder: { id: number; title?: string };
|
||||
}
|
||||
return {
|
||||
dashboard: state.importDashboard.dashboard,
|
||||
meta: state.importDashboard.meta,
|
||||
source: state.importDashboard.source,
|
||||
inputs: state.importDashboard.inputs,
|
||||
folder: searchObj.folderId ? { id: Number(searchObj.folderId) } : { id: 0 },
|
||||
};
|
||||
};
|
||||
|
||||
interface DispatchProps {
|
||||
clearLoadedDashboard: typeof clearLoadedDashboard;
|
||||
importDashboard: typeof importDashboard;
|
||||
}
|
||||
const mapDispatchToProps = {
|
||||
clearLoadedDashboard,
|
||||
importDashboard,
|
||||
};
|
||||
|
||||
type Props = OwnProps & ConnectedProps & DispatchProps;
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
type Props = ConnectedProps<typeof connector>;
|
||||
|
||||
interface State {
|
||||
uidReset: boolean;
|
||||
@@ -109,22 +113,5 @@ class ImportDashboardOverviewUnConnected extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps: MapStateToProps<ConnectedProps, OwnProps, StoreState> = (state: StoreState) => {
|
||||
const searchObj = locationService.getSearchObject();
|
||||
|
||||
return {
|
||||
dashboard: state.importDashboard.dashboard,
|
||||
meta: state.importDashboard.meta,
|
||||
source: state.importDashboard.source,
|
||||
inputs: state.importDashboard.inputs,
|
||||
folder: searchObj.folderId ? { id: Number(searchObj.folderId) } : { id: 0 },
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps: MapDispatchToProps<DispatchProps, OwnProps> = {
|
||||
clearLoadedDashboard,
|
||||
importDashboard,
|
||||
};
|
||||
|
||||
export const ImportDashboardOverview = connect(mapStateToProps, mapDispatchToProps)(ImportDashboardOverviewUnConnected);
|
||||
export const ImportDashboardOverview = connector(ImportDashboardOverviewUnConnected);
|
||||
ImportDashboardOverview.displayName = 'ImportDashboardOverview';
|
||||
|
@@ -65,7 +65,7 @@ export const usePluginsByFilter = (queries: PluginsByFilterType): FilteredPlugin
|
||||
const { loading, error, plugins } = usePlugins();
|
||||
|
||||
const filteredPlugins = plugins.filter((plugin) =>
|
||||
Object.keys(queries).every((query: keyof PluginsByFilterType) =>
|
||||
(Object.keys(queries) as Array<keyof PluginsByFilterType>).every((query) =>
|
||||
typeof URLFilterHandlers[query] === 'function' ? URLFilterHandlers[query](plugin, queries[query]) : true
|
||||
)
|
||||
);
|
||||
|
@@ -7,7 +7,9 @@ import { SelectableValue } from '@grafana/data';
|
||||
// eslint-disable-next-line lodash/import-scope
|
||||
import _, { Cancelable } from 'lodash';
|
||||
|
||||
jest.spyOn(_, 'debounce').mockImplementation((func: ((...args: any) => any) & Cancelable, wait: number) => func);
|
||||
jest
|
||||
.spyOn(_, 'debounce')
|
||||
.mockImplementation((func: (...args: any) => any, wait?: number) => func as typeof func & Cancelable);
|
||||
|
||||
describe('CloudWatchLogsQueryField', () => {
|
||||
it('updates upstream query log groups on region change', async () => {
|
||||
|
@@ -65,8 +65,8 @@ export interface CloudWatchJsonData extends AwsAuthDataSourceJsonData {
|
||||
}
|
||||
|
||||
export interface CloudWatchSecureJsonData extends AwsAuthDataSourceSecureJsonData {
|
||||
accessKey: string;
|
||||
secretKey: string;
|
||||
accessKey?: string;
|
||||
secretKey?: string;
|
||||
}
|
||||
|
||||
export interface GetQueryResultsRequest {
|
||||
|
@@ -11,7 +11,7 @@ export interface Props {
|
||||
onUpdateSecureJsonDataOption: (
|
||||
key: keyof AzureDataSourceSecureJsonData
|
||||
) => (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => void;
|
||||
onResetOptionKey: (key: string) => void;
|
||||
onResetOptionKey: (key: keyof AzureDataSourceSecureJsonData) => void;
|
||||
}
|
||||
export class InsightsConfig extends PureComponent<Props> {
|
||||
onAppInsightsResetApiKey = () => {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { InlineFieldRow, InlineField, Select, Input } from '@grafana/ui';
|
||||
import { InlineFieldRow, InlineField, Select, MultiSelect, Input } from '@grafana/ui';
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
import { USAQuery } from '../types';
|
||||
|
||||
@@ -35,26 +35,24 @@ export function USAQueryEditor({ query, onChange }: Props) {
|
||||
</InlineFieldRow>
|
||||
<InlineFieldRow>
|
||||
<InlineField labelWidth={14} label="Fields">
|
||||
<Select
|
||||
<MultiSelect
|
||||
menuShouldPortal
|
||||
options={fieldNames}
|
||||
onChange={(vals: SelectableValue[]) => {
|
||||
onChange({ ...query, fields: vals.map((v) => v.value) });
|
||||
}}
|
||||
width={32}
|
||||
isMulti={true}
|
||||
placeholder="all"
|
||||
value={query.fields}
|
||||
/>
|
||||
</InlineField>
|
||||
<InlineField label="States" grow>
|
||||
<Select
|
||||
<MultiSelect
|
||||
menuShouldPortal
|
||||
options={stateNames}
|
||||
onChange={(vals: SelectableValue[]) => {
|
||||
onChange({ ...query, states: vals.map((v) => v.value) });
|
||||
}}
|
||||
isMulti={true}
|
||||
placeholder="all"
|
||||
value={query.states}
|
||||
/>
|
||||
|
@@ -3,7 +3,7 @@ set -e
|
||||
|
||||
echo -e "Collecting code stats (typescript errors & more)"
|
||||
|
||||
ERROR_COUNT_LIMIT=61
|
||||
ERROR_COUNT_LIMIT=50
|
||||
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
|
||||
|
||||
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
|
||||
|
Reference in New Issue
Block a user