2015-10-13 14:12:34 +02:00
|
|
|
import Ember from 'ember';
|
|
|
|
|
|
|
|
export default Ember.Controller.extend({
|
2015-10-22 07:28:31 -04:00
|
|
|
state: 1,
|
2015-10-22 10:13:24 -04:00
|
|
|
redZone: [{from: 50, to: 60}],
|
|
|
|
yellowZone: [{from: 40, to: 50}],
|
2015-10-22 07:28:31 -04:00
|
|
|
|
2015-10-21 00:22:54 +02:00
|
|
|
init: function() {
|
|
|
|
this.set('dataSet', this.get('dataSetOne'));
|
|
|
|
},
|
|
|
|
|
2015-10-13 14:12:34 +02:00
|
|
|
S1Entity: function() {
|
2015-10-15 17:09:02 +02:00
|
|
|
return this.model.findBy('id', 'S1_ElectricalGrid');
|
2015-10-13 14:12:34 +02:00
|
|
|
}.property('model.[]'),
|
|
|
|
|
2015-10-22 07:28:31 -04:00
|
|
|
Voltage203937: function() {
|
|
|
|
var entity = this.model.findBy('id', 'S1_ElectricalGrid');
|
2015-10-16 00:36:02 +02:00
|
|
|
if (entity) {
|
|
|
|
return entity.get('properties').findBy('name', 'Voltage203937');
|
2015-10-22 07:28:31 -04:00
|
|
|
} else {
|
|
|
|
return {};
|
2015-10-16 00:36:02 +02:00
|
|
|
}
|
|
|
|
}.property('model.[]'),
|
2015-10-21 00:22:54 +02:00
|
|
|
|
2015-10-22 11:00:09 -04:00
|
|
|
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.[]'),
|
2015-10-21 00:22:54 +02:00
|
|
|
|
2015-10-22 07:28:31 -04:00
|
|
|
initState: function() {
|
|
|
|
return this.get('state') === 1;
|
|
|
|
}.property('state'),
|
|
|
|
|
|
|
|
eventState: function() {
|
|
|
|
return this.get('state') === 2;
|
|
|
|
}.property('state'),
|
|
|
|
|
2015-10-21 00:22:54 +02:00
|
|
|
actions: {
|
|
|
|
resetData: function() {
|
2015-10-22 07:28:31 -04:00
|
|
|
this.set('state', 1);
|
2015-10-21 00:22:54 +02:00
|
|
|
this.set('dataSet', this.get('dataSetOne'));
|
|
|
|
},
|
|
|
|
|
|
|
|
eventData: function() {
|
2015-10-22 07:28:31 -04:00
|
|
|
this.set('state', 2);
|
2015-10-21 00:22:54 +02:00
|
|
|
this.set('dataSet', this.get('dataSetTwo'));
|
|
|
|
}
|
|
|
|
}
|
2015-10-13 14:12:34 +02:00
|
|
|
});
|