|
1 |
| -function loadDashboard(){ |
2 |
| - $.getJSON("/json/all", |
3 |
| - function(data) { |
4 |
| - $.each(data, function(i, item) { |
5 |
| - |
6 |
| - is_timestamp = new Date(item.device_time*1000).getTime() > 0; |
7 |
| - if (is_timestamp) { |
8 |
| - var timestamp = item.device_time; |
9 |
| - } else { |
10 |
| - var k = moment(item.device_time); |
11 |
| - var timestamp = (k + k.utcOffset()*60*1000)/1000; |
12 |
| - } |
13 |
| - var time = moment(timestamp*1000).format("DD-MM-YYYY HH:mm"); |
14 |
| - |
15 |
| - $('#main').append('\ |
16 |
| - <div class="incubator" id="'+item.inc_id+'">\ |
17 |
| - <h2><a href="/graph/'+item.inc_id+'/1">Incubator '+item.inc_id+'</a></h2>\ |
18 |
| - <div class="data">\ |
19 |
| - <p class="temperature">'+item.temperature+'</p><div class="light"></div></div>\ |
20 |
| - <div class="data">\ |
21 |
| - <p class="humidity">'+item.humidity+'</p></div>\ |
22 |
| - <div class="time"><p>'+time+'</p></div>\ |
23 |
| - </div>'); |
24 |
| - }) |
25 |
| - }); |
26 |
| - } |
27 |
| - |
28 | 1 | function loadIncubatorForm(incubator_id){
|
29 | 2 | $.getJSON("/json/" + incubator_id,
|
30 | 3 | function(data) {
|
@@ -62,6 +35,33 @@ function loadIncubatorForm(incubator_id){
|
62 | 35 | });
|
63 | 36 | }
|
64 | 37 |
|
| 38 | +function loadDashboard(){ |
| 39 | + $.getJSON("/json/all", |
| 40 | + function(data) { |
| 41 | + $.each(data, function(i, item) { |
| 42 | + |
| 43 | + is_timestamp = new Date(item.device_time*1000).getTime() > 0; |
| 44 | + if (is_timestamp) { |
| 45 | + var timestamp = item.device_time; |
| 46 | + } else { |
| 47 | + var k = moment(item.device_time); |
| 48 | + var timestamp = (k + k.utcOffset()*60*1000)/1000; |
| 49 | + } |
| 50 | + var time = moment(timestamp*1000).format("DD-MM-YYYY HH:mm"); |
| 51 | + |
| 52 | + $('#main').append('\ |
| 53 | + <div class="incubator" id="'+item.inc_id+'">\ |
| 54 | + <h2><a href="/graph/'+item.inc_id+'/1">Incubator '+item.inc_id+'</a></h2>\ |
| 55 | + <div class="data">\ |
| 56 | + <p class="temperature">'+item.temperature+'</p><span class="light"></span></div>\ |
| 57 | + <div class="data">\ |
| 58 | + <p class="humidity">'+item.humidity+'</p><p class="light_mode">_</p></div>\ |
| 59 | + <div class="time"><p>'+time+'</p></div>\ |
| 60 | + </div>'); |
| 61 | + }) |
| 62 | + }); |
| 63 | + } |
| 64 | + |
65 | 65 |
|
66 | 66 | function refreshDashboard(){
|
67 | 67 | $.getJSON("/json/all",
|
@@ -97,6 +97,10 @@ function refreshDashboard(){
|
97 | 97 |
|
98 | 98 | $('#' + item.inc_id).find('.humidity').html(item.humidity);
|
99 | 99 | $('#' + item.inc_id).find('.humidity').attr('title', item.humidity + " / " + item.set_hum);
|
| 100 | + |
| 101 | + lm = ["DD","LD","LL","DL","MM"] |
| 102 | + $('#' + item.inc_id).find('.light_mode').html(lm[item.dd_mode]); |
| 103 | + |
100 | 104 |
|
101 | 105 | $('#' + item.inc_id).find('.time').find("p").html(item.device_time);
|
102 | 106 | $('#' + item.inc_id).find('.time').attr('title', timestamp);
|
|
0 commit comments