mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
7c098c59fd
commit
963fffeef1
@ -2236,9 +2236,6 @@ exports[`better eslint`] = {
|
||||
"public/app/features/dashboard/services/PublicDashboardDataSource.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/services/TimeSrv.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/dashboard/state/DashboardMigrator.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"],
|
||||
@ -2455,8 +2452,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/datasources/state/actions.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, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/datasources/state/navModel.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
@ -2474,14 +2470,11 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/dimensions/editors/ResourceDimensionEditor.tsx: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"]
|
||||
],
|
||||
"public/app/features/dimensions/editors/TextDimensionEditor.tsx: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.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/dimensions/editors/ThresholdsEditor/ThresholdsEditor.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -2518,12 +2511,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "5"]
|
||||
],
|
||||
"public/app/features/explore/TraceView/components/TraceTimelineViewer/ListView/index.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/explore/TraceView/components/common/BreakableText.tsx:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/explore/TraceView/components/demo/trace-generators.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -2541,11 +2528,10 @@ exports[`better eslint`] = {
|
||||
[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, "Do not use any type assertions.", "10"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "11"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "12"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "13"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "9"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "10"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "11"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "12"]
|
||||
],
|
||||
"public/app/features/explore/TraceView/components/model/transform-trace-data.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
@ -2583,9 +2569,6 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"public/app/features/expressions/components/Condition.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/expressions/guards.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
@ -2600,9 +2583,7 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/geo/gazetteer/gazetteer.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, "Unexpected any. Specify a different type.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/geo/gazetteer/worldmap.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -2613,10 +2594,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "2"]
|
||||
],
|
||||
"public/app/features/inspector/InspectDataOptions.tsx: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.", "2"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/inspector/InspectDataTab.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
@ -2625,8 +2603,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/inspector/InspectJSONTab.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
],
|
||||
"public/app/features/inspector/InspectStatsTab.tsx:5381": [
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "0"]
|
||||
@ -2635,9 +2612,8 @@ exports[`better eslint`] = {
|
||||
[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, "Use data-testid for E2E selectors instead of aria-label", "4"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "5"]
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "3"],
|
||||
[0, 0, 0, "Use data-testid for E2E selectors instead of aria-label", "4"]
|
||||
],
|
||||
"public/app/features/invites/state/selectors.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
@ -2646,8 +2622,7 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
||||
],
|
||||
"public/app/features/library-panels/utils.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.", "0"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/LiveDataStream.test.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -2659,29 +2634,17 @@ exports[`better eslint`] = {
|
||||
],
|
||||
"public/app/features/live/centrifuge/LiveDataStream.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.", "3"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/channel.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.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/service.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.", "0"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/serviceWorkerProxy.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "1"]
|
||||
],
|
||||
"public/app/features/live/centrifuge/transferHandlers.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.", "0"]
|
||||
],
|
||||
"public/app/features/live/data/amendTimeSeries.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
@ -2694,19 +2657,10 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/logs/utils.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.", "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.", "0"]
|
||||
],
|
||||
"public/app/features/manage-dashboards/components/ImportDashboardForm.tsx: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.", "2"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "3"],
|
||||
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "5"]
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/features/manage-dashboards/components/ImportDashboardLibraryPanelsList.tsx:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
|
@ -63,7 +63,7 @@ const reducerTypes = [
|
||||
{ text: 'percent_diff()', value: 'percent_diff' },
|
||||
{ text: 'percent_diff_abs()', value: 'percent_diff_abs' },
|
||||
{ text: 'count_non_null()', value: 'count_non_null' },
|
||||
];
|
||||
] as const;
|
||||
|
||||
const noDataModes = [
|
||||
{ text: 'Alerting', value: 'alerting' },
|
||||
|
@ -238,7 +238,7 @@ export class TimeSrv {
|
||||
if (interval === AutoRefreshInterval) {
|
||||
intervalMs = this.getAutoRefreshInteval().intervalMs;
|
||||
} else {
|
||||
refresh = this.contextSrv.getValidInterval(interval as string);
|
||||
refresh = this.contextSrv.getValidInterval(interval);
|
||||
intervalMs = rangeUtil.intervalToMs(refresh);
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ export function loadDataSource(uid: string): ThunkResult<Promise<DataSourceSetti
|
||||
|
||||
export function loadDataSourceMeta(dataSource: DataSourceSettings): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
const pluginInfo = (await getPluginSettings(dataSource.type)) as DataSourcePluginMeta;
|
||||
const pluginInfo: DataSourcePluginMeta = await getPluginSettings(dataSource.type);
|
||||
const plugin = await importDataSourcePlugin(pluginInfo);
|
||||
const isBackend = plugin.DataSourceClass.prototype instanceof DataSourceWithBackend;
|
||||
const meta = {
|
||||
|
@ -16,9 +16,9 @@ const resourceOptions = [
|
||||
// { label: 'Mapping', value: ResourceDimensionMode.Mapping, description: 'Map the results of a value to an svg' },
|
||||
];
|
||||
|
||||
const dummyFieldSettings: StandardEditorsRegistryItem<string, FieldNamePickerConfigSettings> = {
|
||||
const dummyFieldSettings = {
|
||||
settings: {},
|
||||
} as any;
|
||||
} as StandardEditorsRegistryItem<string, FieldNamePickerConfigSettings>;
|
||||
|
||||
export const ResourceDimensionEditor = (
|
||||
props: StandardEditorProps<ResourceDimensionConfig, ResourceDimensionOptions, unknown>
|
||||
|
@ -19,13 +19,13 @@ const textOptions = [
|
||||
// { label: 'Template', value: TextDimensionMode.Template, description: 'use template text' },
|
||||
];
|
||||
|
||||
const dummyFieldSettings: StandardEditorsRegistryItem<string, FieldNamePickerConfigSettings> = {
|
||||
const dummyFieldSettings = {
|
||||
settings: {},
|
||||
} as any;
|
||||
} as StandardEditorsRegistryItem<string, FieldNamePickerConfigSettings>;
|
||||
|
||||
const dummyStringSettings: StandardEditorsRegistryItem<string, StringFieldConfigSettings> = {
|
||||
const dummyStringSettings = {
|
||||
settings: {},
|
||||
} as any;
|
||||
} as StandardEditorsRegistryItem<string, StringFieldConfigSettings>;
|
||||
|
||||
type Props = StandardEditorProps<TextDimensionConfig, TextDimensionOptions>;
|
||||
|
||||
|
@ -378,28 +378,30 @@ export default class ListView extends React.Component<TListViewProps> {
|
||||
const nodes = this._itemHolderElm.childNodes;
|
||||
const max = nodes.length;
|
||||
for (let i = 0; i < max; i++) {
|
||||
const node = nodes[i] as HTMLElement;
|
||||
// use `.getAttribute(...)` instead of `.dataset` for jest / JSDOM
|
||||
const itemKey = node.getAttribute('data-item-key');
|
||||
if (!itemKey) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('itemKey not found');
|
||||
continue;
|
||||
}
|
||||
// measure the first child, if it's available, otherwise the node itself
|
||||
// (likely not transferable to other contexts, and instead is specific to
|
||||
// how we have the items rendered)
|
||||
const measureSrc: Element = node.firstElementChild || node;
|
||||
const observed = measureSrc.clientHeight;
|
||||
const known = this._knownHeights.get(itemKey);
|
||||
if (observed !== known) {
|
||||
this._knownHeights.set(itemKey, observed);
|
||||
if (!isDirty) {
|
||||
isDirty = true;
|
||||
// eslint-disable-next-line no-multi-assign
|
||||
lowDirtyKey = highDirtyKey = itemKey;
|
||||
} else {
|
||||
highDirtyKey = itemKey;
|
||||
const node = nodes[i];
|
||||
if (node instanceof HTMLElement) {
|
||||
// use `.getAttribute(...)` instead of `.dataset` for jest / JSDOM
|
||||
const itemKey = node.getAttribute('data-item-key');
|
||||
if (!itemKey) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('itemKey not found');
|
||||
continue;
|
||||
}
|
||||
// measure the first child, if it's available, otherwise the node itself
|
||||
// (likely not transferable to other contexts, and instead is specific to
|
||||
// how we have the items rendered)
|
||||
const measureSrc: Element = node.firstElementChild || node;
|
||||
const observed = measureSrc.clientHeight;
|
||||
const known = this._knownHeights.get(itemKey);
|
||||
if (observed !== known) {
|
||||
this._knownHeights.set(itemKey, observed);
|
||||
if (!isDirty) {
|
||||
isDirty = true;
|
||||
// eslint-disable-next-line no-multi-assign
|
||||
lowDirtyKey = highDirtyKey = itemKey;
|
||||
} else {
|
||||
highDirtyKey = itemKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,11 +35,7 @@ type Props = {
|
||||
wordRegexp?: RegExp;
|
||||
};
|
||||
|
||||
// TODO typescript doesn't understand text or null as react nodes
|
||||
// https://github.com/Microsoft/TypeScript/issues/21699
|
||||
export default function BreakableText(
|
||||
props: Props
|
||||
): any /* React.ReactNode /* React.ReactElement | React.ReactElement[] \*\/ */ {
|
||||
export default function BreakableText(props: Props): React.ReactElement | null {
|
||||
const { className, text, wordRegexp = WORD_RX } = props;
|
||||
const styles = useStyles2(getStyles);
|
||||
if (!text) {
|
||||
@ -57,7 +53,7 @@ export default function BreakableText(
|
||||
);
|
||||
match = wordRegexp.exec(text);
|
||||
}
|
||||
return spans;
|
||||
return <>{spans}</>;
|
||||
}
|
||||
|
||||
BreakableText.defaultProps = {
|
||||
|
@ -73,7 +73,7 @@ export function processTemplate(template: unknown, encodeFn: (unencoded: any) =>
|
||||
};
|
||||
}
|
||||
|
||||
export function createTestFunction(entry?: any) {
|
||||
export function createTestFunction(entry?: unknown) {
|
||||
if (typeof entry === 'string') {
|
||||
return (arg: unknown) => arg === entry;
|
||||
}
|
||||
|
@ -16,7 +16,10 @@ interface Props {
|
||||
refIds: Array<SelectableValue<string>>;
|
||||
}
|
||||
|
||||
const reducerFunctions = alertDef.reducerTypes.map((rt) => ({ label: rt.text, value: rt.value }));
|
||||
const reducerFunctions = alertDef.reducerTypes.map<{
|
||||
label: string;
|
||||
value: ReducerType;
|
||||
}>((rt) => ({ label: rt.text, value: rt.value }));
|
||||
const evalOperators = alertDef.evalOperators.map((eo) => ({ label: eo.text, value: eo.value }));
|
||||
const evalFunctions = alertDef.evalFunctions.map((ef) => ({ label: ef.text, value: ef.value }));
|
||||
|
||||
@ -30,10 +33,10 @@ export const Condition = ({ condition, index, onChange, onRemoveCondition, refId
|
||||
});
|
||||
};
|
||||
|
||||
const onReducerFunctionChange = (conditionFunction: SelectableValue<string>) => {
|
||||
const onReducerFunctionChange = (conditionFunction: SelectableValue<ReducerType>) => {
|
||||
onChange({
|
||||
...condition,
|
||||
reducer: { type: conditionFunction.value! as ReducerType, params: [] },
|
||||
reducer: { type: conditionFunction.value!, params: [] },
|
||||
});
|
||||
};
|
||||
|
||||
@ -83,7 +86,7 @@ export const Condition = ({ condition, index, onChange, onRemoveCondition, refId
|
||||
value={evalOperators.find((ea) => ea.value === condition.operator!.type)}
|
||||
/>
|
||||
)}
|
||||
<Select
|
||||
<Select<ReducerType>
|
||||
options={reducerFunctions}
|
||||
onChange={onReducerFunctionChange}
|
||||
width={20}
|
||||
|
@ -31,7 +31,7 @@ export function loadGazetteer(path: string, data: any): Gazetteer {
|
||||
let frame: DataFrame | undefined = undefined;
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
const first = data[0] as any;
|
||||
const first = data[0];
|
||||
// Check for legacy worldmap syntax
|
||||
if (first.latitude && first.longitude && (first.key || first.keys)) {
|
||||
return loadWorldmapPoints(path, data);
|
||||
|
@ -40,8 +40,7 @@ export const InspectDataOptions = ({
|
||||
const styles = useStyles2(getPanelInspectorStyles2);
|
||||
|
||||
const panelTransformations = panel?.getTransformations();
|
||||
const showPanelTransformationsOption =
|
||||
Boolean(panelTransformations?.length) && (transformId as any) !== 'join by time';
|
||||
const showPanelTransformationsOption = Boolean(panelTransformations?.length);
|
||||
const showFieldConfigsOption = panel && !panel.plugin?.fieldConfigRegistry.isEmpty();
|
||||
|
||||
let dataSelect = dataFrames;
|
||||
@ -49,11 +48,11 @@ export const InspectDataOptions = ({
|
||||
dataSelect = data!;
|
||||
}
|
||||
|
||||
const choices = dataSelect.map((frame, index) => {
|
||||
const choices = dataSelect.map<SelectableValue<number>>((frame, index) => {
|
||||
return {
|
||||
value: index,
|
||||
label: `${getFrameDisplayName(frame)} (${index})`,
|
||||
} as SelectableValue<number>;
|
||||
};
|
||||
});
|
||||
|
||||
const selectableOptions = [...transformationOptions, ...choices];
|
||||
|
@ -188,7 +188,7 @@ async function getJSONObject(show: ShowContent, panel?: PanelModel, data?: Panel
|
||||
return { note: t('dashboard.inspect-json.unknown', 'Unknown Object: {{show}}', { show }) };
|
||||
}
|
||||
|
||||
function getPrettyJSON(obj: any): string {
|
||||
function getPrettyJSON(obj: unknown): string {
|
||||
let r = '';
|
||||
try {
|
||||
r = JSON.stringify(obj, getCircularReplacer(), 2);
|
||||
|
@ -208,14 +208,6 @@ export class QueryInspector extends PureComponent<Props, State> {
|
||||
return 1;
|
||||
};
|
||||
|
||||
setMockedResponse = (evt: any) => {
|
||||
const mockedResponse = evt.target.value;
|
||||
this.setState((prevState) => ({
|
||||
...prevState,
|
||||
mockedResponse,
|
||||
}));
|
||||
};
|
||||
|
||||
renderExecutedQueries(executedQueries: ExecutedQueryInfo[]) {
|
||||
if (!executedQueries.length) {
|
||||
return null;
|
||||
|
@ -20,7 +20,7 @@ export async function saveAndRefreshLibraryPanel(panel: PanelModel, folderUid: s
|
||||
return savedPanel;
|
||||
}
|
||||
|
||||
function toPanelSaveModel(panel: PanelModel): any {
|
||||
function toPanelSaveModel(panel: PanelModel) {
|
||||
let { scopedVars, ...panelSaveModel } = panel.getSaveModel();
|
||||
panelSaveModel = {
|
||||
libraryPanel: {
|
||||
|
@ -103,7 +103,7 @@ type InternalStreamMessage<T = InternalStreamMessageType> = T extends InternalSt
|
||||
const reduceNewValuesSameSchemaMessages = (
|
||||
packets: Array<InternalStreamMessage<InternalStreamMessageType.NewValuesSameSchema>>
|
||||
) => ({
|
||||
values: packets.reduce((acc, { values }) => {
|
||||
values: packets.reduce<unknown[][]>((acc, { values }) => {
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (!acc[i]) {
|
||||
acc[i] = [];
|
||||
@ -113,7 +113,7 @@ const reduceNewValuesSameSchemaMessages = (
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}, [] as unknown[][]),
|
||||
}, []),
|
||||
type: InternalStreamMessageType.NewValuesSameSchema,
|
||||
});
|
||||
|
||||
@ -149,7 +149,7 @@ export class LiveDataStream<T = unknown> {
|
||||
}
|
||||
};
|
||||
|
||||
private onError = (err: any) => {
|
||||
private onError = (err: unknown) => {
|
||||
console.log('LiveQuery [error]', { err }, this.deps.channelId);
|
||||
this.stream.next({
|
||||
type: InternalStreamMessageType.Error,
|
||||
|
@ -64,7 +64,7 @@ export class CentrifugeLiveChannel<T = any> {
|
||||
try {
|
||||
if (ctx.data) {
|
||||
if (ctx.data.schema) {
|
||||
this.lastMessageWithSchema = ctx.data as DataFrameJSON;
|
||||
this.lastMessageWithSchema = ctx.data;
|
||||
}
|
||||
|
||||
this.stream.next({
|
||||
@ -97,7 +97,7 @@ export class CentrifugeLiveChannel<T = any> {
|
||||
delete this.currentStatus.error;
|
||||
|
||||
if (ctx.data?.schema) {
|
||||
this.lastMessageWithSchema = ctx.data as DataFrameJSON;
|
||||
this.lastMessageWithSchema = ctx.data;
|
||||
}
|
||||
this.sendStatus(ctx.data);
|
||||
})
|
||||
@ -119,7 +119,7 @@ export class CentrifugeLiveChannel<T = any> {
|
||||
});
|
||||
}
|
||||
|
||||
private sendStatus(message?: any) {
|
||||
private sendStatus(message?: unknown) {
|
||||
const copy = { ...this.currentStatus };
|
||||
if (message) {
|
||||
copy.message = message;
|
||||
@ -138,7 +138,7 @@ export class CentrifugeLiveChannel<T = any> {
|
||||
* Get the stream of events and
|
||||
*/
|
||||
getStream() {
|
||||
return new Observable((subscriber) => {
|
||||
return new Observable<LiveChannelEvent<T>>((subscriber) => {
|
||||
const initialMessage = { ...this.currentStatus };
|
||||
if (this.lastMessageWithSchema?.schema) {
|
||||
// send just schema instead of schema+data to avoid having data gaps
|
||||
@ -157,7 +157,7 @@ export class CentrifugeLiveChannel<T = any> {
|
||||
setTimeout(this.disconnectIfNoListeners, 250);
|
||||
}
|
||||
};
|
||||
}) as Observable<LiveChannelEvent<T>>;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,11 @@
|
||||
import { Centrifuge, State } from 'centrifuge';
|
||||
import {
|
||||
Centrifuge,
|
||||
ConnectedContext,
|
||||
ConnectingContext,
|
||||
DisconnectedContext,
|
||||
ServerPublicationContext,
|
||||
State,
|
||||
} from 'centrifuge';
|
||||
import { BehaviorSubject, Observable, share, startWith } from 'rxjs';
|
||||
|
||||
import {
|
||||
@ -104,15 +111,15 @@ export class CentrifugeService implements CentrifugeSrv {
|
||||
// Internal functions
|
||||
//----------------------------------------------------------
|
||||
|
||||
private onConnect = (context: any) => {
|
||||
private onConnect = (context: ConnectedContext) => {
|
||||
this.connectionState.next(true);
|
||||
};
|
||||
|
||||
private onDisconnect = (context: any) => {
|
||||
private onDisconnect = (context: ConnectingContext | DisconnectedContext) => {
|
||||
this.connectionState.next(false);
|
||||
};
|
||||
|
||||
private onServerSideMessage = (context: any) => {
|
||||
private onServerSideMessage = (context: ServerPublicationContext) => {
|
||||
console.log('Publication from server-side channel', context);
|
||||
};
|
||||
|
||||
|
@ -4,8 +4,8 @@ import { Subscriber } from 'rxjs';
|
||||
// Observers, ie. functions passed to `observable.subscribe(...)`, are converted to a subclass of `Subscriber` before they are sent to the source Observable.
|
||||
// The conversion happens internally in the RxJS library - this transfer handler is catches them and wraps them with a proxy
|
||||
const subscriberTransferHandler: any = {
|
||||
canHandle(value: any): boolean {
|
||||
return value && value instanceof Subscriber;
|
||||
canHandle(value: unknown): boolean {
|
||||
return Boolean(value && value instanceof Subscriber);
|
||||
},
|
||||
|
||||
serialize(value: Function): [MessagePort, Transferable[]] {
|
||||
|
@ -30,13 +30,13 @@ export function getLogLevel(line: string): LogLevel {
|
||||
let level = LogLevel.unknown;
|
||||
let currentIndex: number | undefined = undefined;
|
||||
|
||||
for (const key of Object.keys(LogLevel)) {
|
||||
for (const [key, value] of Object.entries(LogLevel)) {
|
||||
const regexp = new RegExp(`\\b${key}\\b`, 'i');
|
||||
const result = regexp.exec(line);
|
||||
|
||||
if (result) {
|
||||
if (currentIndex === undefined || result.index < currentIndex) {
|
||||
level = (LogLevel as any)[key];
|
||||
level = value;
|
||||
currentIndex = result.index;
|
||||
}
|
||||
}
|
||||
@ -45,7 +45,7 @@ export function getLogLevel(line: string): LogLevel {
|
||||
}
|
||||
|
||||
export function getLogLevelFromKey(key: string | number): LogLevel {
|
||||
const level = (LogLevel as any)[key.toString().toLowerCase()];
|
||||
const level = LogLevel[key.toString().toLowerCase() as keyof typeof LogLevel];
|
||||
if (level) {
|
||||
return level;
|
||||
}
|
||||
@ -59,7 +59,7 @@ export function calculateLogsLabelStats(rows: LogRowModel[], label: string): Log
|
||||
const rowCount = rowsWithLabel.length;
|
||||
|
||||
// Get label value counts for eligible rows
|
||||
const countsByValue = countBy(rowsWithLabel, (row) => (row as LogRowModel).labels[label]);
|
||||
const countsByValue = countBy(rowsWithLabel, (row) => row.labels[label]);
|
||||
return getSortedCounts(countsByValue, rowCount);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { BaseSyntheticEvent, useEffect, useState } from 'react';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { ExpressionDatasourceRef } from '@grafana/runtime/src/utils/DataSourceWithBackend';
|
||||
@ -60,7 +60,7 @@ export const ImportDashboardForm = ({
|
||||
*/
|
||||
useEffect(() => {
|
||||
if (isSubmitted && (errors.title || errors.uid)) {
|
||||
onSubmit(getValues(), {} as any);
|
||||
onSubmit(getValues(), {} as BaseSyntheticEvent);
|
||||
}
|
||||
}, [errors, getValues, isSubmitted, onSubmit]);
|
||||
const newLibraryPanels = inputs?.libraryPanels?.filter((i) => i.state === LibraryPanelInputState.New) ?? [];
|
||||
@ -113,7 +113,7 @@ export const ImportDashboardForm = ({
|
||||
if (input.pluginId === ExpressionDatasourceRef.type) {
|
||||
return null;
|
||||
}
|
||||
const dataSourceOption = `dataSources[${index}]`;
|
||||
const dataSourceOption = `dataSources.${index}` as const;
|
||||
const current = watchDataSources ?? [];
|
||||
return (
|
||||
<Field
|
||||
@ -124,7 +124,7 @@ export const ImportDashboardForm = ({
|
||||
error={errors.dataSources && errors.dataSources[index] && 'A data source is required'}
|
||||
>
|
||||
<InputControl
|
||||
name={dataSourceOption as any}
|
||||
name={dataSourceOption}
|
||||
render={({ field: { ref, ...field } }) => (
|
||||
<DataSourcePicker
|
||||
{...field}
|
||||
@ -142,7 +142,7 @@ export const ImportDashboardForm = ({
|
||||
})}
|
||||
{inputs.constants &&
|
||||
inputs.constants.map((input: DashboardInput, index) => {
|
||||
const constantIndex = `constants[${index}]`;
|
||||
const constantIndex = `constants.${index}` as const;
|
||||
return (
|
||||
<Field
|
||||
label={input.label}
|
||||
@ -150,7 +150,7 @@ export const ImportDashboardForm = ({
|
||||
invalid={errors.constants && !!errors.constants[index]}
|
||||
key={constantIndex}
|
||||
>
|
||||
<Input {...register(constantIndex as any, { required: true })} defaultValue={input.value} />
|
||||
<Input {...register(constantIndex, { required: true })} defaultValue={input.value} />
|
||||
</Field>
|
||||
);
|
||||
})}
|
||||
|
Loading…
Reference in New Issue
Block a user