mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Add attribute source
This commit is contained in:
parent
cedb884ab6
commit
eb3a47a622
4 changed files with 28 additions and 9 deletions
|
@ -6,6 +6,7 @@ export default DS.Model.extend({
|
|||
values: DS.attr(),
|
||||
timestamp: DS.attr('date'),
|
||||
visible: DS.attr('boolean', { defaultValue: false }),
|
||||
source: DS.attr('string'),
|
||||
entity: DS.belongsTo('entity'),
|
||||
category: DS.belongsTo('category')
|
||||
});
|
||||
|
|
|
@ -80,18 +80,23 @@ export default DS.RESTSerializer.extend({
|
|||
if (item.contextElement.attributes) {
|
||||
item.contextElement.attributes.forEach(function(attribute) {
|
||||
if (attribute.type !== 'category') {
|
||||
// find timestamp data
|
||||
// find metadata
|
||||
var timestamp = 0;
|
||||
var source = "";
|
||||
|
||||
attribute.metadatas.forEach(function(metadata) {
|
||||
if (metadata.name === 'timestamp') {
|
||||
timestamp = Date.parse(metadata.value);
|
||||
} else if (metadata.name === 'source') {
|
||||
source = metadata.value;
|
||||
}
|
||||
});
|
||||
|
||||
if (timestamp === 0) {
|
||||
timestamp = (new Date()).getTime();
|
||||
console.log('Use local timestamp');
|
||||
}
|
||||
|
||||
|
||||
// create property
|
||||
var property = {
|
||||
|
@ -102,6 +107,7 @@ export default DS.RESTSerializer.extend({
|
|||
type: attribute.type,
|
||||
timestamp: timestamp,
|
||||
visible: false,
|
||||
source: source,
|
||||
values: []
|
||||
},
|
||||
relationships: {
|
||||
|
|
|
@ -101,13 +101,6 @@ footer {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
.column-right h4 {
|
||||
text-align: right;
|
||||
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.layout-page {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
|
||||
|
@ -184,3 +177,21 @@ footer {
|
|||
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
.label-source {
|
||||
text-align: left;
|
||||
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
float: left;
|
||||
}
|
||||
|
||||
.label-type {
|
||||
text-align: right;
|
||||
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
float: right;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
{{line-chart data=visibleProperty.values}}
|
||||
|
||||
{{#if visibleProperty}}
|
||||
<h4>{{visibleProperty.type}}</h4>
|
||||
<h4 class="label-source">Source: {{visibleProperty.source}}</h4>
|
||||
<h4 class="label-type">{{visibleProperty.type}}</h4>
|
||||
{{/if}}
|
||||
</td>
|
||||
{{else}}
|
||||
|
|
Loading…
Add table
Reference in a new issue