Skip to content

Commit

Permalink
Hide print output window if printing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Apr 24, 2024
1 parent 9a405b7 commit 4735496
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qwc2",
"version": "2024.04.23-master",
"version": "2024.04.24-master",
"description": "QGIS Web Client 2 core",
"author": "Sourcepole AG",
"license": "BSD-2-Clause",
Expand Down
5 changes: 3 additions & 2 deletions plugins/Print.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ class Print extends React.Component {
<input name={mapName + ":LAYERS"} readOnly type={formvisibility} value={printParams.LAYERS} />
<input name={mapName + ":STYLES"} readOnly type={formvisibility} value={printParams.STYLES} />
<input name={mapName + ":FILTER"} readOnly type={formvisibility} value={printParams.FILTER} />
<input name={mapName + ":FILTER_GEOM"} readOnly type={formvisibility} value={printParams.FILTER_GEOM} />
<input name={mapName + ":HIGHLIGHT_GEOM"} readOnly type={formvisibility} value={highlightParams.geoms.join(";")} />
<input name={mapName + ":HIGHLIGHT_SYMBOL"} readOnly type={formvisibility} value={highlightParams.styles.join(";")} />
<input name={mapName + ":HIGHLIGHT_LABELSTRING"} readOnly type={formvisibility} value={highlightParams.labels.join(";")} />
Expand Down Expand Up @@ -616,10 +617,10 @@ class Print extends React.Component {
FileSaver.saveAs(file, this.props.theme.name + '.' + ext);
}
}).catch(e => {
this.setState({printing: false});
this.setState({printing: false, outputLoaded: true, printOutputVisible: false});
if (e.response) {
/* eslint-disable-next-line */
console.log(new TextDecoder().decode(e.response.data));
console.warn(new TextDecoder().decode(e.response.data));
}
/* eslint-disable-next-line */
alert('Print failed');
Expand Down
4 changes: 3 additions & 1 deletion utils/LayerUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ const LayerUtils = {
OPACITIES: [],
STYLES: [],
COLORS: [],
FILTER: ''
FILTER: '',
FILTER_GEOM: ''
};
const counterRef = [0];

Expand All @@ -851,6 +852,7 @@ const LayerUtils = {
params.STYLES.push(layer.params.STYLES);
params.COLORS.push(layer.params.LAYERS.split(",").map(() => "").join(","));
params.FILTER = layer.params.FILTER ?? '';
params.FILTER_GEOM = layer.params.FILTER_GEOM ?? '';
} else if (printExternalLayers && layer.role === LayerRole.USERLAYER && layer.visibility !== false && LayerUtils.layerScaleInRange(layer, printScale)) {
LayerUtils.addExternalLayerPrintParams(layer, params, printCrs, counterRef);
}
Expand Down

0 comments on commit 4735496

Please sign in to comment.