mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Upgrade typescript to 3.7 (#20375)
* Chore: Upgrade typescript to 3.7
This commit is contained in:
@@ -34,7 +34,7 @@ export class AdHocFilterField<
|
||||
> extends React.PureComponent<Props<TQuery, TOptions>, State> {
|
||||
state: State = { pairs: [] };
|
||||
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
componentDidUpdate(prevProps: Props<TQuery, TOptions>) {
|
||||
if (_.isEqual(prevProps.extendedOptions, this.props.extendedOptions) === false) {
|
||||
const pairs: any[] = [];
|
||||
|
||||
|
||||
@@ -146,7 +146,6 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
|
||||
<div className="query-row">
|
||||
<div className="query-row-field flex-shrink-1">
|
||||
{QueryField ? (
|
||||
//@ts-ignore
|
||||
<QueryField
|
||||
datasource={datasourceInstance}
|
||||
query={query}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
|
||||
import { expressionDatasource } from 'app/features/expressions/ExpressionDatasource';
|
||||
|
||||
export class DatasourceSrv implements DataSourceService {
|
||||
datasources: { [name: string]: DataSourceApi };
|
||||
datasources: Record<string, DataSourceApi>;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(
|
||||
@@ -60,7 +60,7 @@ export class DatasourceSrv implements DataSourceService {
|
||||
loadDatasource(name: string): Promise<DataSourceApi> {
|
||||
// Expression Datasource (not a real datasource)
|
||||
if (name === expressionDatasource.name) {
|
||||
this.datasources[name] = expressionDatasource;
|
||||
this.datasources[name] = expressionDatasource as any;
|
||||
return this.$q.when(expressionDatasource);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,17 @@ import config from 'app/core/config';
|
||||
import TimeSeries from 'app/core/time_series2';
|
||||
import TableModel from 'app/core/table_model';
|
||||
import { coreModule, appEvents, contextSrv } from 'app/core/core';
|
||||
import { DataSourcePlugin, AppPlugin, PanelPlugin, PluginMeta, DataSourcePluginMeta, dateMath } from '@grafana/data';
|
||||
import {
|
||||
DataSourcePlugin,
|
||||
AppPlugin,
|
||||
PanelPlugin,
|
||||
PluginMeta,
|
||||
DataSourcePluginMeta,
|
||||
dateMath,
|
||||
DataSourceApi,
|
||||
DataSourceJsonData,
|
||||
DataQuery,
|
||||
} from '@grafana/data';
|
||||
import * as fileExport from 'app/core/utils/file_export';
|
||||
import * as flatten from 'app/core/utils/flatten';
|
||||
import * as ticks from 'app/core/utils/ticks';
|
||||
@@ -180,16 +190,20 @@ export async function importPluginModule(path: string): Promise<any> {
|
||||
return grafanaRuntime.SystemJS.import(path);
|
||||
}
|
||||
|
||||
export function importDataSourcePlugin(meta: DataSourcePluginMeta): Promise<DataSourcePlugin<any>> {
|
||||
export function importDataSourcePlugin(meta: DataSourcePluginMeta): Promise<GenericDataSourcePlugin> {
|
||||
return importPluginModule(meta.module).then(pluginExports => {
|
||||
if (pluginExports.plugin) {
|
||||
const dsPlugin = pluginExports.plugin as DataSourcePlugin<any>;
|
||||
const dsPlugin = pluginExports.plugin as GenericDataSourcePlugin;
|
||||
dsPlugin.meta = meta;
|
||||
return dsPlugin;
|
||||
}
|
||||
|
||||
if (pluginExports.Datasource) {
|
||||
const dsPlugin = new DataSourcePlugin(pluginExports.Datasource);
|
||||
const dsPlugin = new DataSourcePlugin<
|
||||
DataSourceApi<DataQuery, DataSourceJsonData>,
|
||||
DataQuery,
|
||||
DataSourceJsonData
|
||||
>(pluginExports.Datasource);
|
||||
dsPlugin.setComponentsFromLegacyExports(pluginExports);
|
||||
dsPlugin.meta = meta;
|
||||
return dsPlugin;
|
||||
@@ -210,6 +224,7 @@ export function importAppPlugin(meta: PluginMeta): Promise<AppPlugin> {
|
||||
}
|
||||
|
||||
import { getPanelPluginNotFound, getPanelPluginLoadError } from '../dashboard/dashgrid/PanelPluginError';
|
||||
import { GenericDataSourcePlugin } from '../datasources/settings/PluginSettings';
|
||||
|
||||
interface PanelCache {
|
||||
[key: string]: PanelPlugin;
|
||||
|
||||
Reference in New Issue
Block a user