From 8abbdbdf6956e86a840bd240cf951b2b948f3bd9 Mon Sep 17 00:00:00 2001 From: Thomas Neirynck Date: Mon, 13 Apr 2020 17:26:53 -0400 Subject: [PATCH] fix typing issues --- .../sources/mvt_vector_source/layer_wizard.tsx | 10 ++-------- .../mvt_single_layer_vector_source.ts | 14 ++++++++------ .../mvt_vector_source/mvt_vector_source_editor.tsx | 9 +++++---- .../plugins/maps/public/layers/sources/source.d.ts | 2 +- .../sources/vector_source/vector_source.d.ts | 4 ++-- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/layer_wizard.tsx b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/layer_wizard.tsx index caabe1ab8f12d..9e021c4bfb1d6 100644 --- a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/layer_wizard.tsx +++ b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/layer_wizard.tsx @@ -11,20 +11,14 @@ import { MVTSingleLayerVectorSourceConfig, } from './mvt_vector_source_editor'; import { MVTSingleLayerVectorSource, sourceTitle } from './mvt_single_layer_vector_source'; -import { LayerWizard } from '../../layer_wizard_registry'; +import { LayerWizard, RenderWizardArguments } from '../../layer_wizard_registry'; export const mvtVectorSourceWizardConfig: LayerWizard = { description: i18n.translate('xpack.maps.source.mvtVectorSourceWizard', { defaultMessage: 'Vector source wizard', }), icon: 'grid', - renderWizard: ({ - onPreviewSource, - inspectorAdapters, - }: { - onPreviewSource: (source: MVTSingleLayerVectorSource) => void; - inspectorAdapters: object; - }) => { + renderWizard: ({ onPreviewSource, inspectorAdapters }: RenderWizardArguments) => { const onSourceConfigChange = ({ urlTemplate, layerName, diff --git a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_single_layer_vector_source.ts b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_single_layer_vector_source.ts index 783cba1834a5f..a76e9bdfe228a 100644 --- a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_single_layer_vector_source.ts +++ b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_single_layer_vector_source.ts @@ -6,9 +6,13 @@ import { i18n } from '@kbn/i18n'; import uuid from 'uuid/v4'; -import { AbstractSource, ImmutableSourceProperty } from '../source'; +import { ImmutableSourceProperty } from '../source'; import { SingleTiledVectorLayer } from '../../tiled_vector_layer'; -import { GeoJsonWithMeta, ITiledSingleLayerVectorSource } from '../vector_source'; +import { + AbstractVectorSource, + GeoJsonWithMeta, + ITiledSingleLayerVectorSource, +} from '../vector_source'; import { MAX_ZOOM, MIN_ZOOM, SOURCE_TYPES } from '../../../../common/constants'; import { VECTOR_SHAPE_TYPES } from '../vector_feature_types'; import { IField } from '../../fields/field'; @@ -27,7 +31,7 @@ export const sourceTitle = i18n.translate('xpack.maps.source.ems_xyzVectorTitle' defaultMessage: 'Vector Tile Layer', }); -export class MVTSingleLayerVectorSource extends AbstractSource +export class MVTSingleLayerVectorSource extends AbstractVectorSource implements ITiledSingleLayerVectorSource { static type = SOURCE_TYPES.MVT_SINGLE_LAYER; static title = i18n.translate('xpack.maps.source.tiledSingleLayerVectorTitle', { @@ -98,8 +102,6 @@ export class MVTSingleLayerVectorSource extends AbstractSource return []; } - // getImmutableProperties(): Promise; - async getImmutableProperties(): Promise { return [ { label: getDataSourceLabel(), value: sourceTitle }, @@ -123,7 +125,7 @@ export class MVTSingleLayerVectorSource extends AbstractSource }; } - async getSupportedShapeTypes() { + async getSupportedShapeTypes(): Promise { return [VECTOR_SHAPE_TYPES.POINT, VECTOR_SHAPE_TYPES.LINE, VECTOR_SHAPE_TYPES.POLYGON]; } diff --git a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_vector_source_editor.tsx b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_vector_source_editor.tsx index 30cf07d5055fb..58eaccc065591 100644 --- a/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_vector_source_editor.tsx +++ b/x-pack/plugins/maps/public/layers/sources/mvt_vector_source/mvt_vector_source_editor.tsx @@ -24,10 +24,11 @@ export interface Props { } interface State { - tmsInput: string; - tmsCanPreview: boolean; - attributionText: string; - attributionUrl: string; + urlTemplate: string; + layerName: string; + minZoom: number; + maxZoom: number; + mvtCanPreview: boolean; } export class MVTVectorSourceEditor extends Component { diff --git a/x-pack/plugins/maps/public/layers/sources/source.d.ts b/x-pack/plugins/maps/public/layers/sources/source.d.ts index a1581b826d9a6..85b54cbf20216 100644 --- a/x-pack/plugins/maps/public/layers/sources/source.d.ts +++ b/x-pack/plugins/maps/public/layers/sources/source.d.ts @@ -19,7 +19,7 @@ export type Attribution = { }; export interface ISource { - createDefaultLayer(): ILayer; + createDefaultLayer(options?: LayerDescriptor): ILayer; destroy(): void; getDisplayName(): Promise; getInspectorAdapters(): object; diff --git a/x-pack/plugins/maps/public/layers/sources/vector_source/vector_source.d.ts b/x-pack/plugins/maps/public/layers/sources/vector_source/vector_source.d.ts index 5a25914e5e443..df3f71e288c8d 100644 --- a/x-pack/plugins/maps/public/layers/sources/vector_source/vector_source.d.ts +++ b/x-pack/plugins/maps/public/layers/sources/vector_source/vector_source.d.ts @@ -47,9 +47,9 @@ export class AbstractVectorSource extends AbstractSource implements IVectorSourc ): Promise; getFields(): Promise; - getFieldByName(fieldName: string): IField; + getFieldByName(fieldName: string): IField | null; getSyncMeta(): VectorSourceSyncMeta; - getSupportedShapeTypes(): VECTOR_SHAPE_TYPES[]; + getSupportedShapeTypes(): Promise; canFormatFeatureProperties(): boolean; getApplyGlobalQuery(): boolean; getFieldNames(): string[];