adding ui changes

application-manager-new
buddhinipun 9 years ago
parent c092542b8e
commit c68df4d3a2

@ -80,5 +80,5 @@ public interface DeviceTypeService {
@GET @GET
@Produces("application/zip") @Produces("application/zip")
@Permission(scope = "CONNECTEDLAP_user", permissions = {"/permission/admin/device-mgt/download"}) @Permission(scope = "CONNECTEDLAP_user", permissions = {"/permission/admin/device-mgt/download"})
Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType,@QueryParam("osType") String osType);
} }

@ -24,7 +24,7 @@ import org.wso2.connectedlap.api.util.APIUtil;
import org.wso2.connectedlap.api.util.ZipUtil; import org.wso2.connectedlap.api.util.ZipUtil;
import org.wso2.connectedlap.plugin.constants.DeviceTypeConstants; import org.wso2.connectedlap.plugin.constants.DeviceTypeConstants;
import org.wso2.connectedlap.api.DeviceTypeService; import org.wso2.connectedlap.api.DeviceTypeService;
import org.wso2.connectedlap.plugin.impl.uti.ConnectedLapResponse; import org.wso2.connectedlap.plugin.impl.util.ConnectedLapResponse;
import org.wso2.connectedlap.plugin.impl.util.ConnectedLapDevice; import org.wso2.connectedlap.plugin.impl.util.ConnectedLapDevice;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -265,9 +265,9 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
@GET @GET
@Produces("application/zip") @Produces("application/zip")
public Response downloadSketch(@QueryParam("deviceName") String deviceName, public Response downloadSketch(@QueryParam("deviceName") String deviceName,
@QueryParam("sketchType") String sketchType) { @QueryParam("sketchType") String sketchType, @QueryParam("osType") String osType) {
try { try {
ZipArchive zipFile = createDownloadFile(APIUtil.getAuthenticatedUser(), deviceName, sketchType); ZipArchive zipFile = createDownloadFile(APIUtil.getAuthenticatedUser(), deviceName, sketchType ,osType);
Response.ResponseBuilder response = Response.ok(FileUtils.readFileToByteArray(zipFile.getZipFile())); Response.ResponseBuilder response = Response.ok(FileUtils.readFileToByteArray(zipFile.getZipFile()));
response.status(Response.Status.OK); response.status(Response.Status.OK);
response.type("application/zip"); response.type("application/zip");
@ -301,7 +301,7 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
return Long.toString(l, Character.MAX_RADIX); return Long.toString(l, Character.MAX_RADIX);
} }
private ZipArchive createDownloadFile(String owner, String deviceName, String sketchType) private ZipArchive createDownloadFile(String owner, String deviceName, String sketchType , String osType)
throws DeviceManagementException, JWTClientException, APIManagerException, throws DeviceManagementException, JWTClientException, APIManagerException,
UserStoreException { UserStoreException {
@ -329,7 +329,7 @@ public class DeviceTypeServiceImpl implements DeviceTypeService {
ZipUtil ziputil = new ZipUtil(); ZipUtil ziputil = new ZipUtil();
ZipArchive zipFile = ziputil.createZipFile(owner, APIUtil.getTenantDomainOftheUser(), sketchType, ZipArchive zipFile = ziputil.createZipFile(owner, APIUtil.getTenantDomainOftheUser(), sketchType,
deviceId, deviceName, accessToken, refreshToken); deviceId, deviceName, accessToken, refreshToken,osType);
return zipFile; return zipFile;
} }

@ -44,7 +44,7 @@ public class ZipUtil {
public ZipArchive createZipFile(String owner, String tenantDomain, String deviceType, public ZipArchive createZipFile(String owner, String tenantDomain, String deviceType,
String deviceId, String deviceName, String token, String deviceId, String deviceName, String token,
String refreshToken) throws DeviceManagementException { String refreshToken,String osType) throws DeviceManagementException {
String sketchFolder = "repository" + File.separator + "resources" + File.separator + "sketches"; String sketchFolder = "repository" + File.separator + "resources" + File.separator + "sketches";
String archivesPath = CarbonUtils.getCarbonHome() + File.separator + sketchFolder + File.separator + "archives" + String archivesPath = CarbonUtils.getCarbonHome() + File.separator + sketchFolder + File.separator + "archives" +
@ -75,6 +75,7 @@ public class ZipUtil {
contextParams.put("MQTT_EP", mqttEndpoint); contextParams.put("MQTT_EP", mqttEndpoint);
contextParams.put("DEVICE_TOKEN", token); contextParams.put("DEVICE_TOKEN", token);
contextParams.put("DEVICE_REFRESH_TOKEN", refreshToken); contextParams.put("DEVICE_REFRESH_TOKEN", refreshToken);
contextParams.put("OS_TYPE", osType);
ZipArchive zipFile; ZipArchive zipFile;
zipFile = Utils.getSketchArchive(archivesPath, templateSketchPath, contextParams, deviceName); zipFile = Utils.getSketchArchive(archivesPath, templateSketchPath, contextParams, deviceName);

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.connectedlap.plugin.impl.uti; package org.wso2.connectedlap.plugin.impl.util;
public class ConnectedLapResponse { public class ConnectedLapResponse {

@ -14,12 +14,25 @@
<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 a CONNECTEDLAP to WSO2 IoT Server and manage it.</p> <p class="grey margin-top">Connect a computer with this application to WSO2 IoT Server and visualize usage data.</p>
<p>Add brief description what this device type does</p>
<h3 class="uppercase">What You Need</h3> <h3 class="uppercase">What You Need</h3>
<p>Add hardware requirement which will be required to make this device type </p>
<br>
<hr> <hr>
<p class="grey margin-top">You should have an Android Device to get started.</p>
<ul class="list-unstyled">
<li class="padding-top-double">
<span class="circle">STEP 01</span>
&nbsp;&nbsp;&nbsp;Go ahead and [Download] the Device.
</li>
<li class="padding-top-double">
<span class="circle">STEP 02</span>
&nbsp;&nbsp;&nbsp;Proceed to [Prepare] section.
</li>
<li class="padding-top-double">
<span class="circle">STEP 03</span>
&nbsp;&nbsp;&nbsp;Read [Try Out] section to further experiment with the device.
</li>
</ul>
<br> <br>
<a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin" <a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin"
class="btn-operations" class="btn-operations"
@ -42,6 +55,11 @@
</div> </div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<label for="sel1">Select OS Type</label>
<select class="form-control" name="osType" style="width:40%;margin-bottom:0.5%" onchange="this.form.submit()">
<option name="linux" value="linux">Ubuntu</option>
<option name="mac" value="mac">MacOS</option>
</select>
<input class="new-device-name" style="color:#3f3f3f;padding:5px" <input class="new-device-name" style="color:#3f3f3f;padding:5px"
type="text" type="text"
placeholder="Ex. Lobby_DigitalDisplay" placeholder="Ex. Lobby_DigitalDisplay"
@ -151,46 +169,52 @@
<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"><span class="circle">01</span>&nbsp;&nbsp;&nbsp;Add how you are goining to <li class="padding-top-double"><span class="circle">01</span>&nbsp;&nbsp;&nbsp;Download your Connectedlap using [Download Agent] button above.
prepare your device </li>
<li class="padding-top-double"><span class="circle">02</span>&nbsp;&nbsp;&nbsp;Unzip the downloaded Agent.
</li>
<li class="padding-top-double"><span class="circle">03</span>&nbsp;&nbsp;&nbsp;Move into the unzipped Agent folder.
</li>
<li class="padding-top-double"><span class="circle">04</span>&nbsp;&nbsp;&nbsp;On terminal to run this command: [sudo sh startagent.sh].
</li>
<li class="padding-top-double"><span class="circle">05</span>&nbsp;&nbsp;&nbsp;Give the Super-Admin password.
</li> </li>
</ul> </ul>
<br> <br>
<br> <br>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase">Schematic Diagram</h3>
<hr>
<p class="grey margin-top">Click on the image to zoom</p>
<center>
<a href="{{@unit.publicUri}}/images/schematicsGuide.png" target="_blank">
<img src="{{@unit.publicUri}}/images/schematicsGuide.png" class="img-responsive">
</a>
</center>
<br/>
</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> <h3 class="uppercase">Try Out</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> <span class="circle">01</span>
&nbsp;&nbsp;&nbsp;You can view all your connected devices at &nbsp;&nbsp;&nbsp;You can view all your connected devices at [Device Management] page.
<a href="{{@app.context}}/devices">[Device Management]</a> page. <a href="{{@app.context}}/devices">[Device Management]</a> page.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="circle">02</span> <span class="circle">02</span>
&nbsp;&nbsp;&nbsp;Select one of connected devices and check for available control &nbsp;&nbsp;&nbsp;Select one of connected devices and monitor Real-Time data.
operations and monitor Real-Time data.
</li> </li>
<li class="padding-top-double"> <li class="padding-top-double">
<span class="circle">03</span> <span class="circle">03</span>
&nbsp;&nbsp;&nbsp;You can also view analytics of the data published to IoT-Server by &nbsp;&nbsp;&nbsp;You can also view analytics of the data published to IoT-Server by navigating to Device Analytics page.
navigating to Device Analytics page.
</li> </li>
</ul> </ul>
<br/> <br/>
</div> </div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 padding-double">
<h3 class="uppercase"></h3>
<br>
<hr>
<p class="grey margin-top">Click on the image to zoom</p>
<center>
<a href="{{@unit.publicUri}}/images/deviceview.png" target="_blank">
<img src="{{@unit.publicUri}}/images/deviceview.png" class="img-responsive">
</a>
</center>
<br/>
</div>
{{#zone "topCss"}} {{#zone "topCss"}}
<style type="text/css"> <style type="text/css">

@ -27,6 +27,7 @@ https-ep=${HTTPS_EP}
auth-method=token auth-method=token
auth-token=${DEVICE_TOKEN} auth-token=${DEVICE_TOKEN}
refresh-token=${DEVICE_REFRESH_TOKEN} refresh-token=${DEVICE_REFRESH_TOKEN}
os-type=${OS_TYPE}
push-interval=15 push-interval=15

Loading…
Cancel
Save