Chore: Remove some anys (#110661)
* removing some (hopefully) dead code * fix some more any * more any fixes * manually add suppressions * remove type assertion * couple more
This commit is contained in:
+12
-52
@@ -2374,9 +2374,6 @@
|
||||
"public/app/features/dashboard-scene/v2schema/ImportDashboardOverviewV2.tsx": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 10
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/features/dashboard-scene/v2schema/test-helpers.ts": {
|
||||
@@ -3472,11 +3469,6 @@
|
||||
"count": 9
|
||||
}
|
||||
},
|
||||
"public/app/features/transformers/FilterByValueTransformer/ValueMatchers/BasicMatcherEditor.tsx": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/features/transformers/FilterByValueTransformer/ValueMatchers/types.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 3
|
||||
@@ -3575,7 +3567,7 @@
|
||||
},
|
||||
"public/app/features/transformers/spatial/optionsHelper.tsx": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 3
|
||||
"count": 2
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 3
|
||||
@@ -3993,7 +3985,7 @@
|
||||
},
|
||||
"public/app/plugins/datasource/cloudwatch/language/cloudwatch-logs/CloudWatchLogsLanguageProvider.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 3
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/cloudwatch/types.ts": {
|
||||
@@ -4026,7 +4018,7 @@
|
||||
},
|
||||
"public/app/plugins/datasource/elasticsearch/LanguageProvider.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 4
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/elasticsearch/QueryBuilder.ts": {
|
||||
@@ -4139,9 +4131,6 @@
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationQueryEditor.tsx": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 1
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationSchemaForm.tsx": {
|
||||
@@ -4152,9 +4141,6 @@
|
||||
"public/app/plugins/datasource/grafana-testdata-datasource/datasource.ts": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 1
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/grafana/components/AnnotationQueryEditor.tsx": {
|
||||
@@ -4168,9 +4154,6 @@
|
||||
"public/app/plugins/datasource/grafana/components/QueryEditor.tsx": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 2
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/grafana/components/TimeRegionEditor.tsx": {
|
||||
@@ -4201,7 +4184,7 @@
|
||||
"count": 4
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 15
|
||||
"count": 10
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/graphite/gfunc.ts": {
|
||||
@@ -4217,7 +4200,7 @@
|
||||
"count": 1
|
||||
},
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 10
|
||||
"count": 9
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/graphite/lexer.ts": {
|
||||
@@ -4318,12 +4301,12 @@
|
||||
},
|
||||
"public/app/plugins/datasource/influxdb/influx_series.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 9
|
||||
"count": 8
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/influxdb/query_part.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 14
|
||||
"count": 12
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/influxdb/response_parser.ts": {
|
||||
@@ -4336,11 +4319,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/loki/LanguageProvider.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/loki/LogContextProvider.ts": {
|
||||
"no-restricted-syntax": {
|
||||
"count": 2
|
||||
@@ -4361,11 +4339,6 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/loki/configuration/ConfigEditor.tsx": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/loki/configuration/DerivedField.tsx": {
|
||||
"no-restricted-syntax": {
|
||||
"count": 13
|
||||
@@ -4448,7 +4421,7 @@
|
||||
},
|
||||
"public/app/plugins/datasource/opentsdb/datasource.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 18
|
||||
"count": 16
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/parca/QueryEditor/QueryOptions.tsx": {
|
||||
@@ -4487,9 +4460,6 @@
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/tempo/_importedDependencies/components/AdHocFilter/AdHocFilterRenderer.tsx": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
},
|
||||
"no-restricted-syntax": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -4527,11 +4497,6 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/tempo/language_provider.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/tempo/resultTransformer.ts": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 2
|
||||
@@ -4559,11 +4524,6 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/datasource/zipkin/utils/transforms.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"public/app/plugins/panel/annolist/AnnoListPanel.tsx": {
|
||||
"@typescript-eslint/consistent-type-assertions": {
|
||||
"count": 1
|
||||
@@ -4913,12 +4873,12 @@
|
||||
},
|
||||
"public/app/types/events.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 9
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"public/app/types/jquery/jquery.d.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 8
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"public/app/types/store.ts": {
|
||||
@@ -4956,7 +4916,7 @@
|
||||
},
|
||||
"public/test/core/thunk/thunkTester.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 6
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"public/test/global-jquery-shim.ts": {
|
||||
@@ -4981,7 +4941,7 @@
|
||||
},
|
||||
"public/test/specs/helpers.ts": {
|
||||
"@typescript-eslint/no-explicit-any": {
|
||||
"count": 5
|
||||
"count": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export function ImportDashboardOverviewV2() {
|
||||
if (element.kind === 'Panel') {
|
||||
const panel = { ...element.spec };
|
||||
if (panel.data?.kind === 'QueryGroup') {
|
||||
const newQueries = panel.data.spec.queries.map((query: any) => {
|
||||
const newQueries = panel.data.spec.queries.map((query) => {
|
||||
if (query.kind === 'PanelQuery') {
|
||||
const queryType = query.spec.query?.kind;
|
||||
// Match datasource by query kind
|
||||
|
||||
+9
-9
@@ -9,7 +9,7 @@ import { getVariableSuggestions, numberOrVariableValidator } from '../../utils';
|
||||
|
||||
import { ValueMatcherEditorConfig, ValueMatcherUIProps, ValueMatcherUIRegistryItem } from './types';
|
||||
|
||||
export function basicMatcherEditor<T = any>(
|
||||
export function basicMatcherEditor(
|
||||
config: ValueMatcherEditorConfig
|
||||
): React.FC<ValueMatcherUIProps<BasicValueMatcherOptions>> {
|
||||
return function Render({ options, onChange }) {
|
||||
@@ -46,56 +46,56 @@ export const getBasicValueMatchersUI = (): Array<ValueMatcherUIRegistryItem<Basi
|
||||
{
|
||||
name: 'Is greater',
|
||||
id: ValueMatcherID.greater,
|
||||
component: basicMatcherEditor<string | number>({
|
||||
component: basicMatcherEditor({
|
||||
validator: numberOrVariableValidator,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is greater or equal',
|
||||
id: ValueMatcherID.greaterOrEqual,
|
||||
component: basicMatcherEditor<string | number>({
|
||||
component: basicMatcherEditor({
|
||||
validator: numberOrVariableValidator,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is lower',
|
||||
id: ValueMatcherID.lower,
|
||||
component: basicMatcherEditor<string | number>({
|
||||
component: basicMatcherEditor({
|
||||
validator: numberOrVariableValidator,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is lower or equal',
|
||||
id: ValueMatcherID.lowerOrEqual,
|
||||
component: basicMatcherEditor<string | number>({
|
||||
component: basicMatcherEditor({
|
||||
validator: numberOrVariableValidator,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is equal',
|
||||
id: ValueMatcherID.equal,
|
||||
component: basicMatcherEditor<string | number | boolean>({
|
||||
component: basicMatcherEditor({
|
||||
validator: () => true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is not equal',
|
||||
id: ValueMatcherID.notEqual,
|
||||
component: basicMatcherEditor<string | number | boolean>({
|
||||
component: basicMatcherEditor({
|
||||
validator: () => true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is Substring',
|
||||
id: ValueMatcherID.substring,
|
||||
component: basicMatcherEditor<string | number | boolean>({
|
||||
component: basicMatcherEditor({
|
||||
validator: () => true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: 'Is not substring',
|
||||
id: ValueMatcherID.notSubstring,
|
||||
component: basicMatcherEditor<string | number | boolean>({
|
||||
component: basicMatcherEditor({
|
||||
validator: () => true,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -36,7 +36,7 @@ export function getTransformerOptionPane<T = any>(
|
||||
const access: NestedValueAccess = {
|
||||
getValue: (path) => lodashGet(props.options, path),
|
||||
onChange: (path, value) => {
|
||||
props.onChange(setOptionImmutably(props.options as any, path, value));
|
||||
props.onChange(setOptionImmutably<any>(props.options, path, value));
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+7
-7
@@ -35,13 +35,11 @@ export class CloudWatchLogsLanguageProvider extends LanguageProvider {
|
||||
datasource: CloudWatchDatasource;
|
||||
templateSrv: TemplateSrv;
|
||||
|
||||
constructor(datasource: CloudWatchDatasource, templateSrv?: TemplateSrv, initialValues?: any) {
|
||||
constructor(datasource: CloudWatchDatasource, templateSrv?: TemplateSrv) {
|
||||
super();
|
||||
|
||||
this.datasource = datasource;
|
||||
this.templateSrv = templateSrv ?? getTemplateSrv();
|
||||
|
||||
Object.assign(this, initialValues);
|
||||
}
|
||||
|
||||
// Strip syntax chars
|
||||
@@ -90,15 +88,17 @@ export class CloudWatchLogsLanguageProvider extends LanguageProvider {
|
||||
const { value } = input;
|
||||
|
||||
// Get tokens
|
||||
const tokens = value?.data.get('tokens');
|
||||
const tokens: Token[] = value?.data.get('tokens');
|
||||
|
||||
if (!tokens || !tokens.length) {
|
||||
return { suggestions: [] };
|
||||
}
|
||||
|
||||
const curToken: Token = tokens.filter(
|
||||
(token: any) =>
|
||||
token.offsets.start <= value!.selection?.start?.offset && token.offsets.end >= value!.selection?.start?.offset
|
||||
const curToken = tokens.filter(
|
||||
(token) =>
|
||||
token.offsets &&
|
||||
token.offsets.start <= value!.selection?.start?.offset &&
|
||||
token.offsets.end >= value!.selection?.start?.offset
|
||||
)[0];
|
||||
|
||||
const isFirstToken = !curToken.prev;
|
||||
|
||||
@@ -8,11 +8,9 @@ export default class ElasticsearchLanguageProvider extends LanguageProvider {
|
||||
declare start: () => Promise<any[]>;
|
||||
datasource: ElasticDatasource;
|
||||
|
||||
constructor(datasource: ElasticDatasource, initialValues?: any) {
|
||||
constructor(datasource: ElasticDatasource) {
|
||||
super();
|
||||
this.datasource = datasource;
|
||||
|
||||
Object.assign(this, initialValues);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ import { InlineField, InlineFieldRow, InlineSwitch, Input, Label, Select } from
|
||||
import { EditorProps } from '../QueryEditor';
|
||||
import { SimulationQuery } from '../dataquery';
|
||||
|
||||
import { SimulationSchemaForm } from './SimulationSchemaForm';
|
||||
import { SimulationSchemaForm, type Config } from './SimulationSchemaForm';
|
||||
|
||||
// Type string `json:"type"`
|
||||
// Name string `json:"name"`
|
||||
@@ -27,7 +27,7 @@ export const SimulationQueryEditor = ({ onChange, query, ds }: EditorProps) => {
|
||||
const simQuery = query.sim ?? ({} as SimulationQuery);
|
||||
const simKey = simQuery.key ?? {};
|
||||
// keep track of updated config state to pass down to form
|
||||
const [cfgValue, setCfgValue] = useState<Record<string, any>>({});
|
||||
const [cfgValue, setCfgValue] = useState<Config>({});
|
||||
|
||||
// This only changes once
|
||||
const info = useAsync(async () => {
|
||||
@@ -85,7 +85,7 @@ export const SimulationQueryEditor = ({ onChange, query, ds }: EditorProps) => {
|
||||
onChange({ ...query, sim: { ...simQuery, last: !simQuery.last } });
|
||||
};
|
||||
|
||||
const onSchemaFormChange = (config: Record<string, any>) => {
|
||||
const onSchemaFormChange = (config: Config) => {
|
||||
let path = simKey.type + '/' + simKey.tick + 'hz';
|
||||
if (simKey.uid) {
|
||||
path += '/' + simKey.uid;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import { FormEvent, useState, ChangeEvent } from 'react';
|
||||
import { DataFrameSchema, FieldSchema, GrafanaTheme2 } from '@grafana/data';
|
||||
import { useStyles2, TextArea, InlineField, Input, FieldSet, InlineSwitch } from '@grafana/ui';
|
||||
|
||||
type Config = Record<string, any>;
|
||||
export type Config = Record<string, any>;
|
||||
|
||||
interface SchemaFormProps {
|
||||
config: Config;
|
||||
|
||||
@@ -386,7 +386,7 @@ export class TestDataDataSource extends DataSourceWithBackend<TestDataDataQuery>
|
||||
options: DataQueryRequest<TestDataDataQuery>
|
||||
): Observable<DataQueryResponse> {
|
||||
try {
|
||||
const data = JSON.parse(target.rawFrameContent ?? '[]').map((v: any) => {
|
||||
const data = JSON.parse(target.rawFrameContent ?? '[]').map((v: unknown) => {
|
||||
const f = toDataFrame(v);
|
||||
f.refId = target.refId;
|
||||
return f;
|
||||
|
||||
@@ -108,7 +108,7 @@ export class UnthemedQueryEditor extends PureComponent<Props, State> {
|
||||
loadFolderInfo() {
|
||||
const query: DataQueryRequest<GrafanaQuery> = {
|
||||
targets: [{ queryType: GrafanaQueryType.List, refId: 'A' }],
|
||||
} as any;
|
||||
} as DataQueryRequest<GrafanaQuery>;
|
||||
|
||||
getDataSourceSrv()
|
||||
.get('-- Grafana --')
|
||||
|
||||
@@ -679,7 +679,7 @@ export class GraphiteDatasource
|
||||
private requestMetricFind(
|
||||
query: string,
|
||||
requestId: string,
|
||||
range?: { from: any; until: any }
|
||||
range?: { from: string | number; until: string | number }
|
||||
): Promise<MetricFindValue[]> {
|
||||
const params: BackendSrvRequest['params'] = {};
|
||||
|
||||
@@ -722,7 +722,7 @@ export class GraphiteDatasource
|
||||
private requestMetricExpand(
|
||||
query: string,
|
||||
requestId: string,
|
||||
range?: { from: any; until: any }
|
||||
range?: { from: string | number; until: string | number }
|
||||
): Promise<MetricFindValue[]> {
|
||||
const params: BackendSrvRequest['params'] = { query };
|
||||
if (range) {
|
||||
@@ -901,7 +901,7 @@ export class GraphiteDatasource
|
||||
);
|
||||
}
|
||||
|
||||
createFuncInstance(funcDef: string | FuncDef, options?: any): FuncInstance {
|
||||
createFuncInstance(funcDef: string | FuncDef, options?: { withDefaultParams: boolean }): FuncInstance {
|
||||
return gfunc.createFuncInstance(funcDef, options, this.funcDefs);
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ export default class GraphiteQuery {
|
||||
this.functions.forEach((func) => (func.added = false));
|
||||
}
|
||||
|
||||
updateRenderedTarget(target: { refId: string | number; target: any; targetFull: any }, targets: any) {
|
||||
updateRenderedTarget(target: { refId: string | number; target: string; targetFull: any }, targets: any) {
|
||||
// render nested query
|
||||
const targetsByRefId = keyBy(targets, 'refId');
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ export default class InfluxSeries {
|
||||
//
|
||||
// we have to keep this order both in table.columns and table.rows
|
||||
|
||||
each(this.series, (series: any, seriesIndex: number) => {
|
||||
each(this.series, (series, seriesIndex: number) => {
|
||||
if (seriesIndex === 0) {
|
||||
const firstCol = series.columns[0];
|
||||
// Check the first column's name, if it is `time`, we
|
||||
|
||||
@@ -2,9 +2,10 @@ import { clone, map } from 'lodash';
|
||||
|
||||
import { functionRenderer, QueryPart, QueryPartDef, suffixRenderer } from 'app/features/alerting/state/query_part';
|
||||
|
||||
const index: any[] = [];
|
||||
const index: QueryPartDef[] = [];
|
||||
const categories = {
|
||||
Aggregations: [],
|
||||
GroupByTimeFunctions: [],
|
||||
Selectors: [],
|
||||
Transformations: [],
|
||||
Predictors: [],
|
||||
@@ -27,8 +28,6 @@ function register(options: any) {
|
||||
options.category.push(index[options.type]);
|
||||
}
|
||||
|
||||
const groupByTimeFunctions: any[] = [];
|
||||
|
||||
function aliasRenderer(part: { params: string[] }, innerExpr: string) {
|
||||
return innerExpr + ' AS ' + '"' + part.params[0] + '"';
|
||||
}
|
||||
@@ -308,7 +307,7 @@ register({
|
||||
|
||||
register({
|
||||
type: 'time',
|
||||
category: groupByTimeFunctions,
|
||||
category: categories.GroupByTimeFunctions,
|
||||
params: [
|
||||
{
|
||||
name: 'interval',
|
||||
@@ -322,7 +321,7 @@ register({
|
||||
|
||||
register({
|
||||
type: 'fill',
|
||||
category: groupByTimeFunctions,
|
||||
category: categories.GroupByTimeFunctions,
|
||||
params: [
|
||||
{
|
||||
name: 'fill',
|
||||
@@ -440,7 +439,7 @@ register({
|
||||
|
||||
register({
|
||||
type: 'tag',
|
||||
category: groupByTimeFunctions,
|
||||
category: categories.GroupByTimeFunctions,
|
||||
params: [{ name: 'tag', type: 'string', dynamicLookup: true }],
|
||||
defaultParams: ['tag'],
|
||||
renderer: fieldRenderer,
|
||||
|
||||
@@ -36,13 +36,11 @@ export default class LokiLanguageProvider extends LanguageProvider {
|
||||
private labelsPromisesCache = new LRUCache<string, Promise<string[]>>({ max: 10 });
|
||||
private detectedLabelValuesPromisesCache = new LRUCache<string, Promise<string[]>>({ max: 10 });
|
||||
|
||||
constructor(datasource: LokiDatasource, initialValues?: any) {
|
||||
constructor(datasource: LokiDatasource) {
|
||||
super();
|
||||
|
||||
this.datasource = datasource;
|
||||
this.labelKeys = [];
|
||||
|
||||
Object.assign(this, initialValues);
|
||||
}
|
||||
|
||||
request = async (
|
||||
|
||||
@@ -19,7 +19,7 @@ import { QuerySettings } from './QuerySettings';
|
||||
export type Props = DataSourcePluginOptionsEditorProps<LokiOptions>;
|
||||
|
||||
const makeJsonUpdater =
|
||||
<T extends any>(field: keyof LokiOptions) =>
|
||||
<T,>(field: keyof LokiOptions) =>
|
||||
(options: DataSourceSettings<LokiOptions>, value: T): DataSourceSettings<LokiOptions> => {
|
||||
return {
|
||||
...options,
|
||||
|
||||
@@ -38,7 +38,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
|
||||
url: string;
|
||||
name: string;
|
||||
withCredentials: boolean;
|
||||
basicAuth: any;
|
||||
basicAuth: string;
|
||||
tsdbVersion: number;
|
||||
tsdbResolution: number;
|
||||
lookupLimit: number;
|
||||
@@ -196,7 +196,7 @@ export default class OpenTsDatasource extends DataSourceApi<OpenTsdbQuery, OpenT
|
||||
);
|
||||
}
|
||||
|
||||
targetContainsTemplate(target: any) {
|
||||
targetContainsTemplate(target: OpenTsdbQuery) {
|
||||
if (target.filters && target.filters.length > 0) {
|
||||
for (let i = 0; i < target.filters.length; i++) {
|
||||
if (this.templateSrv.containsTemplate(target.filters[i].filter)) {
|
||||
|
||||
-1
@@ -12,7 +12,6 @@ interface Props {
|
||||
onOperatorChange: (item: SelectableValue<string>) => void;
|
||||
onValueChange: (item: SelectableValue<string>) => void;
|
||||
placeHolder?: string;
|
||||
getTagKeysOptions?: any;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,11 +34,10 @@ export default class TempoLanguageProvider extends LanguageProvider {
|
||||
tagsV2?: Scope[];
|
||||
private previousRange?: TimeRange;
|
||||
|
||||
constructor(datasource: TempoDatasource, initialValues?: any) {
|
||||
constructor(datasource: TempoDatasource) {
|
||||
super();
|
||||
|
||||
this.datasource = datasource;
|
||||
Object.assign(this, initialValues);
|
||||
}
|
||||
|
||||
request = async (url: string, params = {}) => {
|
||||
|
||||
@@ -130,7 +130,7 @@ function valueToTag<T>(key: string, value: T): TraceKeyValuePair<T> | undefined
|
||||
/**
|
||||
* Transforms data frame to Zipkin response
|
||||
*/
|
||||
export const transformToZipkin = (data: MutableDataFrame): ZipkinSpan[] => {
|
||||
export const transformToZipkin = (data: MutableDataFrame<TraceSpanRow>): ZipkinSpan[] => {
|
||||
let response: ZipkinSpan[] = [];
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
@@ -143,24 +143,24 @@ export const transformToZipkin = (data: MutableDataFrame): ZipkinSpan[] => {
|
||||
timestamp: span.startTime * 1000,
|
||||
duration: span.duration * 1000,
|
||||
...getEndpoint(span),
|
||||
annotations: span.logs.length
|
||||
annotations: span.logs?.length
|
||||
? span.logs.map((l: TraceLog) => ({ timestamp: l.timestamp, value: l.fields[0].value }))
|
||||
: undefined,
|
||||
tags: span.tags.length
|
||||
tags: span.tags?.length
|
||||
? span.tags
|
||||
.filter((t: TraceKeyValuePair) => t.key !== 'kind' && t.key !== 'endpointType' && t.key !== 'shared')
|
||||
.reduce((tags: { [key: string]: string }, t: TraceKeyValuePair) => {
|
||||
if (t.key === 'error') {
|
||||
return {
|
||||
...tags,
|
||||
[t.key]: span.tags.find((t: TraceKeyValuePair) => t.key === 'errorValue').value || '',
|
||||
[t.key]: span.tags?.find((t: TraceKeyValuePair) => t.key === 'errorValue')?.value || '',
|
||||
};
|
||||
}
|
||||
return { ...tags, [t.key]: t.value };
|
||||
}, {})
|
||||
: undefined,
|
||||
kind: span.tags.find((t: TraceKeyValuePair) => t.key === 'kind')?.value,
|
||||
shared: span.tags.find((t: TraceKeyValuePair) => t.key === 'shared')?.value,
|
||||
kind: span.tags?.find((t: TraceKeyValuePair) => t.key === 'kind')?.value,
|
||||
shared: span.tags?.find((t: TraceKeyValuePair) => t.key === 'shared')?.value,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ export const transformToZipkin = (data: MutableDataFrame): ZipkinSpan[] => {
|
||||
};
|
||||
|
||||
// Returns remote or local endpoint object
|
||||
const getEndpoint = (span: any): { [key: string]: ZipkinEndpoint } | undefined => {
|
||||
const getEndpoint = (span: TraceSpanRow): { [key: string]: ZipkinEndpoint } | undefined => {
|
||||
const key =
|
||||
span.serviceTags.find((t: TraceKeyValuePair) => t.key === 'endpointType')?.value === 'local'
|
||||
? 'localEndpoint'
|
||||
|
||||
@@ -55,17 +55,6 @@ export interface ToggleKioskModePayload {
|
||||
exit?: boolean;
|
||||
}
|
||||
|
||||
export interface GraphClickedPayload {
|
||||
pos: any;
|
||||
panel: any;
|
||||
item: any;
|
||||
}
|
||||
|
||||
export interface ThresholdChangedPayload {
|
||||
threshold: any;
|
||||
handleIndex: number;
|
||||
}
|
||||
|
||||
export interface DashScrollPayload {
|
||||
restore?: boolean;
|
||||
animate?: boolean;
|
||||
@@ -79,12 +68,6 @@ export interface PanelChangeViewPayload {}
|
||||
*/
|
||||
|
||||
export const templateVariableValueUpdated = eventFactory('template-variable-value-updated');
|
||||
export const graphClicked = eventFactory<GraphClickedPayload>('graph-click');
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const thresholdChanged = eventFactory<ThresholdChangedPayload>('threshold-changed');
|
||||
|
||||
/**
|
||||
* Used for syncing queries badge count in panel edit queries tab
|
||||
|
||||
Vendored
-8
@@ -6,11 +6,3 @@ interface JQueryPlot {
|
||||
interface JQueryStatic {
|
||||
plot: JQueryPlot;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
place_tt: any;
|
||||
modal: any;
|
||||
tagsinput: any;
|
||||
typeahead: any;
|
||||
tooltip: any;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface ThunkWhen {
|
||||
export const thunkTester = (initialState: unknown, debug?: boolean): ThunkGiven => {
|
||||
const store = mockStore(initialState);
|
||||
let thunkUnderTest: any = null;
|
||||
let dispatchedActions: Array<PayloadAction<any>> = [];
|
||||
let dispatchedActions: PayloadAction[] = [];
|
||||
|
||||
const givenThunk = (thunkFunction: any): ThunkWhen => {
|
||||
thunkUnderTest = thunkFunction;
|
||||
@@ -23,7 +23,7 @@ export const thunkTester = (initialState: unknown, debug?: boolean): ThunkGiven
|
||||
return instance;
|
||||
};
|
||||
|
||||
const whenThunkIsDispatched = async (...args: unknown[]): Promise<Array<PayloadAction<any>>> => {
|
||||
const whenThunkIsDispatched = async (...args: unknown[]): Promise<PayloadAction[]> => {
|
||||
await store.dispatch(thunkUnderTest(...args));
|
||||
|
||||
dispatchedActions = store.getActions();
|
||||
|
||||
@@ -1,52 +1,7 @@
|
||||
import { template } from 'lodash';
|
||||
|
||||
import { RawTimeRange, PanelPluginMeta, dateMath } from '@grafana/data';
|
||||
import config from 'app/core/config';
|
||||
import { RawTimeRange, dateMath } from '@grafana/data';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||
|
||||
export function ControllerTestContext(this: any) {
|
||||
const self = this;
|
||||
|
||||
this.datasource = {};
|
||||
this.$element = {};
|
||||
this.$sanitize = {};
|
||||
this.annotationsSrv = {};
|
||||
this.contextSrv = {};
|
||||
this.timeSrv = new TimeSrvStub();
|
||||
this.templateSrv = TemplateSrvStub();
|
||||
this.datasourceSrv = {
|
||||
getMetricSources: () => {},
|
||||
get: () => {
|
||||
return {
|
||||
then: (callback: (ds: any) => void) => {
|
||||
callback(self.datasource);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
this.isUtc = false;
|
||||
|
||||
this.createPanelController = (Ctrl: any) => {
|
||||
return () => {
|
||||
self.panel = new PanelModel({ type: 'test' });
|
||||
self.dashboard = { meta: {} };
|
||||
self.isUtc = false;
|
||||
self.dashboard.getTimezone = () => {
|
||||
return self.isUtc ? 'utc' : 'browser';
|
||||
};
|
||||
config.panels['test'] = { info: {} } as PanelPluginMeta;
|
||||
};
|
||||
};
|
||||
|
||||
this.setIsUtc = (isUtc = false) => {
|
||||
self.isUtc = isUtc;
|
||||
};
|
||||
}
|
||||
|
||||
export function DashboardViewStateStub(this: any) {
|
||||
this.registerPanel = () => {};
|
||||
}
|
||||
|
||||
export class TimeSrvStub {
|
||||
time: RawTimeRange;
|
||||
@@ -120,8 +75,6 @@ const allDeps = {
|
||||
ContextSrvStub,
|
||||
TemplateSrvStub,
|
||||
TimeSrvStub,
|
||||
ControllerTestContext,
|
||||
DashboardViewStateStub,
|
||||
};
|
||||
|
||||
// for legacy
|
||||
|
||||
Reference in New Issue
Block a user