Geomap: Cleanup (#54415)

This commit is contained in:
Adela Almasan 2022-08-29 16:34:42 -05:00 committed by GitHub
parent 722aca5c53
commit 89236cf418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 54 deletions

View File

@ -2723,12 +2723,6 @@ exports[`better eslint`] = {
"public/app/core/components/DynamicImports/SafeDynamicImport.tsx:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
],
"public/app/core/components/Layers/LayerDragDropList.tsx: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"]
],
"public/app/core/components/Layers/LayerName.tsx:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"],
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
@ -8323,42 +8317,26 @@ exports[`better eslint`] = {
],
"public/app/plugins/panel/geomap/editor/GeomapStyleRulesEditor.tsx: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.", "1"]
],
"public/app/plugins/panel/geomap/editor/StyleEditor.tsx: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.", "3"],
[0, 0, 0, "Unexpected any. Specify a different type.", "4"],
[0, 0, 0, "Do not use any type assertions.", "4"],
[0, 0, 0, "Do not use any type assertions.", "5"],
[0, 0, 0, "Unexpected any. Specify a different type.", "6"],
[0, 0, 0, "Do not use any type assertions.", "6"],
[0, 0, 0, "Do not use any type assertions.", "7"],
[0, 0, 0, "Unexpected any. Specify a different type.", "8"],
[0, 0, 0, "Do not use any type assertions.", "8"],
[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.", "10"],
[0, 0, 0, "Do not use any type assertions.", "11"],
[0, 0, 0, "Unexpected any. Specify a different type.", "12"],
[0, 0, 0, "Do not use any type assertions.", "13"],
[0, 0, 0, "Unexpected any. Specify a different type.", "14"],
[0, 0, 0, "Do not use any type assertions.", "15"],
[0, 0, 0, "Unexpected any. Specify a different type.", "16"],
[0, 0, 0, "Do not use any type assertions.", "17"],
[0, 0, 0, "Unexpected any. Specify a different type.", "18"],
[0, 0, 0, "Do not use any type assertions.", "19"],
[0, 0, 0, "Unexpected any. Specify a different type.", "20"],
[0, 0, 0, "Do not use any type assertions.", "21"],
[0, 0, 0, "Unexpected any. Specify a different type.", "22"],
[0, 0, 0, "Do not use any type assertions.", "23"],
[0, 0, 0, "Unexpected any. Specify a different type.", "24"],
[0, 0, 0, "Do not use any type assertions.", "25"],
[0, 0, 0, "Unexpected any. Specify a different type.", "26"]
[0, 0, 0, "Do not use any type assertions.", "12"]
],
"public/app/plugins/panel/geomap/editor/StyleRuleEditor.tsx: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.", "1"]
],
"public/app/plugins/panel/geomap/layers/basemaps/carto.ts:5381": [
[0, 0, 0, "Do not use any type assertions.", "0"]

View File

@ -15,13 +15,13 @@ export type LayerDragDropListProps<T extends LayerElement> = {
layers: T[];
getLayerInfo: (element: T) => string;
onDragEnd: (result: DropResult) => void;
onSelect: (element: T) => any;
onDelete: (element: T) => any;
onDuplicate?: (element: T) => any;
onSelect: (element: T) => void;
onDelete: (element: T) => void;
onDuplicate?: (element: T) => void;
showActions: (element: T) => boolean;
selection?: string[]; // list of unique ids (names)
excludeBaseLayer?: boolean;
onNameChange: (element: T, newName: string) => any;
onNameChange: (element: T, newName: string) => void;
verifyLayerNameUniqueness?: (nameToCheck: string) => boolean;
};

View File

@ -436,7 +436,7 @@ export class GeomapPanel extends Component<Props, State> {
});
}
const found = layers.length ? true : false;
const found = Boolean(layers.length);
this.mapDiv!.style.cursor = found ? 'pointer' : 'auto';
return found;
};

View File

