1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00
VILLASweb/app/controllers/lab-mashup.js
2015-10-26 11:22:06 -04:00

56 lines
1.3 KiB
JavaScript

import Ember from 'ember';
export default Ember.Controller.extend({
state: 1,
redZone: [{from: 50, to: 60}],
yellowZone: [{from: 40, to: 50}],
init: function() {
this.set('dataSet', this.get('dataSetOne'));
},
S1Entity: function() {
return this.model.findBy('id', 'S1_ElectricalGrid');
}.property('model.[]'),
Voltage203937: function() {
var entity = this.model.findBy('id', 'S1_ElectricalGrid');
if (entity) {
return entity.get('properties').findBy('name', 'Voltage203937');
} else {
return {};
}
}.property('model.[]'),
Freq575Value: function() {
var entity = this.model.findBy('id', 'S1_ElectricalGrid');
if (entity) {
var attribute = entity.get('properties').findBy('name', 'Freq_575');
var valuesLength = attribute.get('values').length;
var tuple = attribute.get('values')[valuesLength - 1];
return tuple[1];
} else {
return {};
}
}.property('model.[]'),
initState: function() {
return this.get('state') === 1;
}.property('state'),
eventState: function() {
return this.get('state') === 2;
}.property('state'),
actions: {
resetData: function() {
this.set('state', 1);
this.set('dataSet', this.get('dataSetOne'));
},
eventData: function() {
this.set('state', 2);
this.set('dataSet', this.get('dataSetTwo'));
}
}
});