revert-dabc3590
ayyoob 9 years ago
commit 5f43cc47e8

@ -56,14 +56,6 @@ function showPopup() {
deviceType = this.value; deviceType = this.value;
} }
}); });
if (deviceType == 'virtual_firealarm') {
$('.sketchType').remove();
$('input[name="sketchType"][value="virtual_firealarm"]').prop('checked', true);
$("label[for='virtual_firealarm']").text("Simple Agent");
$("label[for='virtual_firealarm_advanced']").text("Advanced Agent");
} else {
$('.sketchTypes').remove();
}
} }
/* /*
@ -90,10 +82,6 @@ function attachEvents() {
* on Device Management page in WSO2 DC Console. * on Device Management page in WSO2 DC Console.
*/ */
$("a.download-link").click(function () { $("a.download-link").click(function () {
var sketchType = $(this).data("sketchtype");
var deviceType = $(this).data("devicetype");
var downloadDeviceAPI = "/devicemgt/api/devices/sketch/generate_link";
var payload = {"sketchType": sketchType, "deviceType": deviceType};
$(modalPopupContent).html($('#download-device-modal-content').html()); $(modalPopupContent).html($('#download-device-modal-content').html());
showPopup(); showPopup();
var deviceName; var deviceName;
@ -104,29 +92,6 @@ function attachEvents() {
} }
}); });
$('label[for=deviceName]').remove(); $('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);
}
);
} else if (deviceName) {
$('.controls').append('<label for="deviceName" generated="true" class="error" ' +
'style="display: inline-block;">Please enter at least 4' +
' characters.</label>');
$('.control-group').removeClass('success').addClass('error');
} else {
$('.controls').append('<label for="deviceName" generated="true" class="error" ' +
'style="display: inline-block;">This field is required.' +
'</label>');
$('.control-group').removeClass('success').addClass('error');
}
}); });
$("a#download-device-cancel-link").click(function () { $("a#download-device-cancel-link").click(function () {
@ -135,46 +100,3 @@ function attachEvents() {
}); });
} }
//Device owner removed.
function downloadAgent() {
$('#downloadForm').submit();
hidePopup();
$(modalPopupContent).html($('#device-agent-downloading-content').html());
showPopup();
setTimeout(function () {
hidePopup();
}, 1000);
}
function doAction(data) {
//if it is saml redirection response
if (data.status == null) {
document.write(data);
}
if (data.status == "200") {
$(modalPopupContent).html($('#download-device-modal-content-links').html());
$("input#download-device-url").val(data.responseText);
$("input#download-device-url").focus(function () {
$(this).select();
});
showPopup();
} else if (data.status == "401") {
$(modalPopupContent).html($('#device-401-content').html());
$("#device-401-link").click(function () {
window.location = "/devicemgt/login";
});
showPopup();
} else if (data == "403") {
$(modalPopupContent).html($('#device-403-content').html());
$("#device-403-link").click(function () {
window.location = "/devicemgt/login";
});
showPopup();
} else {
$(modalPopupContent).html($('#device-unexpected-error-content').html());
$("a#device-unexpected-error-link").click(function () {
hidePopup();
});
}
}

