From 3d504afa3561c76b10c78991f3f204b3fec0ab7a Mon Sep 17 00:00:00 2001 From: sinthuja Date: Thu, 15 Dec 2016 16:12:02 +0530 Subject: [PATCH] Fixing issues in the full history view in geo fence. --- .../controllers/gadget-controller.jag | 2 -- .../geo-dashboard/js/app.js | 4 +--- .../geo-dashboard/js/websocket.js | 20 ++++++++++--------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/controllers/gadget-controller.jag b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/controllers/gadget-controller.jag index ea1f3c294d..25d50b9c0c 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/controllers/gadget-controller.jag +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/controllers/gadget-controller.jag @@ -25,14 +25,12 @@ var type = request.getParameter("type"); var timeFrom = request.getParameter("timeFrom"); var timeTo = request.getParameter("timeTo"); - var log = new Log(); var providerAPI = require('js/batch-provider-api.js'); if (action === 'getSchema') { print(providerAPI.getSchema()); return; } else if(action === 'getData'){ - log.info('FromTime : '+timeFrom+', toTime: '+ timeTo); print(providerAPI.getData(id, type, timeFrom, timeTo)); return; } diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js index 7a3ca3f098..9ea1b8d4e2 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js @@ -82,7 +82,7 @@ function initializeMap() { map = L.map("map", { zoom: 14, - center: [51.548525, 0.111749], + center: [6.927078, 79.861243], layers: [defaultOSM, defaultTFL], zoomControl: false, attributionControl: false, @@ -120,8 +120,6 @@ function initializeMap() { } }); - - } /* Attribution control */ diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js index 86600955ba..30fcb20d4e 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js @@ -73,8 +73,8 @@ function SpatialObject(json) { return this; } -function popupDateRange(){ - $('#dateRangePopup').attr('title', 'Device ID - '+ deviceId +" Device Type - "+ deviceType).dialog(); +function popupDateRange() { + $('#dateRangePopup').attr('title', 'Device ID - ' + deviceId + " Device Type - " + deviceType).dialog(); } SpatialObject.prototype.update = function (geoJSON) { @@ -166,13 +166,16 @@ function angleToHeading(angle) { SpatialObject.prototype.removeFromMap = function () { this.removePath(); this.marker.closePopup(); + map.removeLayer(this.marker); }; function clearMap() { - for (var i=0; i< currentSpatialObjects.length; i++ ){ - console.log("removed - " + currentSpatialObjects[i]); - currentSpatialObjects[i].removeFromMap(); + for (var spacialObject in currentSpatialObjects) { + console.log(spacialObject); + currentSpatialObjects[spacialObject].removePath(); + currentSpatialObjects[spacialObject].removeFromMap(); } + currentSpatialObjects = {}; } SpatialObject.prototype.createLineStringFeature = function (state, information, coordinates) { @@ -608,7 +611,7 @@ var webSocketOnOpen = function () { }; var webSocketOnMessage = function (message) { - if(!isBatchModeOn) { + if (!isBatchModeOn) { var json = $.parseJSON(message.data); if (json.messageType == "Point") { processPointMessage(json); @@ -683,7 +686,7 @@ function initializeOnAlertWebSocket() { function intializeWebsocketUrls() { var username; - wso2.gadgets.state.getGlobalState(function(state) { + wso2.gadgets.state.getGlobalState(function (state) { deviceId = state.device.id; deviceType = state.device.type; if (deviceId && deviceType) { @@ -702,7 +705,7 @@ function intializeWebsocketUrls() { ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance .CEP_ON_ALERT_WEB_SOCKET_OUTPUT_ADAPTOR_NAME + ApplicationOptions.constance.PATH_SEPARATOR + ApplicationOptions.constance.VERSION + "?deviceId=" + deviceId + "&deviceType=" + deviceType; - document.cookie = "websocket-token=f98d6142-e988-3c7f-a8c9-7e6d74da7113; path=/"; + document.cookie = "websocket-token=619e6170-10e8-31f0-904b-b7770d53e545; path=/"; $("#proximity_alert").hide(); initializeWebSocket(); initializeOnAlertWebSocket(); @@ -720,7 +723,6 @@ function intializeWebsocketUrls() { } - intializeWebsocketUrls();