forked from community/product-iots
parent
d4283a39e8
commit
c0b573e473
@ -1,4 +1,34 @@
|
|||||||
function onRequest(context){
|
function onRequest(context) {
|
||||||
context.myDevicePath = "mydevice";
|
context.myDevicePath = "mydevice";
|
||||||
|
|
||||||
|
var constants = require("/modules/constants.js");
|
||||||
|
var httpReq = new XMLHttpRequest();
|
||||||
|
var user = session.get(constants.USER_SESSION_KEY);
|
||||||
|
var endPoint = "http://localhost:9763/iotdevices/DevicesManager/getDevices?username=" + user.username;
|
||||||
|
//
|
||||||
|
httpReq.open("GET", endPoint, false);
|
||||||
|
log.info("%%%%");
|
||||||
|
log.info(httpReq.response);
|
||||||
|
|
||||||
|
context.devices = {
|
||||||
|
"devices": [
|
||||||
|
{"name":"device1",
|
||||||
|
"id" : 1234
|
||||||
|
},
|
||||||
|
{"name":"device2",
|
||||||
|
"id" : 5678}
|
||||||
|
]
|
||||||
|
};
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//{
|
||||||
|
// "devices": [
|
||||||
|
// {"name":"device1",
|
||||||
|
// "id" : 1234
|
||||||
|
// },
|
||||||
|
// {"name":"device2",
|
||||||
|
// "id" : 5678}
|
||||||
|
//]
|
||||||
|
//}
|
||||||
|
@ -1,74 +1,81 @@
|
|||||||
{{#zone "topCss"}}
|
{{#zone "topCss"}}
|
||||||
<link href="{{self.publicURL}}/css/nv.d3.css" rel="stylesheet" />
|
<link href="{{self.publicURL}}/css/nv.d3.css" rel="stylesheet"/>
|
||||||
<link href="{{self.publicURL}}/css/daterangepicker.css" rel="stylesheet"/>
|
<link href="{{self.publicURL}}/css/daterangepicker.css" rel="stylesheet"/>
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
{{#zone "topJs"}}
|
{{#zone "topJs"}}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<script src="{{self.publicURL}}/js/d3.min.js"></script>
|
<script src="{{self.publicURL}}/js/d3.min.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/nv.d3.js"></script>
|
<script src="{{self.publicURL}}/js/nv.d3.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/stream_layers.js"></script>
|
<script src="{{self.publicURL}}/js/stream_layers.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/moment.min.js"></script>
|
<script src="{{self.publicURL}}/js/moment.min.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/jquery.daterangepicker.js"></script>
|
<script src="{{self.publicURL}}/js/jquery.daterangepicker.js"></script>
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
{{#zone "main"}}
|
{{#zone "main"}}
|
||||||
<div class="container container-bg white-bg">
|
<div class="container container-bg white-bg">
|
||||||
<div class=" margin-top-double">
|
<div class=" margin-top-double">
|
||||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
|
<div class="row row padding-top-double padding-bottom-double margin-bottom-double ">
|
||||||
<div class="col-lg-12 margin-top-double">
|
<div class="col-lg-12 margin-top-double">
|
||||||
<h1 class="grey ">Device Cloud</h1>
|
<h1 class="grey ">Device Cloud</h1>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row float-right margin-top-minus">
|
<div class="row float-right margin-top-minus">
|
||||||
<div class="btn-black padding-top padding-bottom">
|
<div class="btn-black padding-top padding-bottom">
|
||||||
<span> <img src="{{self.publicURL}}/images/temp.png" > </span>
|
<span> <img src="{{self.publicURL}}/images/temp.png"> </span>
|
||||||
<span class="middle padding-bottom-double">Read Temp</span></div>
|
<span class="middle padding-bottom-double">Read Temp</span></div>
|
||||||
<div class="btn-black padding-top padding-bottom">
|
<div class="btn-black padding-top padding-bottom">
|
||||||
<span> <img src="{{self.publicURL}}/images/fan.png" > </span>
|
<span> <img src="{{self.publicURL}}/images/fan.png"> </span>
|
||||||
<span class="middle padding-bottom-double">Switch Fan</span>
|
<span class="middle padding-bottom-double">Switch Fan</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-black padding-top padding-bottom" onclick="changeImage()">
|
<div class="btn-black padding-top padding-bottom" onclick="changeImage()">
|
||||||
<span> <img id="myImage" onclick="changeImage()" src="{{self.publicURL}}/images/bulb-off.png" > </span>
|
<span> <img id="myImage" onclick="changeImage()"
|
||||||
<span class="middle padding-bottom-double">Switch Bulb</span>
|
src="{{self.publicURL}}/images/bulb-off.png"> </span>
|
||||||
</div >
|
<span class="middle padding-bottom-double">Switch Bulb</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="right margin-right">
|
<div class="right margin-right">
|
||||||
<input class="right margin-right" id="date-range1" size="60" value="">
|
<input class="right margin-right" id="date-range1" size="60" value="">
|
||||||
<button type="button" id="btn-draw-graphs" class="btn btn-primary">
|
<button type="button" id="btn-draw-graphs" class="btn btn-primary">
|
||||||
Draw Graphs
|
Draw Graphs
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
<div class="row margin-double">
|
<div class="row margin-double">
|
||||||
<div class="chart1">
|
<div class="chart1">
|
||||||
<h2 class="grey ">Temperature</h2><hr>
|
<h2 class="grey ">Temperature</h2>
|
||||||
<svg></svg>
|
<hr>
|
||||||
</div><hr>
|
<svg></svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="row margin-double padding-double "></div>
|
<hr>
|
||||||
<div class="row margin-double">
|
</div>
|
||||||
<div class="chart2">
|
<div class="row margin-double padding-double "></div>
|
||||||
<h2 class="grey ">Fan Status</h2><hr>
|
<div class="row margin-double">
|
||||||
<svg></svg>
|
<div class="chart2">
|
||||||
</div><hr>
|
<h2 class="grey ">Fan Status</h2>
|
||||||
</div>
|
<hr>
|
||||||
<div class="row margin-double">
|
<svg></svg>
|
||||||
<div class="chart3">
|
</div>
|
||||||
<h2 class="grey ">Bulb Status</h2><hr>
|
<hr>
|
||||||
<svg></svg>
|
</div>
|
||||||
</div><hr>
|
<div class="row margin-double">
|
||||||
</div>
|
<div class="chart3">
|
||||||
|
<h2 class="grey ">Bulb Status</h2>
|
||||||
|
<hr>
|
||||||
|
<svg></svg>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO : Move these scripts to a bottomJs zone.
|
</div>
|
||||||
|
<!-- TODO : Move these scripts to a bottomJs zone.
|
||||||
When they are moved the script tags get repeated for some reason :-(
|
When they are moved the script tags get repeated for some reason :-(
|
||||||
-->
|
-->
|
||||||
<script src="{{self.publicURL}}/js/graph_util.js"></script>
|
<script src="{{self.publicURL}}/js/graph_util.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/bulb.js"></script>
|
<script src="{{self.publicURL}}/js/bulb.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/temperature_graph.js"></script>
|
<script src="{{self.publicURL}}/js/temperature_graph.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/fan_status_graph.js"></script>
|
<script src="{{self.publicURL}}/js/fan_status_graph.js"></script>
|
||||||
<script src="{{self.publicURL}}/js/bulb_status_graph.js"></script>
|
<script src="{{self.publicURL}}/js/bulb_status_graph.js"></script>
|
||||||
{{/zone}}
|
{{/zone}}
|
||||||
|
Loading…
Reference in new issue