@ -44,7 +44,7 @@ export const GeomapStyleRulesEditor: FC<StandardEditorProps<FeatureStyleConfig[]
value.map((style, idx: number) => {
const itemSettings: StandardEditorsRegistryItem<any, StyleRuleEditorSettings> = {
settings,
} as any;
} as StandardEditorsRegistryItem;
return (
<StyleRuleEditor

View File

@ -3,7 +3,7 @@ import React, { FC } from 'react';
import { useObservable } from 'react-use';
import { Observable, of } from 'rxjs';
import { StandardEditorProps } from '@grafana/data';
import { FieldConfigPropertyItem, StandardEditorProps, StandardEditorsRegistryItem } from '@grafana/data';
import {
ColorPicker,
Field,
@ -86,12 +86,12 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
onChange({ ...value, textConfig: { ...value.textConfig, offsetY } });
};
const onTextAlignChange = (textAlign: unknown) => {
onChange({ ...value, textConfig: { ...value.textConfig, textAlign: textAlign as TextAlignment } });
const onTextAlignChange = (textAlign: TextAlignment) => {
onChange({ ...value, textConfig: { ...value.textConfig, textAlign: textAlign } });
};
const onTextBaselineChange = (textBaseline: unknown) => {
onChange({ ...value, textConfig: { ...value.textConfig, textBaseline: textBaseline as TextBaseline } });
const onTextBaselineChange = (textBaseline: TextBaseline) => {
onChange({ ...value, textConfig: { ...value.textConfig, textBaseline: textBaseline } });
};
const propertyOptions = useObservable(settings?.layerInfo ?? of());
@ -119,7 +119,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
placeholderValue: defaultStyleConfig.symbol.fixed,
showSourceRadio: false,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</InlineField>
@ -135,7 +135,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
min: defaultStyleConfig.rotation.min,
max: defaultStyleConfig.rotation.max,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</Field>
@ -166,7 +166,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
max: 1,
step: 0.1,
},
} as any
} as FieldConfigPropertyItem
}
/>
</InlineField>
@ -188,7 +188,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
min: 1,
max: 100,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</Field>
@ -206,7 +206,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
placeholderValue: defaultStyleConfig.symbol.fixed,
showSourceRadio: false,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</Field>
@ -215,7 +215,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
value={value?.color ?? defaultStyleConfig.color}
context={context}
onChange={onColorChange}
item={{} as any}
item={{} as StandardEditorsRegistryItem}
/>
</Field>
<Field label={'Fill opacity'}>
@ -230,7 +230,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
max: 1,
step: 0.1,
},
} as any
} as FieldConfigPropertyItem
}
/>
</Field>
@ -246,7 +246,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
min: defaultStyleConfig.rotation.min,
max: defaultStyleConfig.rotation.max,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</Field>
@ -256,7 +256,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
value={value?.text ?? defaultTextConfig}
context={context}
onChange={onTextChange}
item={{} as any}
item={{} as StandardEditorsRegistryItem}
/>
</Field>
@ -268,7 +268,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
value={value?.textConfig?.fontSize ?? defaultStyleConfig.textConfig.fontSize}
context={context}
onChange={onTextFontSizeChange}
item={{} as any}
item={{} as FieldConfigPropertyItem}
/>
</Field>
<Field label={'X offset'}>
@ -276,7 +276,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
value={value?.textConfig?.offsetX ?? defaultStyleConfig.textConfig.offsetX}
context={context}
onChange={onTextOffsetXChange}
item={{} as any}
item={{} as FieldConfigPropertyItem}
/>
</Field>
<Field label={'Y offset'}>
@ -284,7 +284,7 @@ export const StyleEditor: FC<StandardEditorProps<StyleConfig, StyleEditorOptions
value={value?.textConfig?.offsetY ?? defaultStyleConfig.textConfig.offsetY}
context={context}
onChange={onTextOffsetYChange}
item={{} as any}
item={{} as FieldConfigPropertyItem}
/>
</Field>
</HorizontalGroup>

View File

@ -4,7 +4,7 @@ import React, { FC, useCallback, useMemo } from 'react';
import { useObservable } from 'react-use';
import { Observable } from 'rxjs';
import { GrafanaTheme2, SelectableValue, StandardEditorProps } from '@grafana/data';
import { GrafanaTheme2, SelectableValue, StandardEditorProps, StandardEditorsRegistryItem } from '@grafana/data';
import { Button, InlineField, InlineFieldRow, Select, useStyles2 } from '@grafana/ui';
import { NumberInput } from 'app/core/components/OptionsUI/NumberInput';
@ -199,7 +199,7 @@ export const StyleRuleEditor: FC<StandardEditorProps<FeatureStyleConfig, any, un
simpleFixedValues: true,
layerInfo,
},
} as any
} as StandardEditorsRegistryItem
}
/>
</div>