Chore: type improvements (#80464)

* type improvements

* some more fixes

* add TODOs to remove type assertions
pull/79911/head^2
Ashley Harrison 1 year ago committed by GitHub
parent b23ecaa3d1
commit d5db67a073
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 63
      .betterer.results
  2. 7
      packages/grafana-data/src/types/fieldOverrides.ts
  3. 2
      packages/grafana-data/src/utils/location.ts
  4. 6
      packages/grafana-runtime/src/utils/DataSourceWithBackend.ts
  5. 21
      public/app/core/specs/ticks.test.ts
  6. 11
      public/app/core/utils/explore.ts
  7. 16
      public/app/core/utils/fetch.ts
  8. 121
      public/app/core/utils/ticks.ts
  9. 4
      public/app/features/dashboard-scene/utils/DashboardModelCompatibilityWrapper.ts
  10. 6
      public/app/features/plugins/sql/datasource/SqlDatasource.ts
  11. 11
      public/app/features/query/state/PanelQueryRunner.ts
  12. 14
      public/app/features/sandbox/TestStuffPage.tsx
  13. 4
      public/app/features/storage/storage.ts
  14. 3
      public/app/features/transformers/calculateHeatmap/heatmap.ts
  15. 11
      public/app/features/transformers/editors/CalculateFieldTransformerEditor/WindowOptionsEditor.tsx
  16. 11
      public/app/features/variables/adhoc/actions.ts
  17. 2
      public/app/plugins/datasource/grafana-testdata-datasource/components/SimulationQueryEditor.tsx

@ -293,17 +293,14 @@ exports[`better eslint`] = {
],
"packages/grafana-data/src/types/fieldOverrides.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.", "2"],
[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.", "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-data/src/types/flot.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
@ -435,8 +432,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"packages/grafana-data/src/utils/location.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, "Do not use any type assertions.", "0"]
],
"packages/grafana-data/src/utils/url.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -578,10 +574,7 @@ exports[`better eslint`] = {
],
"packages/grafana-runtime/src/utils/DataSourceWithBackend.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "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.", "1"]
],
"packages/grafana-runtime/src/utils/queryResponse.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -1184,21 +1177,13 @@ exports[`better eslint`] = {
"public/app/core/utils/deferred.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/core/utils/explore.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/core/utils/fetch.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, "Do not use any type assertions.", "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.", "3"],
[0, 0, 0, "Do not use any type assertions.", "4"],
[0, 0, 0, "Do not use any type assertions.", "5"],
[0, 0, 0, "Do not use any type assertions.", "6"],
[0, 0, 0, "Unexpected any. Specify a different type.", "7"],
[0, 0, 0, "Do not use any type assertions.", "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.", "5"]
],
"public/app/core/utils/flatten.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
@ -1214,12 +1199,8 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/core/utils/ticks.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, "Do not use any type assertions.", "4"],
[0, 0, 0, "Do not use any type assertions.", "5"]
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"]
],
"public/app/core/utils/tracing.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -2461,9 +2442,7 @@ exports[`better eslint`] = {
],
"public/app/features/dashboard-scene/utils/DashboardModelCompatibilityWrapper.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"],
[0, 0, 0, "Do not use any type assertions.", "3"]
[0, 0, 0, "Do not use any type assertions.", "1"]
],
"public/app/features/dashboard-scene/utils/test-utils.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
@ -4184,8 +4163,7 @@ exports[`better eslint`] = {
],
"public/app/features/query/state/PanelQueryRunner.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"]
[0, 0, 0, "Do not use any type assertions.", "1"]
],
"public/app/features/query/state/runRequest.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -4204,9 +4182,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
[0, 0, 0, "Unexpected any. Specify a different type.", "11"]
],
"public/app/features/sandbox/TestStuffPage.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/search/page/components/ActionRow.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"]
@ -4308,9 +4283,7 @@ exports[`better eslint`] = {
],
"public/app/features/storage/storage.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, "Do not use any type assertions.", "2"],
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
],
"public/app/features/teams/TeamGroupSync.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
@ -4385,8 +4358,7 @@ exports[`better eslint`] = {
],
"public/app/features/transformers/calculateHeatmap/heatmap.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "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.", "1"]
],
"public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"]
@ -4398,9 +4370,7 @@ exports[`better eslint`] = {
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/transformers/editors/CalculateFieldTransformerEditor/WindowOptionsEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],
[0, 0, 0, "Do not use any type assertions.", "2"]
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/transformers/editors/ConvertFieldTypeTransformerEditor.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
@ -4495,9 +4465,6 @@ exports[`better eslint`] = {
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
[0, 0, 0, "Unexpected any. Specify a different type.", "2"]
],
"public/app/features/variables/adhoc/actions.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]
],
"public/app/features/variables/adhoc/picker/AdHocFilterRenderer.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],

