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:
parent
22780b9d7a
commit
846a0a73ee
9 changed files with 45 additions and 23 deletions
|
@ -30,13 +30,13 @@ export default Ember.Component.extend(Resizable, Draggable, {
|
||||||
grid_drag: [ 10, 10 ],
|
grid_drag: [ 10, 10 ],
|
||||||
scroll_drag: true,
|
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;');
|
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');
|
return this.get('plot.name');
|
||||||
}.property('plot'),
|
}),
|
||||||
|
|
||||||
stop_resize(event, ui) {
|
stop_resize(event, ui) {
|
||||||
var width = ui.size.width;
|
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) {
|
if (this.get('editing') === true) {
|
||||||
this.set('disabled_resize', false);
|
this.set('disabled_resize', false);
|
||||||
this.set('autoHide_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_resize', false);
|
||||||
this.set('grid_drag', false);
|
this.set('grid_drag', false);
|
||||||
}
|
}
|
||||||
}.observes('editing', 'grid').on('init'),
|
})),
|
||||||
|
|
||||||
/*doubleClick() {
|
/*doubleClick() {
|
||||||
if (this.get('editing')) {
|
if (this.get('editing')) {
|
||||||
|
|
|
@ -19,18 +19,18 @@ export default Ember.Component.extend({
|
||||||
grid: true,
|
grid: true,
|
||||||
data: null,
|
data: null,
|
||||||
|
|
||||||
style: function() {
|
style: Ember.computed('plots.@each.height', 'plots.@each.y', function() {
|
||||||
var height = this._calculateHeight();
|
var height = this._calculateHeight();
|
||||||
if (this.get('editing') === true && height < 400) {
|
if (this.get('editing') === true && height < 400) {
|
||||||
height = 400;
|
height = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ember.String.htmlSafe('height: ' + height + 'px;');
|
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'));
|
console.log(this.get('data'));
|
||||||
}.property('data.2.values.@each'),
|
}),
|
||||||
|
|
||||||
_calculateHeight() {
|
_calculateHeight() {
|
||||||
var maxHeight = 0;
|
var maxHeight = 0;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
**********************************************************************************/
|
**********************************************************************************/
|
||||||
|
|
||||||
import PlotAbstract from './plot-abstract';
|
import PlotAbstract from './plot-abstract';
|
||||||
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default PlotAbstract.extend({
|
export default PlotAbstract.extend({
|
||||||
classNames: [ 'plotValue' ],
|
classNames: [ 'plotValue' ],
|
||||||
|
@ -15,7 +16,7 @@ export default PlotAbstract.extend({
|
||||||
minWidth_resize: 50,
|
minWidth_resize: 50,
|
||||||
minHeight_resize: 20,
|
minHeight_resize: 20,
|
||||||
|
|
||||||
value: function() {
|
value: Ember.computed('data.2.values', 'plot.simulator', 'plot.signal', function() {
|
||||||
// get all values for the choosen simulator
|
// get all values for the choosen simulator
|
||||||
let values = this.get('data.' + this.get('plot.simulator') + '.values');
|
let values = this.get('data.' + this.get('plot.simulator') + '.values');
|
||||||
if (values) {
|
if (values) {
|
||||||
|
@ -26,7 +27,26 @@ export default PlotAbstract.extend({
|
||||||
Ember.run.later(this, function() {
|
Ember.run.later(this, function() {
|
||||||
this.notifyPropertyChange('data.' + this.get('plot.simulator') + '.values');
|
this.notifyPropertyChange('data.' + this.get('plot.simulator') + '.values');
|
||||||
}, 1000);
|
}, 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() {
|
doubleClick() {
|
||||||
if (this.get('editing') === true) {
|
if (this.get('editing') === true) {
|
||||||
|
@ -124,7 +144,6 @@ export default PlotAbstract.extend({
|
||||||
|
|
||||||
// get signal mapping for simulation model
|
// get signal mapping for simulation model
|
||||||
let self = this;
|
let self = this;
|
||||||
let simulatorid = this.get('plot.simulator');
|
|
||||||
|
|
||||||
this.get('plot.visualization').then((visualization) => {
|
this.get('plot.visualization').then((visualization) => {
|
||||||
visualization.get('project').then((project) => {
|
visualization.get('project').then((project) => {
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
isAdmin: function() {
|
isAdmin: Ember.computed('model', function() {
|
||||||
var level = this.get('model.adminLevel');
|
var level = this.get('model.adminLevel');
|
||||||
return level >= 1;
|
return level >= 1;
|
||||||
}.property('model'),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
changeUser() {
|
changeUser() {
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default Ember.Controller.extend({
|
||||||
project: null,
|
project: null,
|
||||||
projectSimulation: null,
|
projectSimulation: null,
|
||||||
|
|
||||||
_updateSimulations: function() {
|
_updateSimulations: Ember.observer('model', function() {
|
||||||
if (this.get('model.simulations') != null && this.get('model.simulations.length') > 0) {
|
if (this.get('model.simulations') != null && this.get('model.simulations.length') > 0) {
|
||||||
var simulations = this.get('model.simulations');
|
var simulations = this.get('model.simulations');
|
||||||
this.set('projectSimulation', simulations.toArray()[0]);
|
this.set('projectSimulation', simulations.toArray()[0]);
|
||||||
}
|
}
|
||||||
}.observes('model'),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
showNewModal() {
|
showNewModal() {
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default Ember.Controller.extend(FetchLiveDataMixin, {
|
||||||
simulatorName: null,
|
simulatorName: null,
|
||||||
signal: null,
|
signal: null,
|
||||||
|
|
||||||
_updateSimulators: function() {
|
_updateSimulators: Ember.observer('model', function() {
|
||||||
if (this.get('model.simulators') !== null && this.get('model.simulators.length') > 0) {
|
if (this.get('model.simulators') !== null && this.get('model.simulators.length') > 0) {
|
||||||
let simulators = this.get('model.simulators');
|
let simulators = this.get('model.simulators');
|
||||||
this.set('simulatorName', simulators.toArray()[0].get('name'));
|
this.set('simulatorName', simulators.toArray()[0].get('name'));
|
||||||
}
|
}
|
||||||
}.observes('model'),
|
}),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
addPlot(name) {
|
addPlot(name) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Ember from 'ember';
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
data: {},
|
data: {},
|
||||||
|
|
||||||
_getData: function() {
|
_getData: Ember.observer('model', function() {
|
||||||
// check if simulation is running
|
// check if simulation is running
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ export default Ember.Mixin.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}.observes('model'),
|
}),
|
||||||
|
|
||||||
_loadDataForSimulator(simulatorID) {
|
_loadDataForSimulator(simulatorID) {
|
||||||
// get data by simulator id
|
// get data by simulator id
|
||||||
|
|
|
@ -23,10 +23,10 @@ export default Model.extend({
|
||||||
|
|
||||||
_history: [],
|
_history: [],
|
||||||
|
|
||||||
_updateHistory: function() {
|
_updateHistory: Ember.observer('values', function() {
|
||||||
this._history.unshift(this.get('values'));
|
this._history.unshift(this.get('values'));
|
||||||
while (this._history.length > 5) {
|
while (this._history.length > 5) {
|
||||||
this._history.shift();
|
this._history.shift();
|
||||||
}
|
}
|
||||||
}.observes('values')
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,9 @@ module.exports = function(environment) {
|
||||||
FEATURES: {
|
FEATURES: {
|
||||||
// Here you can enable experimental features on an ember canary build
|
// Here you can enable experimental features on an ember canary build
|
||||||
// e.g. 'with-controller': true
|
// e.g. 'with-controller': true
|
||||||
|
},
|
||||||
|
EXTEND_PROTOTYPES: {
|
||||||
|
Date: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue