From ca95dba5af12c07ef648ab5b1282ff2fc10de1db Mon Sep 17 00:00:00 2001 From: Oliver Christen Date: Wed, 6 Mar 2019 11:11:05 +0100 Subject: [PATCH] Only enable the filter tool in the toolbar if at least on layer has been set in the filterable_layers list in the project config, either as anonymous functionalities or through a functionalities set to a role in the admin interface. --- contribs/gmf/apps/desktop/index.html.ejs | 2 +- .../gmf/src/controllers/AbstractAppController.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/contribs/gmf/apps/desktop/index.html.ejs b/contribs/gmf/apps/desktop/index.html.ejs index d22946b91274..82fdb4412126 100644 --- a/contribs/gmf/apps/desktop/index.html.ejs +++ b/contribs/gmf/apps/desktop/index.html.ejs @@ -61,7 +61,7 @@ data-toggle="tooltip" data-placement="left" data-original-title="{{'Draw and Measure'|translate}}"> - diff --git a/contribs/gmf/src/controllers/AbstractAppController.js b/contribs/gmf/src/controllers/AbstractAppController.js index 325d1050b61d..a94cf848d70e 100644 --- a/contribs/gmf/src/controllers/AbstractAppController.js +++ b/contribs/gmf/src/controllers/AbstractAppController.js @@ -164,10 +164,18 @@ const exports = function(config, $scope, $injector) { const user = evt.detail.user; const roleId = (user.username !== null) ? user.role_id : undefined; + const functionalities = this.gmfUser.functionalities; + + // Enable filter tool in toolbar + if (functionalities && + 'filterable_layers' in functionalities && + functionalities['filterable_layers'].length > 0) { + this.filterSelectorEnabled = true; + } + // Open filter panel if 'open_panel' is set in functionalities and // has 'layer_filter' as first value this.gmfThemes_.getThemesObject().then((themes) => { - const functionalities = this.gmfUser.functionalities; if (functionalities && functionalities.open_panel && functionalities.open_panel[0] === 'layer_filter') { @@ -276,6 +284,12 @@ const exports = function(config, $scope, $injector) { stroke: queryStroke }); + /** + * @type {boolean} + * @export + */ + this.filterSelectorEnabled = false; + /** * @type {boolean} * @export