Skip to content

Commit

Permalink
Merge pull request #4649 from camptocamp/print-no-datasource
Browse files Browse the repository at this point in the history
Don't send datasource when it's not available
  • Loading branch information
sbrunner committed Feb 18, 2019
2 parents bd9ef30 + 234990b commit 6d6355a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions contribs/gmf/options/gmfx.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ gmfx.PermalinkOptions.prototype.pointRecenterZoom
* of the gmf print panel.
* @typedef {{
* simpleAttributes: (Array.<gmfx.PrintSimpleAttributes>|undefined),
* attributes: (Array<string>),
* dpi: (number|undefined),
* dpis: (Array.<number>|undefined),
* formats: (Object.<string, boolean>|undefined),
Expand Down
12 changes: 9 additions & 3 deletions contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,15 @@ exports.Controller_ = class {
if (!this.layoutInfo.simpleAttributes) {
this.layoutInfo.simpleAttributes = [];
}
if (!this.layoutInfo.attributes) {
this.layoutInfo.attributes = [];
}
const simpleAttributes = this.layoutInfo.simpleAttributes;
const previousAttributes = simpleAttributes.splice(0, simpleAttributes.length);

// The attributes without 'clientParams' are the custom layout information (defined by end user).
this.layout_.attributes.forEach((attribute) => {
this.layoutInfo.attributes.push(attribute.name);
if (!attribute['clientParams']) {
name = `${attribute.name}`;
const defaultValue = attribute.default;
Expand Down Expand Up @@ -869,9 +873,11 @@ exports.Controller_ = class {
const scale = this.layoutInfo.scale || this.getOptimalScale_(mapSize, viewResolution);
const datasource = this.getDataSource_();

const customAttributes = {
'datasource': datasource
};
const customAttributes = {};

if (this.layoutInfo.attributes.indexOf('datasource') >= 0) {
customAttributes['datasource'] = datasource;
}

if (this.layoutInfo.simpleAttributes) {
this.layoutInfo.simpleAttributes.forEach((field) => {
Expand Down

0 comments on commit 6d6355a

Please sign in to comment.