diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index e2cc9978a..638cb178d 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 5cf2bddd6..887a3da34 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index a603f580e..c1aa7e8f7 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 398e472bd..b6c7df490 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index 76e0c3a9d..a984763cd 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index 4feed0221..0a8c6ac3b 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 7d3bf7d34..24efa6c42 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql index 3cdb2caf6..5eaa1a492 100755 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_android_sense_executionplan/Android-Sense-ExecutionPlan.siddhiql @@ -153,5 +153,5 @@ select meta_owner, meta_deviceId, meta_timestamp, data_type as type, data_receiv insert into DataStream; from AndroidSense[meta_type == 'gps'] -select meta_deviceId ,meta_type as meta_deviceType, meta_timestamp as timeStamp, gps_lat as latitude, gps_long as longitude +select meta_deviceId ,'android_sense' as meta_deviceType, meta_timestamp as timeStamp, gps_lat as latitude, gps_long as longitude insert into geoLocationStream; \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 767c8bc43..3fbe5bae5 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index ff72357d0..3a49e3254 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs index f77a46de6..892d51803 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.hbs @@ -31,52 +31,52 @@ {{/zone}} {{#zone "device-details"}} + {{/zone}} {{#zone "device-view-tabs"}}
  • Device - Statistics + Statistics
  • -
  • Device Location
  • +
  • Device Location
  • {{/zone}} {{#zone "device-view-tab-contents"}}
    -
    Device Statistics
    {{unit "cdmf.unit.device.type.android_sense.realtime.analytics-view" device=device}}
    -
    Device Location
    -
    - {{unit "cdmf.unit.geo-dashboard" device=device}} - {{#if locationHistory}} -
    + {{#if locationEnabled}} +
    +
    +
    +
    +
    +
    + {{unit "cdmf.unit.geo-dashboard" device=device noGeoFencing=false hideSearch=true}}
    -
    - - - - - Add Geo Fencing - {{else}}

    + {{#if geoServicesEnabled}} Device location information is not available. + {{else}} + Geo Location Based Services is not enabled. + {{/if}}

    {{/if}} -
    -
    {{/zone}} \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js index a1a4d3aab..438936c90 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view/device-view.js @@ -37,6 +37,8 @@ function onRequest(context) { viewObject.portalUrl = devicemgtProps['portalURL']; viewObject.anchor = encodeURI(JSON.stringify(anchor)); viewObject.locationHistory = stringify(device.content.locationHistory); + viewObject.locationEnabled = (device.content.locationHistory.length !== 0); + viewObject.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled; return viewObject; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js index b9deeab14..8a0b02bc7 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.js @@ -20,29 +20,43 @@ function onRequest(context) { var log = new Log("stats.js"); var carbonServer = require("carbon").server; var device = context.unit.params.device; + // graph configuration var graphData = { Sensors:["accelerometer","magnetic", "gravity", "pressure", "proximity", "gyroscope"], Realtime_Data:['battery','light','rotation'] - }; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var constants = require("/app/modules/constants.js"); + var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; var websocketEndpoint = devicemgtProps["wssURL"].replace("https", "wss"); var jwtService = carbonServer.osgiService( 'org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService'); var jwtClient = jwtService.getJWTClient(); var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]); var token = ""; + var tokenPair = null; + var user = userModule.getCarbonUser(); + var tenantDomain = user.domain; if (encodedClientKeys) { var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var resp = tokenUtil.decode(encodedClientKeys).split(":"); - var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {}); - if (tokenPair) { - token = tokenPair.accessToken; + if (tenantDomain == "carbon.super") { + tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username,"default", {}); + if (tokenPair) { + token = tokenPair.accessToken; + } + websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.android.sense/1.0.0?" + + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; + } else { + tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + tenantDomain,"default", {}); + if (tokenPair) { + token = tokenPair.accessToken; + } + websocketEndpoint = websocketEndpoint + "/secured-websocket/t/"+tenantDomain+"/org.wso2.iot.android.sense/1.0.0?" + + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } - websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.android.sense/1.0.0?" + - "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; + } return {"device": device, "websocketEndpoint": websocketEndpoint, "graphData":graphData}; } \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js index 4b92faf6c..dc9a16476 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js @@ -158,6 +158,15 @@ function threeDlineGraph(type, xChartData, yChartData, zChartData) { graph: graph }); + new Rickshaw.Graph.HoverDetail({ + graph: graph, + formatter: function (series, x, y) { + var date = '' + moment(x * 1000).format('Do MMM YYYY h:mm:ss a') + ''; + var swatch = ''; + return swatch + series.name + ": " + parseInt(y) + '
    ' + date; + } + }); + graph.render(); return graph; @@ -234,58 +243,61 @@ function connect(target) { if (ws) { ws.onmessage = function (event) { var dataPoint = JSON.parse(event.data); - if (dataPoint) { var time = parseInt(dataPoint[4]) / 1000; switch (dataPoint[typeId]) { case "battery": - graphUpdate(batteryData, time, dataPoint[batteryId], graphMap["battery"]); + graphUpdate(batteryData, time, dataPoint[batteryId]); + graphMap["battery"].update(); break; case "light": - graphUpdate(lightData, time, dataPoint[lightId], graphMap["light"]); + graphUpdate(lightData, time, dataPoint[lightId]); + graphMap["light"].update(); break; case "pressure": - graphUpdate(pressureData, time, dataPoint[pressureId], graphMap["pressure"]); + graphUpdate(pressureData, time, dataPoint[pressureId]); + graphMap["pressure"].update(); break; case "proximity": - graphUpdate(proximityData, time, dataPoint[proximityId], graphMap["proximity"]); + graphUpdate(proximityData, time, dataPoint[proximityId]); + graphMap["proximity"].update(); break; case "accelerometer": - dataUpdate(accelerometer_xData, time, dataPoint[accelerometer_xId]); - dataUpdate(accelerometer_yData, time, dataPoint[accelerometer_yId]); - dataUpdate(accelerometer_zData, time, dataPoint[accelerometer_zId]); + graphUpdate(accelerometer_xData, time, dataPoint[accelerometer_xId]); + graphUpdate(accelerometer_yData, time, dataPoint[accelerometer_yId]); + graphUpdate(accelerometer_zData, time, dataPoint[accelerometer_zId]); graphMap["accelerometer"].update(); break; case "magnetic": - dataUpdate(magnetic_xData, time, dataPoint[magnetic_xId]); - dataUpdate(magnetic_yData, time, dataPoint[magnetic_yId]); - dataUpdate(magnetic_zData, time, dataPoint[magnetic_zId]); + graphUpdate(magnetic_xData, time, dataPoint[magnetic_xId]); + graphUpdate(magnetic_yData, time, dataPoint[magnetic_yId]); + graphUpdate(magnetic_zData, time, dataPoint[magnetic_zId]); graphMap["magnetic"].update(); break; case "gyroscope": - dataUpdate(gyroscope_xData, time, dataPoint[gyroscope_xId]); - dataUpdate(gyroscope_yData, time, dataPoint[gyroscope_yId]); - dataUpdate(gyroscope_zData, time, dataPoint[gyroscope_zId]); + graphUpdate(gyroscope_xData, time, dataPoint[gyroscope_xId]); + graphUpdate(gyroscope_yData, time, dataPoint[gyroscope_yId]); + graphUpdate(gyroscope_zData, time, dataPoint[gyroscope_zId]); graphMap["gyroscope"].update(); break; case "rotation": - dataUpdate(magnetic_xData, time, dataPoint[rotation_xId]); - dataUpdate(magnetic_yData, time, dataPoint[rotation_yId]); - dataUpdate(magnetic_zData, time, dataPoint[rotation_zId]); + graphUpdate(magnetic_xData, time, dataPoint[rotation_xId]); + graphUpdate(magnetic_yData, time, dataPoint[rotation_yId]); + graphUpdate(magnetic_zData, time, dataPoint[rotation_zId]); graphMap["rotation"].update(); break; case "gravity": - dataUpdate(gravity_xData, time, dataPoint[gravity_xId]); - dataUpdate(gravity_yData, time, dataPoint[gravity_yId]); - dataUpdate(gravity_zData, time, dataPoint[gravity_zId]); + graphUpdate(gravity_xData, time, dataPoint[gravity_xId]); + graphUpdate(gravity_yData, time, dataPoint[gravity_yId]); + graphUpdate(gravity_zData, time, dataPoint[gravity_zId]); graphMap["gravity"].update(); break; } @@ -294,16 +306,7 @@ function connect(target) { } } -function graphUpdate(chartData, xValue, yValue, graph) { - chartData.push({ - x: parseInt(xValue), - y: parseFloat(yValue) - }); - chartData.shift(); - graph.update(); -} - -function dataUpdate(chartData, xValue, yValue) { +function graphUpdate(chartData, xValue, yValue) { chartData.push({ x: parseInt(xValue), y: parseFloat(yValue) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs index 3d1fdf997..9a4424661 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/type-view.hbs @@ -17,7 +17,7 @@ }} {{unit "cdmf.unit.device.type.qr-modal" enrollmentURL=enrollmentURL deviceTypeName="Android"}} -{{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="androidsense"}} +{{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="android_sense"}}

    Android Sense

    @@ -41,7 +41,7 @@ Enroll Device Download APK Invite by Email - diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index c4f415e80..c5513732f 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index e2be2525a..e20e8ba89 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index 386c57a16..fd8d4669c 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index aa55b9d6c..c2841fab9 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.js b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.js index 3362ffbd0..1e722f5fa 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.js +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/analytics-view.js @@ -28,6 +28,7 @@ function onRequest(context) { var jwtClient = jwtService.getJWTClient(); var encodedClientKeys = session.get(constants["ENCODED_TENANT_BASED_WEB_SOCKET_CLIENT_CREDENTIALS"]); var token = ""; + var user = session.get(constants.USER_SESSION_KEY); if (encodedClientKeys) { var tokenUtil = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var resp = tokenUtil.decode(encodedClientKeys).split(":"); @@ -50,4 +51,4 @@ function onRequest(context) { } } return {"device": device, "websocketEndpoint": websocketEndpoint}; -} \ No newline at end of file +} diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js index c7a08f93b..1489e9cd8 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.realtime.analytics-view/public/js/device-stats.js @@ -73,9 +73,9 @@ $(window).load(function () { connect(websocketUrl) }); -$(window).unload(function () { +window.onbeforeunload = function() { disconnect(); -}); +}; //websocket connection function connect(target) { diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view/type-view.hbs b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view/type-view.hbs index 48a78c314..007d56a68 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view/type-view.hbs +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view/type-view.hbs @@ -64,7 +64,7 @@ Download Sketch -
    diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 3dcd1c4b3..eb7b4d0f7 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index c515bcbe2..1a1c24376 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index e00169140..3b93670f9 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index 0e9d78d01..7fd2532bc 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index c92fa80f4..77bbf340a 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.0.40-SNAPSHOT + 4.0.64-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.type-view/public/js/download.js b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.type-view/public/js/download.js index aced9b532..3b2a740bb 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.type-view/public/js/download.js +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.type-view/public/js/download.js @@ -84,8 +84,8 @@ function attachEvents() { * on Device Management page in WSO2 DC Console. */ $("a.download-link").click(function () { - var sketchType = $(this).data("sketchtype"); - var deviceType = $(this).data("devicetype"); + var sketchType = $(".deviceType").val(); + var deviceType = $(".sketchType").val(); var downloadDeviceAPI = "/devicemgt/api/devices/sketch/generate_link"; var payload = {"sketchType": sketchType, "deviceType": deviceType}; $(modalPopupContent).html($('#download-device-modal-content').html()); @@ -100,16 +100,24 @@ function attachEvents() { $('label[for=deviceName]').remove(); if (deviceName && deviceName.length >= 4) { payload.deviceName = deviceName; - invokerUtil.post( - downloadDeviceAPI, - payload, - function (data, textStatus, jqxhr) { - doAction(data); - }, - function (data) { - doAction(data); + var request = { + url: downloadDeviceAPI, + type: "POST", + contentType: "application/json", + data: JSON.stringify(payload), + accept: "application/json", + async : true, + success: doAction, + error: function (jqXHR) { + if (jqXHR.status == 401) { + $(modalPopupContent).html($("#error-msg").html()); + showPopup(); + } else { + doAction(jqXHR); + } } - ); + }; + $.ajax(request); }else if(deviceName){ $('.controls').append('
    @@ -112,6 +112,15 @@
    +