@ -1,231 +1,68 @@
<div class="col-lg-12 margin-top-double"> <div class="col-lg-12 margin-top-double">
<h1 class="grey ">Android Sense</h1> <h1 class="grey ">Android Mobile</h1>
<hr> <hr>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 padding-top"> <div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 padding-top">
<img src="{{@unit.publicUri}}/images/android-sense-icon.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/android-icon.png" class="img-responsive">
</div> </div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top"> <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Android+Sense" <h4 class="doc-link">Click <a href="https://docs.wso2.com/display/IoTS100/Android"
target="_blank">[ here ]</a> for latest instructions and target="_blank">[ here ]</a> for latest instructions and troubleshooting.</h4>
troubleshooting.</h4>
</div> </div>
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top"> <div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
<h3 class="uppercase">What it Does</h3> <h3 class="uppercase">What it Does</h3>
<hr> <hr>
<p class="grey margin-top">Connect an Android device to WSO2 IoT Server and visualize sensor <p class="grey margin-top">Connect and manage your Android device with WSO2 IoT Server.</p>
data.</p>
<br> <br>
<h3 class="uppercase">What You Need</h3> <h3 class="uppercase">What You Need</h3>
<hr> <hr>
<p class="grey margin-top">You should have an Android Device to get started.</p>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double"><span class="circle">STEP 01</span>&nbsp;&nbsp;&nbsp;Android
<span class="circle">STEP 01</span> Mobile.
&nbsp;&nbsp;&nbsp;Go ahead and click [Enroll Device].
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double"><span class="circle">STEP 02</span>&nbsp;&nbsp;&nbsp;Go ahead
<span class="circle">STEP 02</span> and click [Enroll Device].
&nbsp;&nbsp;&nbsp;You can either scan the QR code or directly download Android agent.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double"><span class="circle">STEP 03</span>&nbsp;&nbsp;&nbsp;Proceed
<span class="circle">STEP 03</span> to the [Prepare] section.
&nbsp;&nbsp;&nbsp;Install Android agent into your Android Device.
</li> </li>
<li class="padding-top-double"><span class="circle">STEP 04</span>
&nbsp;&nbsp;&nbsp;Proceed to [Prepare] section.
</ul> </ul>
<br> <br>
<a href="#" class="download-link btn-operations" data-devicetype="{{@uriParams.deviceType}}"
data-sketchtype="{{@uriParams.deviceType}}" data-url="{{enrollmentURl}}">
<i class="fw fw-mobile fw-inverse fw-lg"></i> Enroll Device</a>
<br/><br/>
<div id="download-device-modal-content-links" class="hide"> <a href="#" class="download-link btn-operations"><i class="fw fw-mobile fw-inverse fw-lg"></i> Enroll Device</a>
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Please download the file from following link(Press CTRL+C).</h3>
<br/>
<div>
<input id="download-device-url" style="color:#3f3f3f;padding:5px"
type="text" value="" placeholder="Type here" size="60">
</div>
</div>
</div>
</div>
</div>
<div id="device-400-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Exception at backend. Try Later.</h3>
<div class="buttons">
<a href="#" id="device-400-link" class="btn-operations">
OK
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-401-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>You have to log in first.</h3><br/>
<div class="buttons">
<a href="#" id="device-401-link" class="blue-button">
Goto Login Page
</a>&nbsp;&nbsp;
<a href="#" onclick="hidePopup();" class="btn-operations">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-403-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Action not permitted.</h3><br/>
<div class="buttons">
<a href="#" id="device-403-link" class="btn-operations">
OK
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-409-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Device Sketch does not exist.</h3><br/>
<div class="buttons">
<a href="#" id="device-409-link" class="btn-operations">
OK
</a>
</div>
</div>
</div>
</div>
</div>
<div id="device-unexpected-error-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Unexpected error.</h3><br/>
<div class="buttons">
<a href="#" id="device-unexpected-error-link" class="btn-operations">
OK
</a>
</div>
</div>
</div>
</div>
</div>
<br/><br/> <br/><br/>
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-double grey-bg"> <div class="col-xs-12 col-sm-12 col-md-8 col-lg-12 padding-double grey-bg">
<h3 class="uppercase">Prepare</h3> <h3 class="uppercase">Prepare</h3><hr>
<hr>
<ul class="list-unstyled"> <ul class="list-unstyled">
<li class="padding-top-double"> <li class="padding-top-double"><span class="circle">01</span> Download Device Agent into your Android Mobile.</li>
<span class="circle">01</span> <li class="padding-top-double"><span class="circle">02</span> Install Agent APK file.</li>
&nbsp;&nbsp;&nbsp;Connect Android device to network. <li class="padding-top-double"><span class="circle">03</span> Configure Agent App</li>
</li>
<li class="padding-top-double">
<span class="circle">02</span>
&nbsp;&nbsp;&nbsp;Start Android Sense app in your device.
</li>
<li class="padding-top-double">
<span class="circle">03</span>
&nbsp;&nbsp;&nbsp;Fill login form with the credentials.
<i>(Use server URL as [&nbsp;https://&lt;WSO2_IoT_SERVER_HOST&gt;:&lt;
HTTPS_SERVER_PORT&gt;&nbsp;] and click on
<strong>Register Device</strong> button.)</i>
</li>
<li>
<a href="{{@unit.publicUri}}/images/registerView.png" target="_blank"
class="padding-top-double">
<img src="{{@unit.publicUri}}/images/registerView.png" class="img-responsive">
</a>
</li>
<li class="padding-top-double">
<span class="circle">04</span>
&nbsp;&nbsp;&nbsp;Once the device is enrolled, click on <strong>[+]</strong> button to
select the sensors.
<a href="{{@unit.publicUri}}/images/selectSensorView.png" target="_blank"
class="padding-top-double">
<img src="{{@unit.publicUri}}/images/selectSensorView.png" class="img-responsive">
</a>
</li>
<li class="padding-top-double">
<span class="circle">05</span>
&nbsp;&nbsp;&nbsp;Click on <i>[Publish data]</i> button to publish sensor readings to
IoT server.
<a href="{{@unit.publicUri}}/images/publishDataView.png" target="_blank"
class="padding-top-double">
<img src="{{@unit.publicUri}}/images/publishDataView.png" class="img-responsive">
</a>
</li>
</ul> </ul>
<br> <br>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double"> <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase">Try Out</h3>
<hr>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
&nbsp;&nbsp;&nbsp;You can view all your connected devices
<a href="{{@app.context}}/devices">[Device Management]</a> page.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>
&nbsp;&nbsp;&nbsp;You can select any one of your connected devices for available
operations and Real-Time data monitoring.
</li>
<li class="padding-top-double">
<span class="fw-stack fw-lg margin-right">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-right-arrow fw-stack-1x"></i>
</span>&nbsp;&nbsp;&nbsp;For historical analytics of sensor data navigate to device
analytics page.
</li>
</ul>
<br/>
<p class="grey margin-top">Click on the image to zoom</p> <p class="grey margin-top">Click on the image to zoom</p>
<center> <center>
<a href="{{@unit.publicUri}}/images/myDevices_analytics.png" target="_blank"> <a href="{{@unit.publicUri}}/images/android_device.png" target="_blank">
<img src="{{@unit.publicUri}}/images/myDevices_analytics.png" class="img-responsive"> <img src="{{@unit.publicUri}}/images/android_device.png" class="img-responsive">
</a> </a>
</center> </center>
</div> </div>
<div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden"> <br/>
<div id="qr-code-modal"
data-enrollment-url="{{hostName}}{{@unit.publicUri}}/asset/android-agent.apk" class="hidden">
<div class="content"> <div class="content">
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-6 col-centered"> <div class="col-lg-5 col-md-6 col-centered">
@ -236,102 +73,74 @@
<div class="qr-code"></div> <div class="qr-code"></div>
</div> </div>
</div> </div>
<form id="downloadForm" method="GET"
action="{{@app.context}}/api/devices/sketch/download">
<div class="control-group">
<div class="controls">
<input type="hidden" class="deviceType" name="deviceType"
value="android_sense"/>
<input type="hidden" class="sketchType" name="sketchType"
value="android_sense"/>
</div>
</div>
<div class="buttons" style="padding-bottom: 0px">
<a class="btn btn-operations" onclick="downloadAgent()">Download Now</a>
</div>
</form>
</div>
</div>
</div>
<div id="device-agent-downloading-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h3>Device Agent will downloading shortly.</h3>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<style type="text/css"> {{#zone "topCss"}}
.circle { <style type="text/css">
background: none repeat scroll 0 0 #191919; .circle {
border-radius: 50px; background: none repeat scroll 0 0 #191919;
height: 50px; border-radius: 50px;
padding: 10px; height: 50px;
width: 50px; padding: 10px;
color: #fff; width: 50px;
} color: #fff;
}
.padding-top-double { .padding-top-double {
padding-top: 20px; padding-top: 20px;
} }
.padding-double {
.padding-double { padding: 20px;
padding: 20px; }
} .grey {
color: #333;
.grey { }
color: #333; hr {
} display: block;
height: 1px;
hr { border: 0;
display: block; border-top: 1px solid #7f7f7f;
height: 1px; margin: 1em 0;
border: 0; padding: 0;
border-top: 1px solid #7f7f7f; opacity: 0.2;
margin: 1em 0; }
padding: 0; .light-grey {
opacity: 0.2; color: #7c7c7c;
} }
.uppercase {
.light-grey { text-transform: uppercase;
color: #7c7c7c; }
} .grey-bg {
background-color: #f6f4f4;
.uppercase { }
text-transform: uppercase;
}
.grey-bg {
background-color: #f6f4f4;
}
.doc-link { .doc-link {
background: #11375B; background: #11375B;
padding: 20px; padding: 20px;
color: white; color: white;
margin-top: 0; margin-top: 0;
} }
.doc-link a { .doc-link a {
color: white; color: white;
} }
</style> </style>
{{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "/js/download.js"}}
<script type="text/javascript"> <script type="text/javascript">
$(".download-link").click(function () {
$(".download-link").click(function(){
toggleEnrollment(); toggleEnrollment();
}); });
function toggleEnrollment() { function toggleEnrollment(){
$(".modalpopup-content").html($("#qr-code-modal").html()); $(".modalpopup-content").html($("#qr-code-modal").html());
generateQRCode(".modalpopup-content .qr-code"); generateQRCode(".modalpopup-content .qr-code");
showPopup(); showPopup();
} }
</script> </script>
{{js "/js/jquery.validate.js"}}
{{/zone}} {{/zone}}

@ -18,9 +18,7 @@
function onRequest(context){ function onRequest(context){
var viewModel = {}; var viewModel = {};
var process = require("process"); var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var serverIP = process.getProperty("carbon.local.ip"); viewModel.hostName = devicemgtProps["httpsURL"];
var serverPort = process.getProperty("carbon.http.port");
viewModel.enrollmentURL = "http://"+serverIP+":"+serverPort+"/android_sense_mgt/manager/device/android_sense/download/";
return viewModel; return viewModel;
} }
Loading…
Cancel
Save