Chore: Improve typings and ignore Graph (#75742)

* fix some types, ignore graph plugin as it'll be gone soon

* update comments

* more more more

* undo renderer change

* use Partial in the editor
This commit is contained in:
Ashley Harrison
2023-10-06 11:48:15 +01:00
committed by GitHub
parent d8357342a3
commit 171e2c1adb
32 changed files with 137 additions and 562 deletions

View File

@@ -163,7 +163,7 @@ export const dayNightLayer: MapLayerRegistryItem<DayNightConfig> = {
if (false) {
subscriptions.add(
eventBus.subscribe(DataHoverEvent, (event) => {
const time = event.payload?.point?.time as number;
const time: number = event.payload?.point?.time;
if (time) {
const lineTime = new Date(time);
const nightLinePoints = sourceLine.getCoordinates(lineTime.toString(), 'line');

View File

@@ -50,7 +50,7 @@ export const heatmapLayer: MapLayerRegistryItem<HeatmapConfig> = {
*/
create: async (map: Map, options: MapLayerOptions<HeatmapConfig>, eventBus: EventBus, theme: GrafanaTheme2) => {
const config = { ...defaultOptions, ...options.config };
const location = await getLocationMatchers(options.location);
const source = new FrameVectorSource<Point>(location);
const WEIGHT_KEY = "_weight";
@@ -77,7 +77,7 @@ export const heatmapLayer: MapLayerRegistryItem<HeatmapConfig> = {
const weightDim = getScaledDimension(frame, config.weight);
source.forEachFeature( (f) => {
const idx = f.get('rowIndex') as number;
const idx: number = f.get('rowIndex');
if(idx != null) {
f.set(WEIGHT_KEY, weightDim.get(idx));
}

View File

@@ -89,7 +89,7 @@ export const markersLayer: MapLayerRegistryItem<MarkersConfig> = {
vectorLayer.setStyle(style.maker(style.base));
} else {
vectorLayer.setStyle((feature: FeatureLike) => {
const idx = feature.get('rowIndex') as number;
const idx: number = feature.get('rowIndex');
const dims = style.dims;
if (!dims || !isNumber(idx)) {
return style.maker(style.base);

View File

@@ -96,7 +96,7 @@ export const photosLayer: MapLayerRegistryItem<PhotoConfig> = {
let src = unknownImage;
let idx = Infinity;
if (images.length > 0) {
idx = feature.get('rowIndex') as number;
idx = feature.get('rowIndex');
src = images[idx] ?? unknownImage;
}
const photoStyle = new Style({

View File

@@ -98,7 +98,7 @@ export const routeLayer: MapLayerRegistryItem<RouteConfig> = {
vectorLayer.setStyle(styleBase);
} else {
vectorLayer.setStyle((feature: FeatureLike) => {
const idx = feature.get('rowIndex') as number;
const idx: number = feature.get('rowIndex');
const dims = style.dims;
if (!dims || !isNumber(idx)) {
return routeStyle(style.base);
@@ -223,8 +223,8 @@ export const routeLayer: MapLayerRegistryItem<RouteConfig> = {
.subscribe({
next: (event) => {
const feature = source.getFeatures()[0];
const frame = feature?.get('frame') as DataFrame;
const time = event.payload?.point?.time as number;
const frame: DataFrame = feature?.get('frame');
const time: number = event.payload?.point?.time;
if (frame && time) {
const timeField = frame.fields.find((f) => f.name === TIME_SERIES_TIME_FIELD_NAME);
if (timeField) {