From c2089bc5ddfed93bd9b0bd10cc670d3b39146705 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 2 Aug 2017 09:26:18 +0530 Subject: [PATCH 1/2] Fixes to the https://github.com/wso2/product-iots/issues/1251 --- .../Android-Sense-ExecutionPlan.siddhiql | 2 +- .../device-view.hbs | 38 +++++++++---------- .../device-view.js | 1 + 3 files changed, 19 insertions(+), 22 deletions(-) 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.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..e680bf678 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,48 @@ {{/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}}

    - Device location information is not available. + Device location information is not available. Please check whether Geo Location Based Services is Enabled.

    {{/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..4e0dbb689 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,7 @@ 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); return viewObject; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); From 8953cea830e609740dada79e4f6e98fd02d75e8f Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Wed, 2 Aug 2017 13:32:33 +0530 Subject: [PATCH 2/2] Fixes to the https://github.com/wso2/product-iots/issues/1251 --- .../device-view.hbs | 6 +++++- .../device-view.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) 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 e680bf678..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 @@ -67,7 +67,11 @@

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

    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 4e0dbb689..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 @@ -38,6 +38,7 @@ function onRequest(context) { 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!");