Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #1611 configUtils source missing and filtering layers with source #1613

Merged
merged 1 commit into from
Mar 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions web/client/utils/ConfigUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ var ConfigUtils = {
convertFromLegacy: function(config) {
var mapConfig = config.map;
var sources = config.gsSources || config.sources;
var layers = mapConfig.layers;
var layers = mapConfig.layers.filter(layer => sources[layer.source]);
var latLng = ConfigUtils.getCenter(mapConfig.center, mapConfig.projection);
var zoom = mapConfig.zoom;
var maxExtent = mapConfig.maxExtent || mapConfig.extent;

// setup layers and sources with defaults
this.setupSources(sources, config.defaultSourceType);
this.setupLayers(layers, sources, ["gxp_osmsource", "gxp_wmssource", "gxp_googlesource", "gxp_bingsource", "gxp_mapquestsource"]);
this.setupLayers(layers, sources, ["gxp_osmsource", "gxp_wmssource", "gxp_googlesource", "gxp_bingsource", "gxp_mapquestsource", "gxp_olsource"]);
return ConfigUtils.normalizeConfig({
center: latLng,
zoom: zoom,
Expand Down Expand Up @@ -183,15 +183,18 @@ var ConfigUtils = {
for (i = 0; i < layers.length; i++) {
layer = layers[i];
source = sources[layer.source];
ConfigUtils.copySourceOptions(layer, source);
if (source) {
ConfigUtils.copySourceOptions(layer, source);
}

let type = source.ptype;
if (type) {
layer.type = type.replace(/^gxp_(.*)source$/i, "$1");
} else {
layer.type = 'unknown';
}
if (layer) {
if (supportedSourceTypes.indexOf(source.ptype) >= 0) {
if (supportedSourceTypes.indexOf(source && source.ptype) >= 0) {
if (layer.group === this.backgroundGroup) {
// force to false if undefined
layer.visibility = layer.visibility || false;
Expand Down