Merge pull request #865 from rasika/geo-fence-issues

Fixing geo fencing issues
4.x.x
Madhawa Perera 7 years ago committed by GitHub
commit 5bc3a98b12

@ -79,7 +79,7 @@ deviceModule = function () {
var fromDate = new Date(); var fromDate = new Date();
fromDate.setHours(fromDate.getHours() - 2); fromDate.setHours(fromDate.getHours() - 2);
var toDate = new Date(); 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, serviceInvokers.XMLHttp.get(serviceUrl,
function (backendResponse) { function (backendResponse) {
if (backendResponse.status === 200 && backendResponse.responseText) { if (backendResponse.status === 200 && backendResponse.responseText) {

@ -530,11 +530,21 @@
</div> </div>
<div id="dateRangePopup"> <div id="dateRangePopup">
<div> <div class="form-horizontal">
<label> From: <input id="timeFrom" type="text"> </label> <div class="form-group">
<label> To: <input id="timeTo" type="text"> </label> <label class="col-sm-3">From:</label>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnHistorySpatialObject(document.getElementById('objectId').innerHTML, document.getElementById('timeFrom').value, document.getElementById('timeTo').value);return false;">Full History</button> <div class="col-sm-9">
<input id="timeFromCal" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3">To:</label>
<div class="col-sm-9">
<input id="timeToCal" type="text">
</div>
</div>
</div> </div>
<button type="button" class="btn btn-info btn-xs" onClick="focusOnHistorySpatialObject(document.getElementById('objectId').innerHTML, document.getElementById('timeFromCal').value, document.getElementById('timeToCal').value);return false;">Full History</button>
</div> </div>
<div id="markerPopupStop" class="popover top"> <div id="markerPopupStop" class="popover top">
@ -707,7 +717,7 @@
{{js "js/leaflet/Leaflet.fullscreen.min.js" }} {{js "js/leaflet/Leaflet.fullscreen.min.js" }}
{{js "js/leaflet/Marker.Rotate.js" }} {{js "js/leaflet/Marker.Rotate.js" }}
{{js "js/leaflet/leaflet.draw.js" }} {{js "js/leaflet/leaflet.draw.js" }}
{{js "js/jquery/jquery-ui.min.js" }} {{!js "js/jquery/jquery-ui.min.js" }}
<!-- Leaflet plugins libries --> <!-- Leaflet plugins libries -->
{{js "js/firstTemp.js" }} {{js "js/firstTemp.js" }}
@ -749,6 +759,10 @@
'Add Geofence Exit Alert', 'glyphicon glyphicon-log-out', geoToolsMenu); 'Add Geofence Exit Alert', 'glyphicon glyphicon-log-out', geoToolsMenu);
{{/if}} {{/if}}
} }
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('#dateRangePopup').dialog('close');
})
}); });
</script> </script>
{{/zone}} {{/zone}}

@ -254,7 +254,7 @@ function focusOnSpatialObject(objectId) {
// TODO: check the map._layersMaxZoom and set the zoom level accordingly // TODO: check the map._layersMaxZoom and set the zoom level accordingly
spatialObject.marker.openPopup(); 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(); spatialObject.drawPath();
if (speedGraphControl) { if (speedGraphControl) {
setTimeout(function () { setTimeout(function () {
@ -504,7 +504,7 @@ function focusOnHistorySpatialObject(objectId, timeFrom, timeTo) {
// TODO: check the map._layersMaxZoom and set the zoom level accordingly // TODO: check the map._layersMaxZoom and set the zoom level accordingly
spatialObject.marker.openPopup(); 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(); spatialObject.drawPath();
if (speedGraphControl) { if (speedGraphControl) {
setTimeout(function () { setTimeout(function () {

@ -1,8 +1,8 @@
$(function() { $(function() {
$("#timeFrom").datepicker({ $("#timeFromCal").datepicker({
orientation: 'top' orientation: 'top'
}); });
$("#timeTo").datepicker({ $("#timeToCal").datepicker({
orientation: 'top' orientation: 'top'
}); });
}); });

@ -185,6 +185,9 @@ function setSpeedAlert() {
if (speedAlertValue == null || speedAlertValue === undefined || speedAlertValue == "") { if (speedAlertValue == null || speedAlertValue === undefined || speedAlertValue == "") {
var message = "Speed cannot be empty."; var message = "Speed cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else { } else {
data = { data = {
'parseData': JSON.stringify({'speedAlertValue': speedAlertValue, 'deviceId': deviceId}), // parseKey : parseValue pair , this key pair is replace with the key in the template file '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 == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else { } else {
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
@ -288,6 +294,9 @@ function setExitAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else { } else {
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({
@ -348,6 +357,9 @@ function setStationeryAlert(leafletId) {
if (stationeryName == null || stationeryName === undefined || stationeryName == "") { if (stationeryName == null || stationeryName === undefined || stationeryName == "") {
var message = "Stationery Name cannot be empty."; var message = "Stationery Name cannot be empty.";
noty({text: message, type : 'error' }); 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 == "") { } else if (fluctuationRadius == null || fluctuationRadius === undefined || fluctuationRadius == "") {
var message = "Fluctuation Radius cannot be empty."; var message = "Fluctuation Radius cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type : 'error' });
@ -462,6 +474,9 @@ function setTrafficAlert(leafletId) {
if (areaName == null || areaName === undefined || areaName == "") { if (areaName == null || areaName === undefined || areaName == "") {
var message = "Area Name cannot be empty."; var message = "Area Name cannot be empty.";
noty({text: message, type : 'error' }); noty({text: message, type : 'error' });
} else if (areaName.indexOf(" ") > -1) {
var message = "Area Name cannot contain spaces.";
noty({text: message, type : 'error' });
} else { } else {
var data = { var data = {
'parseData': JSON.stringify({ 'parseData': JSON.stringify({

Loading…
Cancel
Save