Skip to content

Commit

Permalink
Filter pdf format from layer.downloads format array.
Browse files Browse the repository at this point in the history
  • Loading branch information
volterra79 committed May 14, 2024
1 parent 900ec21 commit 471b75f
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/components/QueryResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@
</span>
</span>
<!-- DOWNLOAD -->
<template v-if="1 === layer.downloads.length">
<template v-if="1 === getLayerDownloads(layer.downloads).length ">
<span
class = "action-button"
:class = "{'toggled': layer[layer.downloads[0]].active}"
:class = "{'toggled': layer.downloadformats.active}"
v-t-tooltip:left.create = "`sdk.mapcontrols.query.actions.download_features_${layer.downloads[0]}.hint`"
v-download
>
<span
class = "action-button-icon"
:class = "g3wtemplate.getFontClass('download')"
@click.stop = "saveLayerResult(layer, layer.downloads[0])"
@click.stop = "saveLayerResult(layer, getLayerDownloads(layer.downloads)[0])"
></span>
</span>
</template>
<template v-else-if="layer.downloads.length > 1">
<template v-else-if="getLayerDownloads(layer.downloads).length > 1">
<span
class = "action-button"
:class = "{'toggled': layer.downloadformats.active}"
Expand Down Expand Up @@ -491,7 +491,7 @@
mixins: [fieldsMixin],
components: {
TableAttributeFieldValue,
'infoformats': InfoFormats,
'infoformats': InfoFormats,
'header-feature-body': HeaderFeatureBody,
HeaderFeatureActionsBody
},
Expand Down Expand Up @@ -560,7 +560,7 @@
*
* return {Array} return array of download formats enable of layer features
*/
getLayerDownloads(downloads=[]) {
getLayerDownloads(downloads = []) {
return downloads.filter(d => 'pdf' !== d);
},

Expand All @@ -571,7 +571,7 @@
*
* @since 3.9.1
*/
showLayer(layer){
showLayer(layer) {
return (
layer.show && // check if is set show
(
Expand All @@ -589,7 +589,7 @@
* @param position
* @returns {*}
*/
getLayerCustomComponents(layerId, type = 'feature', position = 'after'){
getLayerCustomComponents(layerId, type = 'feature', position = 'after') {
return this.state.layerscustomcomponents[layerId]
&& this.state.layerscustomcomponents[layerId][type]
&& this.state.layerscustomcomponents[layerId][type][position]
Expand All @@ -606,7 +606,7 @@
getQueryFields(layer, feature) {
const fields = [];
for (const field of layer.formStructure.fields) {
const _field = {...field};
const _field = { ...field };
_field.query = true;
_field.value = feature.attributes[field.name];
_field.input = {
Expand All @@ -626,8 +626,7 @@
this.$options.service.addLayerFeaturesToResultsAction(layer);
},
showDownloadAction(evt) {
const display = evt.target.children[0].style.display;
evt.target.children[0].style.display = display === 'none' ? 'inline-block' : 'none';
evt.target.children[0].style.display = evt.target.children[0].style.display === 'none' ? 'inline-block' : 'none';
},
printAtlas(layer) {
this.$options.service.printAtlas(layer);
Expand All @@ -636,7 +635,7 @@
this.$options.service.showLayerDownloadFormats(layer)
},
saveLayerResult(layer, type="csv") {
this.$options.service.saveLayerResult({layer, type});
this.$options.service.saveLayerResult({ layer, type });
},
hasLayerOneFeature(layer) {
return layer.features.length === 1;
Expand Down Expand Up @@ -771,14 +770,14 @@
},
getLayerFeatureBox(layer, feature, relation_index) {
const boxid = this.getBoxId(layer, feature, relation_index);
if (this.state.layersFeaturesBoxes[boxid] === undefined) {
if (undefined === this.state.layersFeaturesBoxes[boxid] ) {
this.state.layersFeaturesBoxes[boxid] = Vue.observable({
collapsed: true
});
this.$watch(
() => this.state.layersFeaturesBoxes[boxid].collapsed,
collapsed => {
const index = layer.features.findIndex(_feature => feature.id === _feature.id);
const index = layer.features.findIndex(_feature => feature.id === _feature.id);
const container = this.getContainerFromFeatureLayer({ layer, index });
this.$options.service.openCloseFeatureResult({ open:!collapsed, layer, feature, container })
}
Expand Down Expand Up @@ -815,7 +814,7 @@
if (!this.hasLayerOneFeature(layer)) { this.toggleFeatureBox(layer, feature, relation_index) }
},
async trigger(action,layer,feature, index) {
if (action.opened && $(`#${layer.id}_${index}`).css('display') === 'none') {
if (action.opened && 'none' === $(`#${layer.id}_${index}`).css('display')) {
this.toggleFeatureBox(layer, feature);
await this.$nextTick();
}
Expand Down Expand Up @@ -868,7 +867,9 @@
await this.$nextTick();
},
onelayerresult(bool) {
bool && this.$options.service.highlightFeaturesPermanently(this.state.layers[0]);
if (bool) {
this.$options.service.highlightFeaturesPermanently(this.state.layers[0]);
}
}
},
created() {
Expand Down

0 comments on commit 471b75f

Please sign in to comment.