@@ -769,6 +694,28 @@ data-device-location="{{lastLocation}}">
{{js "js/app.js" }}
{{js "js/websocket.js" }}
{{js "js/geo_fencing.js" }}
+
+
{{/zone}}
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 7fa6801559f..cba63457dc2 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
@@ -54,5 +54,6 @@ function onRequest(context) {
} else {
viewModel.lastLocation = stringify({});
}
+ viewModel.showGeoFencingTools = true;
return viewModel;
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/app.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/app.css
index cd738bec181..3a078528ad4 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/app.css
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/app.css
@@ -13,7 +13,6 @@ input[type="radio"], input[type="checkbox"] {
#map {
width: auto;
height: 100%;
- box-shadow: 0 0 10px rgba(0,0,0,0.5);
}
#loading {
position: absolute;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet.css
index 1232550253c..436e94f6656 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet.css
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/css/leaflet.css
@@ -86,7 +86,7 @@
.leaflet-top,
.leaflet-bottom {
position: absolute;
- z-index: 1000;
+ z-index: 999;
pointer-events: none;
}
.leaflet-top {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js
index 0f3bbd2c274..3577ee56627 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/app.js
@@ -31,6 +31,10 @@ $('body').on('hidden.bs.modal', '.modal', function () {
/*Map layer configurations*/
var map;
+var zoomLevel = 15;
+var tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
+var attribution = "©
OpenStreetMap contributors";
+
function initialLoad() {
if (document.getElementById('map') == null) {
setTimeout(initialLoad, 500); // give everything some time to render
@@ -101,6 +105,8 @@ function initializeMap() {
maxZoom: 20,
maxNativeZoom: 18
});
+ L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
+
map.zoomControl.setPosition('bottomleft');
map.on('click', function (e) {
$.noty.closeAll();
@@ -291,7 +297,7 @@ function focusOnSpatialObject(objectId) {
return true;
}
- map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
+ map.setView(spatialObject.marker.getLatLng(), zoomLevel, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
$('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
spatialObject.marker.openPopup();
@@ -315,15 +321,6 @@ var getProviderData = function (timeFrom, timeTo) {
deviceId = deviceDetails.data("deviceid");
deviceType = deviceDetails.data("type");
- // $.ajax({
- // url: context + '/api/geo-location/' + deviceType + '/' + deviceId + '?from=' + timeFrom + '&to=' + timeTo,
- // method: "GET",
- // contentType: "application/json",
- // async: false,
- // success: function (data) {
- // tableData = data;
- // }
- // });
var serviceUrl = '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + timeFrom + '&to=' + timeTo;
invokerUtil.get(serviceUrl,
function (data) {
@@ -445,7 +442,7 @@ function InitSpatialObject() {
return true;
}
- map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
+ map.setView(spatialObject.marker.getLatLng(), zoomLevel, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
$('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
spatialObject.marker.openPopup();
@@ -510,7 +507,7 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
return true;
}
- map.setView(spatialObject.marker.getLatLng(), 15, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
+ map.setView(spatialObject.marker.getLatLng(), zoomLevel, {animate: true}); // TODO: check the map._layersMaxZoom and set the zoom level accordingly
$('#objectInfo').find('#objectInfoId').html(selectedSpatialObject);
spatialObject.marker.openPopup();
@@ -534,4 +531,12 @@ function clearFocus() {
spatialObject.removeFromMap();
selectedSpatialObject = null;
}
+}
+
+function createGeoToolListItem(link, text, icon, menuRoot) {
+ var listItem = $("
", { class: 'list-group-item'}).appendTo(menuRoot);
+ var anchor = $("
", {href: link, text: ' ' + text}).appendTo(listItem);
+ anchor.attr('data-toggle', 'modal');
+ anchor.attr('data-target', '#commonModal');
+ $("
", {class: icon}).prependTo(anchor);
}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js
index 2f99acb0f24..fef348afe90 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js
@@ -308,7 +308,12 @@ function updateDrawing(updatedGeoJson) {
}
function viewFence(geoFenceElement,id) {
- var geoJson = JSON.parse($(geoFenceElement).attr('data-geoJson').replace(/'/g, '"'));
+ var geoJson = $(geoFenceElement).attr('data-geoJson');
+ var matchResults = /(?:"geoFenceGeoJSON"):"{(.*)}"/g.exec(geoJson);
+ if (matchResults.length > 1) {
+ geoJson = "{" + matchResults[1] + "}";
+ }
+ geoJson = JSON.parse(geoJson.replace(/'/g, '"'));
var queryName = $(geoFenceElement).attr('data-queryName');
var areaName = $(geoFenceElement).attr('data-areaName');
var geometryShape;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_stationary.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_stationary.js
index 13df90be21d..2c8271a8801 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_stationary.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_stationary.js
@@ -24,7 +24,6 @@ function initStationaryAlert() {
invokerUtil.get(serverUrl, function (response) {
if (response) {
response = JSON.parse(response);
- console.log(response);
$(".fence-not-exist").hide();
for (var index in response) {
var alert = response[index];
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js
index 73f5f0a9a09..593d721fad3 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/websocket.js
@@ -638,7 +638,7 @@ function initializeOnAlertWebSocket() {
onAlertWebsocket.onopen = webSocketOnAlertOpen;
}
-function initializeGeoFencing() {
+function initializeGeoLocation() {
var deviceDetails = $(".device-id");
deviceId = deviceDetails.data("deviceid");
deviceType = deviceDetails.data("type");
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css
index 48a92fd4aab..af4b8cf6ad0 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.theme/public/css/custom-common.css
@@ -274,4 +274,19 @@ header .username {
ul#noty_topRight_layout_container li{
margin-bottom: 10px;
+}
+
+.list-group-item.active > .list-group{
+ display: block;
+ margin-bottom: 0px;
+}
+
+.list-group-item.active > .list-group > .list-group-item > a{
+ background: none;
+}
+
+.list-group-item.active > .list-group > .list-group-item > a:active,
+.list-group-item.active > .list-group > .list-group-item > a:focus,
+.list-group-item.active > .list-group > .list-group-item > a:hover{
+ color : whitesmoke;
}
\ No newline at end of file