Skip to content

Commit

Permalink
feedback (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Apr 15, 2020
1 parent 6b881ce commit 030d1e8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,21 @@ export class MVTSingleLayerVectorSourceEditor extends Component<Props, State> {
render() {
return (
<Fragment>
<EuiFormRow label="Url">
<EuiFormRow
label={i18n.translate('xpack.maps.source.MVTSingleLayerVectorSourceEditor.urlMessage', {
defaultMessage: 'Url',
})}
>
<EuiFieldText value={this.state.urlTemplate} onChange={this._handleUrlTemplateChange} />
</EuiFormRow>
<EuiFormRow label="Layer name">
<EuiFormRow
label={i18n.translate(
'xpack.maps.source.MVTSingleLayerVectorSourceEditor.layerNameMessage',
{
defaultMessage: 'Layer name',
}
)}
>
<EuiFieldText value={this.state.layerName} onChange={this._handleLayerNameInputChange} />
</EuiFormRow>
<ValidatedDualRange
Expand All @@ -106,9 +117,12 @@ export class MVTSingleLayerVectorSourceEditor extends Component<Props, State> {
onChange={this._handleZoomRangeChange}
allowEmptyRange={false}
compressed
prepend={i18n.translate('xpack.maps.source.mvtVectorSource.dataZoomRangeMessage', {
defaultMessage: 'Zoom levels',
})}
prepend={i18n.translate(
'xpack.maps.source.MVTSingleLayerVectorSourceEditor.dataZoomRangeMessage',
{
defaultMessage: 'Zoom levels',
}
)}
/>
</Fragment>
);
Expand Down
63 changes: 21 additions & 42 deletions x-pack/plugins/maps/public/layers/tiled_vector_layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
VectorLayerDescriptor,
VectorSourceRequestMeta,
} from '../../common/descriptor_types';
import { MVTSingleLayerVectorSourceConfig } from './sources/mvt_single_layer_vector_source/mvt_single_layer_vector_source_editor';

export class TiledVectorLayer extends VectorLayer {
static type = LAYER_TYPE.TILED_VECTOR;
Expand Down Expand Up @@ -50,23 +51,23 @@ export class TiledVectorLayer extends VectorLayer {
};
}

_getSearchFilters(
mapFilters: MapFilters,
source: IVectorSource,
style: IVectorStyle
): VectorSourceRequestMeta {
const fieldNames = [...source.getFieldNames(), ...style.getSourceFieldNames()];

const requestMeta: VectorSourceRequestMeta = {
...mapFilters,
applyGlobalQuery: this._source.getApplyGlobalQuery(),
sourceMeta: this._source.getSyncMeta(),
fieldNames,
sourceQuery: this.getQuery(),
};

return requestMeta;
}
// _getSearchFilters(
// mapFilters: MapFilters,
// source: IVectorSource,
// style: IVectorStyle
// ): VectorSourceRequestMeta {
// const fieldNames = [...source.getFieldNames(), ...style.getSourceFieldNames()];
//
// const requestMeta: VectorSourceRequestMeta = {
// ...mapFilters,
// applyGlobalQuery: this._source.getApplyGlobalQuery(),
// sourceMeta: this._source.getSyncMeta(),
// fieldNames,
// sourceQuery: this.getQuery(),
// };
//
// return requestMeta;
// }

async _syncMVTUrlTemplate({ startLoading, stopLoading, onLoadError, dataFilters }: SyncContext) {
const requestToken: symbol = Symbol(`layer-${this.getId()}-${SOURCE_DATA_ID_ORIGIN}`);
Expand Down Expand Up @@ -117,17 +118,7 @@ export class TiledVectorLayer extends VectorLayer {
return;
}

const sourceMeta: {
layerName: string;
urlTemplate: string;
minSourceZoom: number;
maxSourceZoom: number;
} | null = sourceDataRequest.getData() as {
layerName: string;
urlTemplate: string;
minSourceZoom: number;
maxSourceZoom: number;
};
const sourceMeta: MVTSingleLayerVectorSourceConfig | null = sourceDataRequest.getData() as MVTSingleLayerVectorSourceConfig;
if (!sourceMeta) {
return;
}
Expand Down Expand Up @@ -155,11 +146,7 @@ export class TiledVectorLayer extends VectorLayer {
if (!sourceDataRequest) {
return;
}
const sourceMeta: {
layerName: string;
} = sourceDataRequest.getData() as {
layerName: string;
};
const sourceMeta: MVTSingleLayerVectorSourceConfig = sourceDataRequest.getData() as MVTSingleLayerVectorSourceConfig;
const options = { mvtSourceLayer: sourceMeta.layerName };

this._setMbPointsProperties(mbMap, options);
Expand All @@ -176,15 +163,7 @@ export class TiledVectorLayer extends VectorLayer {
if (!dataRequest) {
return false;
}
const tiledSourceMeta: {
urlTemplate: string;
minSourceZoom: number;
maxSourceZoom: number;
} | null = dataRequest.getData() as {
urlTemplate: string;
minSourceZoom: number;
maxSourceZoom: number;
};
const tiledSourceMeta: MVTSingleLayerVectorSourceConfig | null = dataRequest.getData() as MVTSingleLayerVectorSourceConfig;
if (
mbTileSource.tiles[0] === tiledSourceMeta.urlTemplate &&
mbTileSource.minzoom === tiledSourceMeta.minSourceZoom &&
Expand Down

0 comments on commit 030d1e8

Please sign in to comment.