Skip to content

Commit

Permalink
Fixed configUtils source missing and filtering layers with source (#1613
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MV88 authored Mar 20, 2017
1 parent 14d6636 commit e017f1d
Showing 1 changed file with 7 additions and 4 deletions.
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

0 comments on commit e017f1d

Please sign in to comment.