From 9535aa5cedf1bf4f74f86ddfc49535828242afcf Mon Sep 17 00:00:00 2001 From: Amanda <74random.amanda@gmail.com> Date: Fri, 18 Oct 2019 10:50:15 +0530 Subject: [PATCH 1/2] Show extensive device info --- .../device-view.hbs | 142 ++++++++++++++++++ .../device-view.js | 39 +++++ 2 files changed, 181 insertions(+) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index b191408c24..93d18ff95c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -97,6 +97,7 @@
  • Applications
  • Policy Compliance
  • +
  • Extensive Device Information
  • Remote Session
  • {{/zone}} @@ -143,6 +144,147 @@
    +
    +
    + {{#if device.deviceInfoAvailable}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + IMEI + + {{#if device.imei}}{{device.imei}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + IMSI + + {{#if device.imsi}}{{device.imsi}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Serial Number + + {{#if device.serial}}{{device.serial}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + MAC Address + + {{#if device.macAddress}}{{device.macAddress}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + OS Version + + {{#if device.OSVersion}}{{device.OSVersion}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + OS Build Date + + {{#if device.osBuildDate}}{{device.osBuildDate}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Vendor + + {{#if device.vendor}}{{device.vendor}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Model + + {{#if device.model}}{{device.model}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + CPU Usage + + {{#if device.cpuUsage}}{{device.cpuUsage.value}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + SSID + + {{#if device.ssid}}{{device.ssid}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Connection Type + + {{#if device.connectionType}}{{device.connectionType}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Operator + + {{#if device.operator}}{{device.operator}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + Phone Number + + {{#if device.phoneNumber}}{{device.phoneNumber}} + {{else}}

    This information is not available yet.

    + {{/if}} +
    + {{else}}

    Extensive information is not available yet.

    + {{/if}} +
    +
    +
    diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js index 7d4c02820e..ca5863059f 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js @@ -81,6 +81,30 @@ function onRequest(context) { if (filteredDeviceData["initialDeviceInfo"]["IMEI"]) { viewModel["imei"] = filteredDeviceData["initialDeviceInfo"]["IMEI"]; } + if (filteredDeviceData["initialDeviceInfo"]["IMSI"]) { + viewModel["imsi"] = filteredDeviceData["initialDeviceInfo"]["IMSI"]; + } + if (filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]) { + viewModel["OSVersion"] = filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]; + } + if (filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]) { + viewModel["OSVersion"] = filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]; + } + if (filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]) { + viewModel["model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]; + } + if (filteredDeviceData["initialDeviceInfo"]["VENDOR"]) { + viewModel["vendor"] = filteredDeviceData["initialDeviceInfo"]["VENDOR"]; + } + if (filteredDeviceData["initialDeviceInfo"]["SERIAL"]) { + viewModel["serial"] = filteredDeviceData["initialDeviceInfo"]["SERIAL"]; + } + if (filteredDeviceData["initialDeviceInfo"]["MAC_ADDRESS"]) { + viewModel["macAddress"] = filteredDeviceData["initialDeviceInfo"]["MAC_ADDRESS"]; + } + if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]) { + viewModel["osBuildDate"] = filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]; + } if (!filteredDeviceData["latestDeviceInfo"]) { if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]) { if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"] != "0") { @@ -109,6 +133,12 @@ function onRequest(context) { } else { viewModel["internalMemory"]["usage"] = 0; } + if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["OPERATOR"]) { + viewModel["operator"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["OPERATOR"]; + } + if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["PHONE_NUMBER"]) { + viewModel["phoneNumber"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["PHONE_NUMBER"]; + } viewModel["externalMemory"] = {}; viewModel["externalMemory"]["total"] = replaceNaNVal(Math. @@ -142,6 +172,15 @@ function onRequest(context) { viewModel["vendor"] = filteredDeviceData["latestDeviceInfo"]["vendor"]; viewModel["model"] = filteredDeviceData["latestDeviceInfo"]["deviceModel"]; } + if (filteredDeviceData["latestDeviceInfo"]["osVersion"]) { + viewModel["osVersion"] = filteredDeviceData["latestDeviceInfo"]["osVersion"]; + } + if (filteredDeviceData["latestDeviceInfo"]["connectionType"]) { + viewModel["connectionType"] = filteredDeviceData["latestDeviceInfo"]["connectionType"]; + } + if (filteredDeviceData["latestDeviceInfo"]["ssid"]) { + viewModel["ssid"] = filteredDeviceData["latestDeviceInfo"]["ssid"]; + } if (filteredDeviceData["latestDeviceInfo"]["updatedTime"]) { viewModel["lastUpdatedTime"] = filteredDeviceData["latestDeviceInfo"]["updatedTime"]. substr(0, filteredDeviceData["latestDeviceInfo"]["updatedTime"].indexOf("+")); From 269b11ed41d26302362412a6730be8e8c6c09b76 Mon Sep 17 00:00:00 2001 From: Amanda <74random.amanda@gmail.com> Date: Wed, 23 Oct 2019 10:59:45 +0530 Subject: [PATCH 2/2] Improve code --- .../device-view.hbs | 140 ++---------------- .../device-view.js | 31 ++-- 2 files changed, 26 insertions(+), 145 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index 93d18ff95c..f360de27b4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -149,136 +149,16 @@ {{#if device.deviceInfoAvailable}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {{#each device.extensiveDeviceInfo}} + + + + + {{/each}}
    - IMEI - - {{#if device.imei}}{{device.imei}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - IMSI - - {{#if device.imsi}}{{device.imsi}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Serial Number - - {{#if device.serial}}{{device.serial}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - MAC Address - - {{#if device.macAddress}}{{device.macAddress}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - OS Version - - {{#if device.OSVersion}}{{device.OSVersion}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - OS Build Date - - {{#if device.osBuildDate}}{{device.osBuildDate}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Vendor - - {{#if device.vendor}}{{device.vendor}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Model - - {{#if device.model}}{{device.model}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - CPU Usage - - {{#if device.cpuUsage}}{{device.cpuUsage.value}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - SSID - - {{#if device.ssid}}{{device.ssid}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Connection Type - - {{#if device.connectionType}}{{device.connectionType}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Operator - - {{#if device.operator}}{{device.operator}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    - Phone Number - - {{#if device.phoneNumber}}{{device.phoneNumber}} - {{else}}

    This information is not available yet.

    - {{/if}} -
    + {{@key}} + + {{this}} +
    {{else}}

    Extensive information is not available yet.

    {{/if}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js index ca5863059f..35ba3e8911 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js @@ -76,34 +76,33 @@ function onRequest(context) { viewModel["ownership"] = filteredDeviceData["enrolmentInfo"]["ownership"]; } } + var extensiveDeviceInfo = {}; if (filteredDeviceData["initialDeviceInfo"]) { viewModel["deviceInfoAvailable"] = true; if (filteredDeviceData["initialDeviceInfo"]["IMEI"]) { viewModel["imei"] = filteredDeviceData["initialDeviceInfo"]["IMEI"]; + extensiveDeviceInfo["IMEI"] = filteredDeviceData["initialDeviceInfo"]["IMEI"]; } if (filteredDeviceData["initialDeviceInfo"]["IMSI"]) { - viewModel["imsi"] = filteredDeviceData["initialDeviceInfo"]["IMSI"]; + extensiveDeviceInfo["IMSI"] = filteredDeviceData["initialDeviceInfo"]["IMSI"]; } if (filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]) { - viewModel["OSVersion"] = filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]; - } - if (filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]) { - viewModel["OSVersion"] = filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]; + extensiveDeviceInfo["OS Version"] = filteredDeviceData["initialDeviceInfo"]["OS_VERSION"]; } if (filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]) { - viewModel["model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]; + extensiveDeviceInfo["Model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"]; } if (filteredDeviceData["initialDeviceInfo"]["VENDOR"]) { - viewModel["vendor"] = filteredDeviceData["initialDeviceInfo"]["VENDOR"]; + extensiveDeviceInfo["Vendor"] = filteredDeviceData["initialDeviceInfo"]["VENDOR"]; } if (filteredDeviceData["initialDeviceInfo"]["SERIAL"]) { - viewModel["serial"] = filteredDeviceData["initialDeviceInfo"]["SERIAL"]; + extensiveDeviceInfo["Serial Number"] = filteredDeviceData["initialDeviceInfo"]["SERIAL"]; } if (filteredDeviceData["initialDeviceInfo"]["MAC_ADDRESS"]) { - viewModel["macAddress"] = filteredDeviceData["initialDeviceInfo"]["MAC_ADDRESS"]; + extensiveDeviceInfo["MAC Address"] = filteredDeviceData["initialDeviceInfo"]["MAC_ADDRESS"]; } if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]) { - viewModel["osBuildDate"] = filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]; + extensiveDeviceInfo["OS Build Date"] = filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]; } if (!filteredDeviceData["latestDeviceInfo"]) { if (filteredDeviceData["initialDeviceInfo"]["OS_BUILD_DATE"]) { @@ -134,10 +133,10 @@ function onRequest(context) { viewModel["internalMemory"]["usage"] = 0; } if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["OPERATOR"]) { - viewModel["operator"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["OPERATOR"]; + extensiveDeviceInfo["Operator"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["OPERATOR"]; } if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["PHONE_NUMBER"]) { - viewModel["phoneNumber"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["PHONE_NUMBER"]; + extensiveDeviceInfo["Phone Number"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["PHONE_NUMBER"]; } viewModel["externalMemory"] = {}; @@ -173,13 +172,13 @@ function onRequest(context) { viewModel["model"] = filteredDeviceData["latestDeviceInfo"]["deviceModel"]; } if (filteredDeviceData["latestDeviceInfo"]["osVersion"]) { - viewModel["osVersion"] = filteredDeviceData["latestDeviceInfo"]["osVersion"]; + extensiveDeviceInfo["OS Version"] = filteredDeviceData["latestDeviceInfo"]["osVersion"]; } if (filteredDeviceData["latestDeviceInfo"]["connectionType"]) { - viewModel["connectionType"] = filteredDeviceData["latestDeviceInfo"]["connectionType"]; + extensiveDeviceInfo["Connection Type"] = filteredDeviceData["latestDeviceInfo"]["connectionType"]; } if (filteredDeviceData["latestDeviceInfo"]["ssid"]) { - viewModel["ssid"] = filteredDeviceData["latestDeviceInfo"]["ssid"]; + extensiveDeviceInfo["SSID"] = filteredDeviceData["latestDeviceInfo"]["ssid"]; } if (filteredDeviceData["latestDeviceInfo"]["updatedTime"]) { viewModel["lastUpdatedTime"] = filteredDeviceData["latestDeviceInfo"]["updatedTime"]. @@ -190,6 +189,7 @@ function onRequest(context) { viewModel["cpuUsage"] = {}; viewModel["cpuUsage"]["value"] = filteredDeviceData["latestDeviceInfo"]["cpuUsage"]; + extensiveDeviceInfo["CPU Usage"] = filteredDeviceData["latestDeviceInfo"]["cpuUsage"]; viewModel["ramUsage"] = {}; if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) { @@ -222,6 +222,7 @@ function onRequest(context) { viewModel["externalMemory"]["usage"] = 0; } } + viewModel["extensiveDeviceInfo"] = extensiveDeviceInfo; if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) { viewModel["deviceInfoAvailable"] = false; }