From 54eafe8ac9a36879fc5ca655e3303000a18a966d Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 25 Jul 2017 17:25:59 +0530 Subject: [PATCH 1/2] Fixing geo fencing issues --- .../app/modules/business-controllers/device.js | 2 +- .../cdmf.unit.geo-dashboard/geo-dashboard.hbs | 12 ++++++++---- .../cdmf.unit.geo-dashboard/public/js/app.js | 4 ++-- .../public/js/firstTemp.js | 4 ++-- .../public/js/geo_remote.js | 15 +++++++++++++++ 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 5cca9bd307..960f777d54 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -79,7 +79,7 @@ deviceModule = function () { var fromDate = new Date(); fromDate.setHours(fromDate.getHours() - 2); var toDate = new Date(); - var serviceUrl = devicemgtProps["httpsURL"] + '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + fromDate + '&to=' + toDate; + var serviceUrl = devicemgtProps["httpsURL"] + '/api/device-mgt/v1.0/geo-services/stats/' + deviceType + '/' + deviceId + '?from=' + fromDate.getTime() + '&to=' + toDate.getTime(); serviceInvokers.XMLHttp.get(serviceUrl, function (backendResponse) { if (backendResponse.status === 200 && backendResponse.responseText) { 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.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs index 5df6319bd3..9ebb1c1f27 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs @@ -531,9 +531,9 @@
- - - + + +
@@ -707,7 +707,7 @@ {{js "js/leaflet/Leaflet.fullscreen.min.js" }} {{js "js/leaflet/Marker.Rotate.js" }} {{js "js/leaflet/leaflet.draw.js" }} - {{js "js/jquery/jquery-ui.min.js" }} + {{!js "js/jquery/jquery-ui.min.js" }} {{js "js/firstTemp.js" }} @@ -749,6 +749,10 @@ 'Add Geofence Exit Alert', 'glyphicon glyphicon-log-out', geoToolsMenu); {{/if}} } + + $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { + $('#dateRangePopup').dialog('close'); + }) }); {{/zone}} 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 dcc9a8c95a..a87c01a49d 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 @@ -254,7 +254,7 @@ function focusOnSpatialObject(objectId) { // TODO: check the map._layersMaxZoom and set the zoom level accordingly spatialObject.marker.openPopup(); - getAlertsHistory(deviceType, deviceId, new Date($('#timeFrom').val()).getTime(), new Date($('#timeTo').val()).getTime()); + getAlertsHistory(deviceType, deviceId, new Date($('#timeFromCal').val()).getTime(), new Date($('#timeToCal').val()).getTime()); spatialObject.drawPath(); if (speedGraphControl) { setTimeout(function () { @@ -504,7 +504,7 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) { // TODO: check the map._layersMaxZoom and set the zoom level accordingly spatialObject.marker.openPopup(); - getAlertsHistory(deviceType, deviceId, new Date($('#timeFrom').val()).getTime(), new Date($('#timeTo').val()).getTime()); + getAlertsHistory(deviceType, deviceId, new Date($('#timeFromCal').val()).getTime(), new Date($('#timeToCal').val()).getTime()); spatialObject.drawPath(); if (speedGraphControl) { setTimeout(function () { 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/firstTemp.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/firstTemp.js index d2430e4f48..73f567fe0a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/firstTemp.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/firstTemp.js @@ -1,8 +1,8 @@ $(function() { - $("#timeFrom").datepicker({ + $("#timeFromCal").datepicker({ orientation: 'top' }); - $("#timeTo").datepicker({ + $("#timeToCal").datepicker({ orientation: '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/geo_remote.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_remote.js index e7c9df3f16..05f78606c5 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_remote.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_remote.js @@ -185,6 +185,9 @@ function setSpeedAlert() { if (speedAlertValue == null || speedAlertValue === undefined || speedAlertValue == "") { var message = "Speed cannot be empty."; noty({text: message, type : 'error' }); + } else if (areaName.indexOf(" ") > -1) { + var message = "Area Name cannot contain spaces."; + noty({text: message, type : 'error' }); } else { data = { 'parseData': JSON.stringify({'speedAlertValue': speedAlertValue, 'deviceId': deviceId}), // parseKey : parseValue pair , this key pair is replace with the key in the template file @@ -235,6 +238,9 @@ function setWithinAlert(leafletId) { if (areaName == null || areaName === undefined || areaName == "") { var message = "Area Name cannot be empty."; noty({text: message, type : 'error' }); + } else if (areaName.indexOf(" ") > -1) { + var message = "Area Name cannot contain spaces."; + noty({text: message, type : 'error' }); } else { var data = { 'parseData': JSON.stringify({ @@ -288,6 +294,9 @@ function setExitAlert(leafletId) { if (areaName == null || areaName === undefined || areaName == "") { var message = "Area Name cannot be empty."; noty({text: message, type : 'error' }); + } else if (areaName.indexOf(" ") > -1) { + var message = "Area Name cannot contain spaces."; + noty({text: message, type : 'error' }); } else { var data = { 'parseData': JSON.stringify({ @@ -348,6 +357,9 @@ function setStationeryAlert(leafletId) { if (stationeryName == null || stationeryName === undefined || stationeryName == "") { var message = "Stationery Name cannot be empty."; noty({text: message, type : 'error' }); + } else if (stationeryName.indexOf(" ") > -1) { + var message = "Stationery Name cannot contain spaces."; + noty({text: message, type : 'error' }); } else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") { var message = "Fluctuation Radius cannot be empty."; noty({text: message, type : 'error' }); @@ -462,6 +474,9 @@ function setTrafficAlert(leafletId) { if (areaName == null || areaName === undefined || areaName == "") { var message = "Area Name cannot be empty."; noty({text: message, type : 'error' }); + } else if (areaName.indexOf(" ") > -1) { + var message = "Area Name cannot contain spaces."; + noty({text: message, type : 'error' }); } else { var data = { 'parseData': JSON.stringify({ From b5948b4e58c497e15345814c875d532e3659eb4f Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 25 Jul 2017 20:35:42 +0530 Subject: [PATCH 2/2] Fixing text fields alignments --- .../cdmf.unit.geo-dashboard/geo-dashboard.hbs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs index 9ebb1c1f27..48970a6fa3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/geo-dashboard.hbs @@ -530,11 +530,21 @@
-
- - - +
+
+ +
+ +
+
+
+ +
+ +
+
+