diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/view_fence_popup.html b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/view_fence_popup.html index 60eefbe9ab..671ae1bb3f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/view_fence_popup.html +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/assets/html_templates/view_fence_popup.html @@ -21,32 +21,29 @@
+

-
-
Query nameN/A
-
Area nameN/A
- + +
+

-
-
Query nameN/A
-
Area nameN/A
- + +
+

-
-
Query nameN/A
-
Stationery nameN/A
+
Stationery time(Seconds)N/A
- +
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 7be0b9c2b4..c1c0d50553 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 @@ -554,4 +554,15 @@ function createGeoToolListItem(link, text, icon, menuRoot) { anchor.attr('data-target', '#commonModal'); $("", {class: icon}).prependTo(anchor); return listItem; +} + +function formatDate(date) { + var hours = date.getHours(); + var minutes = date.getMinutes(); + var ampm = hours >= 12 ? 'pm' : 'am'; + hours = hours % 12; + hours = hours ? hours : 12; // the hour '0' should be '12' + minutes = minutes < 10 ? '0'+minutes : minutes; + var strTime = hours + ':' + minutes + ' ' + ampm; + return date.getDate() + "/" + date.getMonth()+1 + "/" + date.getFullYear() + " " + strTime; } \ 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_exit_fence.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_exit_fence.js index 9f257c0cfd..cdcfb41568 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_exit_fence.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_exit_fence.js @@ -28,7 +28,7 @@ function initializeExit() { $("#exit-alert > tbody").append( "" + alertBean.areaName + "" + - "" + alertBean.queryName + "" + alertBean.createdTime + "" + + "" + alertBean.queryName + "" + formatDate(new Date(alertBean.createdTime)) + "" + ""); } 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 4c876ae7c9..6aaac5dc09 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 @@ -312,7 +312,7 @@ function exportToGeoJSON(element, content) { // HTML5 features has been used here var geoJsonData = 'data:application/json;charset=utf-8,' + encodeURIComponent(content); // TODO: replace closest() by using persistence id for templates, template id prefixed by unique id(i.e leaflet_id) - var fileName = $(element).closest('form').find('#areaName').val() || 'geoJson'; + var fileName = $(element).closest('form').attr('area-name') || 'geoJson'; var link = document.createElement("a"); link.download = fileName + '.json'; // Use the fence name given by the user as the file name of the JSON file; link.href = geoJsonData; @@ -393,7 +393,8 @@ function viewFence(geoFenceElement,id) { popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#viewAreaName').html(areaName); - popupTemplate.find('#viewQueryName').html(queryName); + popupTemplate.find('#stationaryAlertForm').attr('area-name', areaName); + popupTemplate.find('#stationaryAlertForm').attr('query-name', queryName); popupTemplate.find('#viewAreaTime').html(stationeryTime); geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); // transparent the layer .leaflet-popup-content-wrapper @@ -407,7 +408,8 @@ function viewFence(geoFenceElement,id) { popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#viewAreaName').html(areaName); - popupTemplate.find('#viewQueryName').html(queryName); + popupTemplate.find('#withinAlertForm').attr('area-name', areaName); + popupTemplate.find('#withinAlertForm').attr('query-name', queryName); geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); // transparent the layer .leaflet-popup-content-wrapper $(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)"); @@ -419,7 +421,8 @@ function viewFence(geoFenceElement,id) { popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); popupTemplate.find('#viewAreaName').html(areaName); - popupTemplate.find('#viewQueryName').html(queryName); + popupTemplate.find('#exitAlertForm').attr('area-name', areaName); + popupTemplate.find('#exitAlertForm').attr('query-name', queryName); geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); // transparent the layer .leaflet-popup-content-wrapper $(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)"); 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 2c8271a880..6eee4234ab 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 @@ -32,7 +32,7 @@ function initStationaryAlert() { "'data-fluctuationRadius='" + alert.fluctuationRadius + "'data-areaName='" + alert.areaName + "'data-queryName='" + alert.queryName + "'data-geoJson=" + alert.geoJson + ">" + "" + alert.areaName + "" + alert.stationaryTime + "" + alert.fluctuationRadius + - "" + alert.queryName + "" + alert.createdTime + "" + alert.queryName + "" + formatDate(new Date(alert.createdTime)) + "") } 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_within.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_within.js index e6637d1fd7..f4986075f5 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_within.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_within.js @@ -28,7 +28,7 @@ function initializeWithin() { $("#within-alert > tbody").append( "" + alertBean.areaName + "" + - "" + alertBean.queryName + "" + alertBean.createdTime + "" + + "" + alertBean.queryName + "" + formatDate(new Date(alertBean.createdTime)) + "" + ""); }