From dd3017578a633acc4cf4a97ca25c23f76bb73425 Mon Sep 17 00:00:00 2001 From: ayyoob Date: Sun, 5 Feb 2017 17:52:52 +0530 Subject: [PATCH] added artefact deployment support for device types --- .../org.wso2.carbon.iot.das.rest.api/pom.xml | 72 ------------------- .../public/js/download.js | 29 ++++++++ .../type-view.hbs | 25 ++++++- .../type-view.js | 14 ++++ .../public/js/download.js | 29 ++++++++ .../type-view.hbs | 25 +++++++ .../type-view.js | 37 ++++++++++ .../public/js/download.js | 29 ++++++++ .../type-view.hbs | 25 +++++++ .../type-view.js | 37 ++++++++++ .../public/js/download.js | 29 ++++++++ .../type-view.hbs | 25 +++++++ .../type-view.js | 37 ++++++++++ .../public/js/type-view.js | 35 +++++++-- .../type-view.hbs | 25 +++++++ .../type-view.js | 15 ++++ .../pom.xml | 1 - .../src/main/resources/p2.inf | 9 ++- .../src/main/resources/p2.inf | 9 ++- .../pom.xml | 22 ++++++ .../src/main/resources/p2.inf | 5 +- .../src/main/resources/p2.inf | 5 +- .../src/main/resources/p2.inf | 5 +- .../src/main/resources/p2.inf | 5 +- .../pom.xml | 22 ++++++ .../src/main/resources/p2.inf | 8 ++- 26 files changed, 483 insertions(+), 96 deletions(-) delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.iot.das.rest.api/pom.xml create mode 100644 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.js create mode 100644 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/type-view.js create mode 100644 components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.js diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.das.rest.api/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.das.rest.api/pom.xml deleted file mode 100644 index 5deaf0ae2..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.das.rest.api/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - org.wso2.carbon.devicemgt-plugins - iot-analytics - 3.0.3-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.iot.das.rest.api - WSO2 Carbon - IoT Server REST API - pom - - - - - org.apache.felix - maven-scr-plugin - - - generate-scr-descriptor - - scr - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - ${project.artifactId} - - - - - - - * - - - - - - - \ 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.type-view/public/js/download.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.type-view/public/js/download.js index 50515c92f..fcb3c3754 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/public/js/download.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.type-view/public/js/download.js @@ -21,6 +21,8 @@ var modalPopupContainer = modalPopup + " .modal-content"; var modalPopupContent = modalPopup + " .modal-content"; var body = "body"; +var backendEndBasePath = "/api/device-mgt/v1.0"; + /* * set popup maximum height function. */ @@ -71,3 +73,30 @@ function attachEvents() { } } +function artifactUpload() { + var contentType = "application/json"; + + var urix = backendEndBasePath + "/admin/devicetype/deploy/android_sense"; + var defaultStatusClasses = "fw fw-stack-1x"; + var content = $("#androidsense-statistic-response-template").find(".content"); + var title = content.find("#title"); + var statusIcon = content.find("#status-icon"); + var data = {} + invokerUtil.post(urix, data, function (data) { + title.html("Deploying statistic artifacts. Please wait..."); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + $(modalPopupContent).html(content.html()); + showPopup(); + setTimeout(function () { + hidePopup(); + location.reload(true); + }, 5000); + + }, function (jqXHR) { + title.html("Failed to deploy artifacts, Please contact administrator."); + statusIcon.attr("class", defaultStatusClasses + " fw-error"); + $(modalPopupContent).html(content.html()); + showPopup(); + }, contentType); +} + 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 fdccd55d5..9c08451e9 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 @@ -41,7 +41,9 @@ Enroll Device Download APK Invite by Email - + {{#if displayStatus}} + Deploy Analytics Artifacts + {{/if}} @@ -240,7 +242,26 @@ {{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="androidSense"}} - + 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.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.type-view/type-view.js index 8c8260405..adb857567 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.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.type-view/type-view.js @@ -19,6 +19,20 @@ function onRequest(context){ var viewModel = {}; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; + var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/android_sense/status"; + serviceInvokers.XMLHttp.get( + url, function (responsePayload) { + var responseContent = responsePayload.status; + new Log().error(responseContent); + if ("204" == responsePayload.status) { + viewModel["displayStatus"] = "Display"; + } + }, + function (responsePayload) { + //do nothing. + } + ); viewModel["hostName"] = devicemgtProps["generalConfig"]["host"]; viewModel["enrollmentURL"] = viewModel["hostName"] + context.unit.publicUri + "/asset/androidsense.apk"; return viewModel; 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/public/js/download.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.type-view/public/js/download.js index 3b104cd53..26706014a 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/public/js/download.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.type-view/public/js/download.js @@ -21,6 +21,8 @@ var modalPopupContainer = modalPopup + " .modal-content"; var modalPopupContent = modalPopup + " .modal-content"; var body = "body"; +var backendEndBasePath = "/api/device-mgt/v1.0"; + /* * set popup maximum height function. */ @@ -181,4 +183,31 @@ function doAction(data) { hidePopup(); }); } +} + +function artifactUpload() { + var contentType = "application/json"; + + var urix = backendEndBasePath + "/admin/devicetype/deploy/arduino"; + var defaultStatusClasses = "fw fw-stack-1x"; + var content = $("#arduino-statistic-response-template").find(".content"); + var title = content.find("#title"); + var statusIcon = content.find("#status-icon"); + var data = {} + invokerUtil.post(urix, data, function (data) { + title.html("Deploying statistic artifacts. Please wait..."); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + $(modalPopupContent).html(content.html()); + showPopup(); + setTimeout(function () { + hidePopup(); + location.reload(true); + }, 5000); + + }, function (jqXHR) { + title.html("Failed to deploy artifacts, Please contact administrator."); + statusIcon.attr("class", defaultStatusClasses + " fw-error"); + $(modalPopupContent).html(content.html()); + showPopup(); + }, contentType); } \ 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.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 437d5400a..5aefca356 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 @@ -66,6 +66,10 @@ Download Sketch + {{#if displayStatus}} + Deploy Analytics Artifacts + {{/if}} + @@ -291,6 +295,27 @@ + + {{#zone "topCss"}} {{css "css/styles.css"}} {{/zone}} 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.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.type-view/type-view.js new file mode 100644 index 000000000..2800d8f23 --- /dev/null +++ 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.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function onRequest(context){ + var viewModel = {}; + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; + var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/arduino/status"; + serviceInvokers.XMLHttp.get( + url, function (responsePayload) { + var responseContent = responsePayload.status; + new Log().error(responseContent); + if ("204" == responsePayload.status) { + viewModel["displayStatus"] = "Display"; + } + }, + function (responsePayload) { + //do nothing. + } + ); + return viewModel; +} \ No newline at end of file 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 f6b9f1e64..abd0a49f5 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 @@ -21,6 +21,8 @@ var modalPopupContainer = modalPopup + " .modal-content"; var modalPopupContent = modalPopup + " .modal-content"; var body = "body"; +var backendEndBasePath = "/api/device-mgt/v1.0"; + /* * set popup maximum height function. */ @@ -180,4 +182,31 @@ function doAction(data) { hidePopup(); }); } +} + +function artifactUpload() { + var contentType = "application/json"; + + var urix = backendEndBasePath + "/admin/devicetype/deploy/raspberrypi"; + var defaultStatusClasses = "fw fw-stack-1x"; + var content = $("#raspberrypi-statistic-response-template").find(".content"); + var title = content.find("#title"); + var statusIcon = content.find("#status-icon"); + var data = {} + invokerUtil.post(urix, data, function (data) { + title.html("Deploying statistic artifacts. Please wait..."); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + $(modalPopupContent).html(content.html()); + showPopup(); + setTimeout(function () { + hidePopup(); + location.reload(true); + }, 5000); + + }, function (jqXHR) { + title.html("Failed to deploy artifacts, Please contact administrator."); + statusIcon.attr("class", defaultStatusClasses + " fw-error"); + $(modalPopupContent).html(content.html()); + showPopup(); + }, contentType); } \ No newline at end of file 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/type-view.hbs 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/type-view.hbs index 8b645b36a..000e232a4 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/type-view.hbs +++ 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/type-view.hbs @@ -61,6 +61,10 @@ Download Agent + {{#if displayStatus}} + Deploy Analytics Artifacts + {{/if}} + @@ -275,6 +279,27 @@ + + {{#zone "topCss"}} {{css "css/styles.css"}} {{/zone}} 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/type-view.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/type-view.js new file mode 100644 index 000000000..ef40e6ebe --- /dev/null +++ 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/type-view.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function onRequest(context){ + var viewModel = {}; + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; + var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/raspberrypi/status"; + serviceInvokers.XMLHttp.get( + url, function (responsePayload) { + var responseContent = responsePayload.status; + new Log().error(responseContent); + if ("204" == responsePayload.status) { + viewModel["displayStatus"] = "Display"; + } + }, + function (responsePayload) { + //do nothing. + } + ); + return viewModel; +} \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/public/js/download.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/public/js/download.js index 991796825..a667ef4cc 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/public/js/download.js +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/public/js/download.js @@ -21,6 +21,8 @@ var modalPopupContainer = modalPopup + " .modal-content"; var modalPopupContent = modalPopup + " .modal-content"; var body = "body"; +var backendEndBasePath = "/api/device-mgt/v1.0"; + /* * Set popup maximum height function. */ @@ -132,4 +134,31 @@ function doAction(data) { hideAgentDownloadPopup(); }); } +} + +function artifactUpload() { + var contentType = "application/json"; + + var urix = backendEndBasePath + "/admin/devicetype/deploy/virtual_firealarm"; + var defaultStatusClasses = "fw fw-stack-1x"; + var content = $("#virtualfirealarm-statistic-response-template").find(".content"); + var title = content.find("#title"); + var statusIcon = content.find("#status-icon"); + var data = {} + invokerUtil.post(urix, data, function (data) { + title.html("Deploying statistic artifacts. Please wait..."); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + $(modalPopupContent).html(content.html()); + showPopup(); + setTimeout(function () { + hidePopup(); + location.reload(true); + }, 5000); + + }, function (jqXHR) { + title.html("Failed to deploy artifacts, Please contact administrator."); + statusIcon.attr("class", defaultStatusClasses + " fw-error"); + $(modalPopupContent).html(content.html()); + showPopup(); + }, contentType); } \ No newline at end of file diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.hbs b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.hbs index c37a9b9c0..922ace659 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.hbs +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.hbs @@ -54,6 +54,10 @@ Download Agent + {{#if displayStatus}} + Deploy Analytics Artifacts + {{/if}} + @@ -260,6 +264,27 @@ + + {{#zone "topCss"}} {{css "css/styles.css"}} {{/zone}} diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.js new file mode 100644 index 000000000..ea24f499c --- /dev/null +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.type-view/type-view.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function onRequest(context){ + var viewModel = {}; + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; + var url = devicemgtProps["httpsURL"] + "/api/device-mgt/v1.0/admin/devicetype/deploy/virtual_firealarm/status"; + serviceInvokers.XMLHttp.get( + url, function (responsePayload) { + var responseContent = responsePayload.status; + new Log().error(responseContent); + if ("204" == responsePayload.status) { + viewModel["displayStatus"] = "Display"; + } + }, + function (responsePayload) { + //do nothing. + } + ); + return viewModel; +} \ No newline at end of file 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.type-view/public/js/type-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.type-view/public/js/type-view.js index 7d9c77921..e6a79d11b 100755 --- 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.type-view/public/js/type-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.type-view/public/js/type-view.js @@ -20,7 +20,7 @@ var modalPopup = ".modal", modalPopupContainer = modalPopup + " .modal-content", modalPopupContent = modalPopup + " .modal-content"; -var emmAdminBasePath = "/api/device-mgt/v1.0"; +var backendEndBasePath = "/api/device-mgt/v1.0"; //function openCollapsedNav() { // $(".wr-hidden-nav-toggle-btn").addClass("active"); @@ -102,7 +102,7 @@ function loadNewNotificationsOnSideViewPanel() { if ($("#right-sidebar").attr("is-authorized") == "false") { $("#notification-bubble-wrapper").remove(); } else { - var serviceURL = emmAdminBasePath + "/notifications?status=NEW"; + var serviceURL = backendEndBasePath + "/notifications?status=NEW"; invokerUtil.get(serviceURL, updateNotificationCountOnSuccess, updateNotificationCountOnError); loadNewNotifications(); } @@ -117,7 +117,7 @@ function loadNewNotifications() { var currentUser = notifications.data("currentUser"); $.template("notification-listing", notifications.attr("src"), function (template) { - var serviceURL = emmAdminBasePath + "/notifications?offset=0&limit=5&status=NEW"; + var serviceURL = backendEndBasePath + "/notifications?offset=0&limit=5&status=NEW"; invokerUtil.get( serviceURL, // on success @@ -359,7 +359,7 @@ $(document).ready(function () { $("#right-sidebar").on("click", ".new-notification", function () { var notificationId = $(this).data("id"); var redirectUrl = $(this).data("url"); - var markAsReadNotificationsEpr = emmAdminBasePath + "/notifications/" + notificationId + "/mark-checked"; + var markAsReadNotificationsEpr = backendEndBasePath + "/notifications/" + notificationId + "/mark-checked"; var messageSideBar = ".sidebar-messages"; invokerUtil.put( @@ -382,3 +382,30 @@ $(document).ready(function () { ); }); }); + +function artifactUpload() { + var contentType = "application/json"; + + var urix = backendEndBasePath + "/admin/devicetype/deploy/android"; + var defaultStatusClasses = "fw fw-stack-1x"; + var content = $("#android-statistic-response-template").find(".content"); + var title = content.find("#title"); + var statusIcon = content.find("#status-icon"); + var data = {} + invokerUtil.post(urix, data, function (data) { + title.html("Deploying statistic artifacts. Please wait..."); + statusIcon.attr("class", defaultStatusClasses + " fw-check"); + $(modalPopupContent).html(content.html()); + showPopup(); + setTimeout(function () { + hidePopup(); + location.reload(true); + }, 5000); + + }, function (jqXHR) { + title.html("Failed to deploy artifacts, Please contact administrator."); + statusIcon.attr("class", defaultStatusClasses + " fw-error"); + $(modalPopupContent).html(content.html()); + showPopup(); + }, contentType); +} \ No newline at end of file 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.type-view/type-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.type-view/type-view.hbs index a5a93a803..a0c4e15a9 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.type-view/type-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.type-view/type-view.hbs @@ -20,6 +20,9 @@ Enroll Device Download APK Invite by Email + {{#if displayStatus}} + Deploy Analytics Artifacts + {{/if}} @@ -41,6 +44,28 @@ + + +

Prepare