Skip to content

Commit

Permalink
fix typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Apr 13, 2020
1 parent 98bdc4e commit 8abbdbd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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', {
Expand Down Expand Up @@ -98,8 +102,6 @@ export class MVTSingleLayerVectorSource extends AbstractSource
return [];
}

// getImmutableProperties(): Promise<ImmutableSourceProperty[]>;

async getImmutableProperties(): Promise<ImmutableSourceProperty[]> {
return [
{ label: getDataSourceLabel(), value: sourceTitle },
Expand All @@ -123,7 +125,7 @@ export class MVTSingleLayerVectorSource extends AbstractSource
};
}

async getSupportedShapeTypes() {
async getSupportedShapeTypes(): Promise<VECTOR_SHAPE_TYPES[]> {
return [VECTOR_SHAPE_TYPES.POINT, VECTOR_SHAPE_TYPES.LINE, VECTOR_SHAPE_TYPES.POLYGON];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Props, State> {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/maps/public/layers/sources/source.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type Attribution = {
};

export interface ISource {
createDefaultLayer(): ILayer;
createDefaultLayer(options?: LayerDescriptor): ILayer;
destroy(): void;
getDisplayName(): Promise<string>;
getInspectorAdapters(): object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ export class AbstractVectorSource extends AbstractSource implements IVectorSourc
): Promise<GeoJsonWithMeta>;

getFields(): Promise<IField[]>;
getFieldByName(fieldName: string): IField;
getFieldByName(fieldName: string): IField | null;
getSyncMeta(): VectorSourceSyncMeta;
getSupportedShapeTypes(): VECTOR_SHAPE_TYPES[];
getSupportedShapeTypes(): Promise<VECTOR_SHAPE_TYPES[]>;
canFormatFeatureProperties(): boolean;
getApplyGlobalQuery(): boolean;
getFieldNames(): string[];
Expand Down

0 comments on commit 8abbdbd

Please sign in to comment.