1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-30 00:00:13 +01:00

Fix bugs and disable ember extend prototypes

This commit is contained in:
Markus Grigull 2016-10-18 13:01:55 +02:00
parent 22780b9d7a
commit 846a0a73ee
9 changed files with 45 additions and 23 deletions

View file

@ -30,13 +30,13 @@ export default Ember.Component.extend(Resizable, Draggable, {
grid_drag: [ 10, 10 ],
scroll_drag: true,
style: function() {
style: Ember.computed('plot', function() {
return Ember.String.htmlSafe('width: ' + this.get('plot.width') + 'px; height: ' + this.get('plot.height') + 'px; left: ' + this.get('plot.x') + 'px; top: ' + this.get('plot.y') + 'px;');
}.property('plot'),
}),
name: function() {
name: Ember.computed('plot', function() {
return this.get('plot.name');
}.property('plot'),
}),
stop_resize(event, ui) {
var width = ui.size.width;
@ -59,7 +59,7 @@ export default Ember.Component.extend(Resizable, Draggable, {
},
_updateUI: function() {
_updateUI: Ember.on('init', Ember.observer('editing', 'grid', function() {
if (this.get('editing') === true) {
this.set('disabled_resize', false);
this.set('autoHide_resize', false);
@ -77,7 +77,7 @@ export default Ember.Component.extend(Resizable, Draggable, {
this.set('grid_resize', false);
this.set('grid_drag', false);
}
}.observes('editing', 'grid').on('init'),
})),
/*doubleClick() {
if (this.get('editing')) {

View file

@ -19,18 +19,18 @@ export default Ember.Component.extend({
grid: true,
data: null,
style: function() {
style: Ember.computed('plots.@each.height', 'plots.@each.y', function() {
var height = this._calculateHeight();
if (this.get('editing') === true && height < 400) {
height = 400;
}
return Ember.String.htmlSafe('height: ' + height + 'px;');
}.property('plots.@each.height', 'plots.@each.y'),
}),
_value: function() {
_value: Ember.computed('data.2.values.@each', function() {
console.log(this.get('data'));
}.property('data.2.values.@each'),
}),
_calculateHeight() {
var maxHeight = 0;

View file

@ -8,6 +8,7 @@
**********************************************************************************/
import PlotAbstract from './plot-abstract';
import Ember from 'ember';
export default PlotAbstract.extend({
classNames: [ 'plotValue' ],
@ -15,7 +16,7 @@ export default PlotAbstract.extend({
minWidth_resize: 50,
minHeight_resize: 20,
value: function() {
value: Ember.computed('data.2.values', 'plot.simulator', 'plot.signal', function() {
// get all values for the choosen simulator
let values = this.get('data.' + this.get('plot.simulator') + '.values');
if (values) {
@ -26,7 +27,26 @@ export default PlotAbstract.extend({
Ember.run.later(this, function() {
this.notifyPropertyChange('data.' + this.get('plot.simulator') + '.values');
}, 1000);
}.property('data.2.values', 'plot.simulator', 'plot.signal'),
}),
/*_updateValue() {
let values = this.get('data.' + this.get('plot.simulator') + '.values');
if (values) {
console.log('update value');
return;
}
// values is null, try to reload later
Ember.run.later(this, this._updateValue, 1000);
console.log('update later');
},
_updateDataObserver: function() {
let query = 'data.' + this.get('plot.simulator') + '.values';
this.addObserver(query, this, this._updateValue);
console.log('Add observer: ' + query);
}.observes('plot.simulator', 'plot.signal').on('init'),*/
doubleClick() {
if (this.get('editing') === true) {
@ -124,7 +144,6 @@ export default PlotAbstract.extend({
// get signal mapping for simulation model
let self = this;
let simulatorid = this.get('plot.simulator');
this.get('plot.visualization').then((visualization) => {
visualization.get('project').then((project) => {

View file

@ -10,10 +10,10 @@
import Ember from 'ember';
export default Ember.Controller.extend({
isAdmin: function() {
isAdmin: Ember.computed('model', function() {
var level = this.get('model.adminLevel');
return level >= 1;
}.property('model'),
}),
actions: {
changeUser() {

View file

@ -21,12 +21,12 @@ export default Ember.Controller.extend({
project: null,
projectSimulation: null,
_updateSimulations: function() {
_updateSimulations: Ember.observer('model', function() {
if (this.get('model.simulations') != null && this.get('model.simulations.length') > 0) {
var simulations = this.get('model.simulations');
this.set('projectSimulation', simulations.toArray()[0]);
}
}.observes('model'),
}),
actions: {
showNewModal() {

View file

@ -21,12 +21,12 @@ export default Ember.Controller.extend(FetchLiveDataMixin, {
simulatorName: null,
signal: null,
_updateSimulators: function() {
_updateSimulators: Ember.observer('model', function() {
if (this.get('model.simulators') !== null && this.get('model.simulators.length') > 0) {
let simulators = this.get('model.simulators');
this.set('simulatorName', simulators.toArray()[0].get('name'));
}
}.observes('model'),
}),
actions: {
addPlot(name) {

View file

@ -12,7 +12,7 @@ import Ember from 'ember';
export default Ember.Mixin.create({
data: {},
_getData: function() {
_getData: Ember.observer('model', function() {
// check if simulation is running
let self = this;
@ -48,7 +48,7 @@ export default Ember.Mixin.create({
}
});
});
}.observes('model'),
}),
_loadDataForSimulator(simulatorID) {
// get data by simulator id

View file

@ -23,10 +23,10 @@ export default Model.extend({
_history: [],
_updateHistory: function() {
_updateHistory: Ember.observer('values', function() {
this._history.unshift(this.get('values'));
while (this._history.length > 5) {
this._history.shift();
}
}.observes('values')
})
});

View file

@ -10,6 +10,9 @@ module.exports = function(environment) {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
},
EXTEND_PROTOTYPES: {
Date: false,
}
},