@ -46,8 +46,7 @@ export interface SystemConfigOverrideRule extends ConfigOverrideRule {
*/
export function isSystemOverrideWithRef<T extends SystemConfigOverrideRule>(ref: string) {
return (override: ConfigOverrideRule): override is T => {
const overrideAs = override as T;
return overrideAs.__systemRef === ref;
return '__systemRef' in override && override.__systemRef === ref;
};
}
@ -58,7 +57,7 @@ export function isSystemOverrideWithRef<T extends SystemConfigOverrideRule>(ref:
* @internal
*/
export const isSystemOverride = (override: ConfigOverrideRule): override is SystemConfigOverrideRule => {
return typeof (override as SystemConfigOverrideRule)?.__systemRef === 'string';
return '__systemRef' in override && typeof override.__systemRef === 'string';
};
export interface FieldConfigSource<TOptions = any> {
@ -69,7 +68,7 @@ export interface FieldConfigSource<TOptions = any> {
overrides: ConfigOverrideRule[];
}
export interface FieldOverrideContext extends StandardEditorContext<any, any> {
export interface FieldOverrideContext extends StandardEditorContext<any> {
field?: Field;
dataFrameIndex?: number; // The index for the selected field frame
}

@ -69,7 +69,7 @@ const assureBaseUrl = (url: string): string => {
* @param searchParamsToUpdate
* @returns
*/
const getUrlForPartial = (location: Location<any>, searchParamsToUpdate: UrlQueryMap) => {
const getUrlForPartial = (location: Location, searchParamsToUpdate: UrlQueryMap) => {
const searchParams = urlUtil.parseKeyValue(
location.search.startsWith('?') ? location.search.substring(1) : location.search
);

@ -268,7 +268,7 @@ class DataSourceWithBackend<
* Apply template variables for explore
*/
interpolateVariablesInQueries(queries: TQuery[], scopedVars: ScopedVars, filters?: AdHocVariableFilter[]): TQuery[] {
return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters) as TQuery);
return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters));
}
/**
@ -290,7 +290,7 @@ class DataSourceWithBackend<
*
* @virtual
*/
applyTemplateVariables(query: TQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]): Record<string, any> {
applyTemplateVariables(query: TQuery, scopedVars: ScopedVars, filters?: AdHocVariableFilter[]) {
return query;
}
@ -323,7 +323,7 @@ class DataSourceWithBackend<
/**
* Send a POST request to the datasource resource path
*/
async postResource<T = any>(
async postResource<T = unknown>(
path: string,
data?: BackendSrvRequest['data'],
options?: Partial<BackendSrvRequest>

@ -1,27 +1,6 @@
import * as ticks from '../utils/ticks';
describe('ticks', () => {
describe('getFlotTickDecimals()', () => {
const axis = {
min: null,
max: null,
};
it('should calculate decimals precision based on graph height', () => {
let dec = ticks.getFlotTickDecimals(0, 10, axis, 200);
expect(dec.tickDecimals).toBe(1);
expect(dec.scaledDecimals).toBe(1);
dec = ticks.getFlotTickDecimals(0, 100, axis, 200);
expect(dec.tickDecimals).toBe(0);
expect(dec.scaledDecimals).toBe(-1);
dec = ticks.getFlotTickDecimals(0, 1, axis, 200);
expect(dec.tickDecimals).toBe(2);
expect(dec.scaledDecimals).toBe(3);
});
});
describe('getStringPrecision()', () => {
it('"3.12" should return 2', () => {
expect(ticks.getStringPrecision('3.12')).toBe(2);

@ -263,12 +263,11 @@ const validKeys = ['refId', 'key', 'context', 'datasource'];
export function hasNonEmptyQuery<TQuery extends DataQuery>(queries: TQuery[]): boolean {
return (
queries &&
queries.some((query: any) => {
const keys = Object.keys(query)
.filter((key) => validKeys.indexOf(key) === -1)
.map((k) => query[k])
.filter((v) => v);
return keys.length > 0;
queries.some((query) => {
const entries = Object.entries(query)
.filter(([key, _]) => validKeys.indexOf(key) === -1)
.filter(([_, value]) => value);
return entries.length > 0;
})
);
}

@ -103,23 +103,29 @@ export async function parseResponseBody<T>(
if (responseType) {
switch (responseType) {
case 'arraybuffer':
return response.arrayBuffer() as any;
// this specifically returns a Promise<ArrayBuffer>
// TODO refactor this function to remove the type assertions
return response.arrayBuffer() as Promise<T>;
case 'blob':
return response.blob() as any;
// this specifically returns a Promise<Blob>
// TODO refactor this function to remove the type assertions
return response.blob() as Promise<T>;
case 'json':
// An empty string is not a valid JSON.
// Sometimes (unfortunately) our APIs declare their Content-Type as JSON, however they return an empty body.
if (response.headers.get('Content-Length') === '0') {
console.warn(`${response.url} returned an invalid JSON`);
return {} as unknown as T;
return {} as T;
}
return await response.json();
case 'text':
return response.text() as any;
// this specifically returns a Promise<string>
// TODO refactor this function to remove the type assertions
return response.text() as Promise<T>;
}
}
@ -127,7 +133,7 @@ export async function parseResponseBody<T>(
try {
return JSON.parse(textData); // majority of the requests this will be something that can be parsed
} catch {}
return textData as any;
return textData as T;
}
function serializeParams(data: Record<string, any>): string {

@ -30,127 +30,6 @@ export function getScaledDecimals(decimals: number, tickSize: number) {
return decimals - Math.floor(Math.log(tickSize) / Math.LN10);
}
/**
* Calculate tick size based on min and max values, number of ticks and precision.
* Implementation from Flot.
* @param min Axis minimum
* @param max Axis maximum
* @param noTicks Number of ticks
* @param tickDecimals Tick decimal precision
*/
export function getFlotTickSize(min: number, max: number, noTicks: number, tickDecimals: number) {
const delta = (max - min) / noTicks;
let dec = -Math.floor(Math.log(delta) / Math.LN10);
const maxDec = tickDecimals;
const magn = Math.pow(10, -dec);
const norm = delta / magn; // norm is between 1.0 and 10.0
let size;
if (norm < 1.5) {
size = 1;
} else if (norm < 3) {
size = 2;
// special case for 2.5, requires an extra decimal
if (norm > 2.25 && (maxDec == null || dec + 1 <= maxDec)) {
size = 2.5;
++dec;
}
} else if (norm < 7.5) {
size = 5;
} else {
size = 10;
}
size *= magn;
return size;
}
/**
* Calculate axis range (min and max).
* Implementation from Flot.
*/
export function getFlotRange(panelMin: any, panelMax: any, datamin: number, datamax: number) {
const autoscaleMargin = 0.02;
let min = +(panelMin != null ? panelMin : datamin);
let max = +(panelMax != null ? panelMax : datamax);
const delta = max - min;
if (delta === 0.0) {
// Grafana fix: wide Y min and max using increased wideFactor
// when all series values are the same
const wideFactor = 0.25;
const widen = Math.abs(max === 0 ? 1 : max * wideFactor);
if (panelMin === null) {
min -= widen;
}
// always widen max if we couldn't widen min to ensure we
// don't fall into min == max which doesn't work
if (panelMax == null || panelMin != null) {
max += widen;
}
} else {
// consider autoscaling
const margin = autoscaleMargin;
if (margin != null) {
if (panelMin == null) {
min -= delta * margin;
// make sure we don't go below zero if all values
// are positive
if (min < 0 && datamin != null && datamin >= 0) {
min = 0;
}
}
if (panelMax == null) {
max += delta * margin;
if (max > 0 && datamax != null && datamax <= 0) {
max = 0;
}
}
}
}
return { min, max };
}
/**
* Calculate tick decimals.
* Implementation from Flot.
*/
export function getFlotTickDecimals(datamin: number, datamax: number, axis: { min: any; max: any }, height: number) {
const { min, max } = getFlotRange(axis.min, axis.max, datamin, datamax);
const noTicks = 0.3 * Math.sqrt(height);
const delta = (max - min) / noTicks;
const dec = -Math.floor(Math.log(delta) / Math.LN10);
const magn = Math.pow(10, -dec);
// norm is between 1.0 and 10.0
const norm = delta / magn;
let size;
if (norm < 1.5) {
size = 1;
} else if (norm < 3) {
size = 2;
// special case for 2.5, requires an extra decimal
if (norm > 2.25) {
size = 2.5;
}
} else if (norm < 7.5) {
size = 5;
} else {
size = 10;
}
size *= magn;
const tickDecimals = Math.max(0, -Math.floor(Math.log(delta) / Math.LN10) + 1);
// grafana addition
const scaledDecimals = tickDecimals - Math.floor(Math.log(size) / Math.LN10);
return { tickDecimals, scaledDecimals };
}
/**
* Format timestamp similar to Grafana graph panel.
* @param ticks Number of ticks

@ -272,12 +272,12 @@ class PanelCompatibilityWrapper {
uid: SHARED_DASHBOARD_QUERY,
type: 'datasource',
},
...(this._vizPanel.state.$data.state.$data as ShareQueryDataProvider).state.query,
...this._vizPanel.state.$data.state.$data.state.query,
},
];
}
if (this._vizPanel.state.$data.state.$data instanceof SceneQueryRunner) {
return (this._vizPanel.state.$data.state.$data as SceneQueryRunner).state.queries;
return this._vizPanel.state.$data.state.$data.state.queries;
}
}

@ -9,7 +9,6 @@ import {
DataQueryRequest,
DataQueryResponse,
DataSourceInstanceSettings,
DataSourceRef,
MetricFindValue,
ScopedVars,
CoreApp,
@ -117,10 +116,7 @@ export abstract class SqlDatasource extends DataSourceWithBackend<SQLQuery, SQLO
return !query.hide;
}
applyTemplateVariables(
target: SQLQuery,
scopedVars: ScopedVars
): Record<string, string | DataSourceRef | SQLQuery['format']> {
applyTemplateVariables(target: SQLQuery, scopedVars: ScopedVars) {
return {
refId: target.refId,
datasource: this.getRef(),

@ -139,9 +139,14 @@ export class PanelQueryRunner {
if (withFieldConfig && data.series?.length) {
if (lastConfigRev === this.dataConfigSource.configRev) {
const streamingDataFrame = data.series.find((data) => isStreamingDataFrame(data)) as
| StreamingDataFrame
| undefined;
let streamingDataFrame: StreamingDataFrame | undefined;
for (const frame of data.series) {
if (isStreamingDataFrame(frame)) {
streamingDataFrame = frame;
break;
}
}
if (
streamingDataFrame &&

@ -2,9 +2,15 @@ import React, { useMemo, useState } from 'react';
import { useObservable } from 'react-use';
import AutoSizer from 'react-virtualized-auto-sizer';
import { ApplyFieldOverrideOptions, dateMath, FieldColorModeId, NavModelItem, PanelData } from '@grafana/data';
import {
ApplyFieldOverrideOptions,
DataConfigSource,
dateMath,
FieldColorModeId,
NavModelItem,
PanelData,
} from '@grafana/data';
import { getPluginExtensions, isPluginExtensionLink } from '@grafana/runtime';
import { DataTransformerConfig } from '@grafana/schema';
import { Button, HorizontalGroup, LinkButton, Table } from '@grafana/ui';
import { Page } from 'app/core/components/Page/Page';
import { config } from 'app/core/config';
@ -129,8 +135,8 @@ export function getDefaultState(): State {
theme: config.theme2,
};
const dataConfig = {
getTransformations: () => [] as DataTransformerConfig[],
const dataConfig: DataConfigSource = {
getTransformations: () => [],
getFieldOverrideOptions: () => options,
getDataSupport: () => ({ annotations: false, alertStates: false }),
};

@ -102,9 +102,9 @@ class SimpleStorage implements GrafanaStorage {
body: formData,
});
let body: UploadResponse = await res.json();
let body = await res.json();
if (!body) {
body = {} as any;
body = {};
}
body.status = res.status;
body.statusText = res.statusText;

@ -327,7 +327,8 @@ export function calculateHeatmapFromData(frames: DataFrame[], options: HeatmapCa
: undefined,
yMode: yBucketsCfg.mode,
ySize: yBucketsCfg.value ? +yBucketsCfg.value : undefined,
yLog: scaleDistribution?.type === ScaleDistribution.Log ? (scaleDistribution?.log as any) : undefined,
yLog:
scaleDistribution?.type === ScaleDistribution.Log ? (scaleDistribution?.log as 2 | 10 | undefined) : undefined,
});
const frame = {

@ -52,16 +52,15 @@ export const WindowOptionsEditor = (props: {
});
};
const onWindowSizeModeChange = (val: string) => {
const mode = val as WindowSizeMode;
const onWindowSizeModeChange = (val: WindowSizeMode) => {
updateWindowOptions({
...window!,
windowSize: window?.windowSize
? mode === WindowSizeMode.Percentage
? val === WindowSizeMode.Percentage
? window!.windowSize! / 100
: window!.windowSize! * 100
: undefined,
windowSizeMode: mode,
windowSizeMode: val,
});
};
@ -71,10 +70,10 @@ export const WindowOptionsEditor = (props: {
updateWindowOptions({ ...window, reducer });
};
const onTypeChange = (val: string) => {
const onTypeChange = (val: WindowAlignment) => {
updateWindowOptions({
...window!,
windowAlignment: val as WindowAlignment,
windowAlignment: val,
});
};

@ -149,7 +149,12 @@ const createAdHocVariable = (options: AdHocTableOptions): ThunkResult<void> => {
const getVariableByOptions = (options: AdHocTableOptions, state: StoreState): AdHocVariableModel | undefined => {
const key = getLastKey(state);
const templatingState = getVariablesState(key, state);
return Object.values(templatingState.variables).find(
(v) => isAdHoc(v) && v.datasource?.uid === options.datasource.uid
) as AdHocVariableModel;
let result: AdHocVariableModel | undefined;
for (const v of Object.values(templatingState.variables)) {
if (isAdHoc(v) && v.datasource?.uid === options.datasource.uid) {
result = v;
break;
}
}
return result;
};

@ -90,7 +90,7 @@ export const SimulationQueryEditor = ({ onChange, query, ds }: EditorProps) => {
if (simKey.uid) {
path += '/' + simKey.uid;
}
ds.postResource('sim/' + path, config).then((res) => {
ds.postResource<SimInfo>('sim/' + path, config).then((res) => {
setCfgValue(res.config);
});
};

Loading…
Cancel
Save