mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Add property timestamp
Start adding periodic polling. Timestamp is displayed in properties tables.
This commit is contained in:
parent
9496e8023e
commit
0357a8dc77
6 changed files with 20 additions and 10 deletions
|
@ -1,6 +1,17 @@
|
|||
import Ember from 'ember';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
type: DS.attr('string'),
|
||||
properties: DS.attr()
|
||||
properties: DS.attr(),
|
||||
|
||||
poll: function() {
|
||||
Ember.debug("Poll");
|
||||
|
||||
var _this = this;
|
||||
Ember.run.later(function() {
|
||||
_this.reload();
|
||||
_this.poll();
|
||||
}, 500);
|
||||
}.observes('didLoad')
|
||||
});
|
||||
|
|
|
@ -43,7 +43,8 @@ export default DS.RESTSerializer.extend({
|
|||
var property = {
|
||||
name: attribute.name,
|
||||
value: attribute.value,
|
||||
type: attribute.type
|
||||
type: attribute.type,
|
||||
timestamp: attribute.metadatas[0].value
|
||||
}
|
||||
|
||||
entity.attributes.properties.push(property);
|
||||
|
|
|
@ -89,8 +89,8 @@ body {
|
|||
#last-update-info {
|
||||
padding: 0px 0 20px 0;
|
||||
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
font-size: 15px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.data-table {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Value</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
{{#each entity.properties as |property|}}
|
||||
<tr>
|
||||
<td>{{property.name}}</td>
|
||||
<td>{{property.value}} {{property.type}}</td>
|
||||
<td>{{property.timestamp}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
|
|
@ -9,7 +9,3 @@
|
|||
{{outlet}}
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="last-update-info">
|
||||
<p>Last updated: </p>
|
||||
</section>
|
||||
|
|
|
@ -3,10 +3,10 @@ import DS from 'ember-data';
|
|||
|
||||
export default DS.Transform.extend({
|
||||
deserialize: function(value) {
|
||||
return Ember.create({ name: value[0], value: value[1], type: value[2]});
|
||||
return Ember.create({ name: value[0], value: value[1], type: value[2], timestamp: value[3]});
|
||||
},
|
||||
|
||||
serialize: function(value) {
|
||||
return [value.get('name'), value.get('value'), value.get('type')];
|
||||
return [value.get('name'), value.get('value'), value.get('type'), value.get('timestamp')];
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue