From 83d0793a3567eb3aeddc15110ddc982f4f40ad8e Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 7 Jul 2017 06:58:58 +0530 Subject: [PATCH] Hiding geo dashboard tools when GeoLocationConfiguration is Disabled --- .../config/geo/location/GeoLocationConfiguration.java | 10 ++++++++++ .../devicemgt/app/modules/conf-reader/main.js | 2 ++ .../app/units/cdmf.unit.geo-dashboard/geo-dashboard.js | 2 +- .../src/main/resources/conf/cdm-config.xml | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java index ee3f1556d8..e1aeb1a45c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java @@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlRootElement; public class GeoLocationConfiguration { private boolean publishLocationOperationResponse; + private boolean isEnabled; public boolean getPublishLocationOperationResponse() { return publishLocationOperationResponse; @@ -37,4 +38,13 @@ public class GeoLocationConfiguration { public void setPublishLocationOperationResponse(boolean publishLocationOperationResponse) { this.publishLocationOperationResponse = publishLocationOperationResponse; } + + public boolean getIsEnabled() { + return isEnabled; + } + + @XmlElement(name = "isEnabled", required = true) + public void setEnabled(boolean enabled) { + isEnabled = enabled; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js index ce57a85980..ba61809f7d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/conf-reader/main.js @@ -56,6 +56,8 @@ var conf = function () { } } ); + var DeviceConfigurationManager = Packages.org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; + conf["serverConfig"] = DeviceConfigurationManager.getInstance().getDeviceManagementConfig(); application.put("CONF", conf); } return conf; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js index a01115ce1d..e41cde4345 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.js @@ -52,6 +52,6 @@ function onRequest(context) { } else { viewModel.lastLocation = stringify({}); } - viewModel.showGeoFencingTools = true; + viewModel.showGeoFencingTools = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled; return viewModel; } \ No newline at end of file diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml index 87a33c7dc2..0f0312f977 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/conf/cdm-config.xml @@ -79,6 +79,7 @@ 600 + false false