From c1de144bcf0fe0e52c2281d54396e64fbe2606d7 Mon Sep 17 00:00:00 2001 From: Dunith Dhanushka Date: Tue, 17 Jan 2017 11:04:19 +0530 Subject: [PATCH 1/2] Setting device id and type to page title --- .../geo-dashboard/js/app.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 825b523a39..5be8c75978 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 @@ -41,10 +41,24 @@ function initialLoad() { processAfterInitializationMap(); //Access gps and make zoom to server location as map center //navigator.geolocation.getCurrentPosition(success, error); + setPageTitle(); $("#loading").hide(); } } +function setPageTitle() { + var hash = window.parent.location.hash; + if(hash) { + var startIdx = hash.indexOf("/") + 1; + var lastIdx = hash.length; + var deviceInfoString = hash.substring(startIdx,lastIdx); + var deviceInfo = JSON.parse(deviceInfoString); + if(deviceInfo) { + var newTitle = " Geo Dashboard - Device ID: " + deviceInfo.device.id + " Type: " + deviceInfo.device.type; + window.parent.document.title = newTitle; + } + } +} //function success(position) { // var browserLatitude = position.coords.latitude; From c6437c3065d6970fd43a29e88fd14b2308546004 Mon Sep 17 00:00:00 2001 From: Dunith Dhanushka Date: Tue, 17 Jan 2017 11:14:58 +0530 Subject: [PATCH 2/2] Formatting the title --- .../carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5be8c75978..8eea24e5ad 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 @@ -54,7 +54,7 @@ function setPageTitle() { var deviceInfoString = hash.substring(startIdx,lastIdx); var deviceInfo = JSON.parse(deviceInfoString); if(deviceInfo) { - var newTitle = " Geo Dashboard - Device ID: " + deviceInfo.device.id + " Type: " + deviceInfo.device.type; + var newTitle = "[ " + deviceInfo.device.id + "]" + " - Geo Dashboard [" + deviceInfo.device.type + "]"; window.parent.document.title = newTitle; } }