mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-30 00:00:13 +01:00
!!! Move complete project to ReactJS !!!
ATTENTION: The complete project is ported to ReactJS. Motivation: React (with flux) is much more flexible and performant in the use case of VILLASweb. Ember is a good framework, but it has many tradeoffs to its easy handling and feature completeness. Many work arounds had to be done to get ember to work the way needed. Because ReactJS gives the developer much more flexibility and feature choice, VILLASweb can be build much better. The aim is to only depends on needed packages and be as performance as possible. This new version still works with the current backend! For library usage see package.json. This first version contains the same base website as the old version but changed back to legacy color scheme. Simulators are loaded from and can be added to the backend as a proof-of-concept.
This commit is contained in:
parent
bc50ec11a6
commit
0cf1884192
250 changed files with 2330 additions and 7052 deletions
4
.bowerrc
4
.bowerrc
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"directory": "bower_components",
|
||||
"analytics": false
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.hbs]
|
||||
insert_final_newline = false
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
/**
|
||||
Ember CLI sends analytics information by default. The data is completely
|
||||
anonymous, but there are times when you might want to disable this behavior.
|
||||
|
||||
Setting `disableAnalytics` to true will prevent any data from being sent.
|
||||
*/
|
||||
"disableAnalytics": false
|
||||
}
|
21
.gitignore
vendored
21
.gitignore
vendored
|
@ -1,17 +1,18 @@
|
|||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist
|
||||
/tmp
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/bower_components
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
/.sass-cache
|
||||
/connect.lock
|
||||
/coverage/*
|
||||
/libpeerconnection.log
|
||||
.DS_Store
|
||||
.env
|
||||
npm-debug.log*
|
||||
testem.log
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
|
|
32
.jshintrc
32
.jshintrc
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"predef": [
|
||||
"document",
|
||||
"window",
|
||||
"-Promise"
|
||||
],
|
||||
"browser": true,
|
||||
"boss": true,
|
||||
"curly": true,
|
||||
"debug": false,
|
||||
"devel": true,
|
||||
"eqeqeq": true,
|
||||
"evil": true,
|
||||
"forin": false,
|
||||
"immed": false,
|
||||
"laxbreak": false,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"noempty": false,
|
||||
"nonew": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
"eqnull": true,
|
||||
"esversion": 6,
|
||||
"unused": true
|
||||
}
|
24
.travis.yml
24
.travis.yml
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4"
|
||||
|
||||
sudo: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.npm
|
||||
- $HOME/.cache # includes bowers cache
|
||||
|
||||
before_install:
|
||||
- npm config set spin false
|
||||
- npm install -g bower phantomjs-prebuilt
|
||||
- bower --version
|
||||
- phantomjs --version
|
||||
|
||||
install:
|
||||
- npm install
|
||||
- bower install
|
||||
|
||||
script:
|
||||
- npm test
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"ignore_dirs": ["tmp", "dist"]
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* File: application.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import RESTAdapter from 'ember-data/adapters/rest';
|
||||
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
|
||||
import ENV from '../config/environment';
|
||||
|
||||
export default RESTAdapter.extend(DataAdapterMixin, {
|
||||
host: 'http://' + ENV.APP.API_HOST,
|
||||
namespace: 'api/v1',
|
||||
authorizer: 'authorizer:custom',
|
||||
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
|
||||
|
||||
urlForQueryRecord(query /*, modelName */) {
|
||||
// Fix for /users/me query
|
||||
let baseUrl = this.buildURL();
|
||||
return baseUrl + '/users/' + query;
|
||||
}
|
||||
});
|
27
app/app.js
27
app/app.js
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* File: app.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Resolver from './resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
let App;
|
||||
|
||||
Ember.MODEL_FACTORY_INJECTIONS = true;
|
||||
|
||||
App = Ember.Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
export default App;
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* File: custom.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Base from 'ember-simple-auth/authenticators/base';
|
||||
import ENV from '../config/environment';
|
||||
|
||||
export default Base.extend({
|
||||
tokenEndpoint: 'http://' + ENV.APP.API_HOST + '/api/v1/authenticate',
|
||||
|
||||
restore(data) {
|
||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
||||
if (!Ember.isEmpty(data.token)) {
|
||||
resolve(data);
|
||||
} else {
|
||||
reject();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
authenticate(username, password) {
|
||||
return new Ember.RSVP.Promise((resolve, reject) => {
|
||||
Ember.$.ajax({
|
||||
url: this.tokenEndpoint,
|
||||
type: 'POST',
|
||||
data: JSON.stringify({
|
||||
username: username,
|
||||
password: password
|
||||
}),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json'
|
||||
}).then(function(response) {
|
||||
Ember.run(function() {
|
||||
resolve({
|
||||
token: response.token
|
||||
});
|
||||
});
|
||||
}, function(xhr) {
|
||||
var response = JSON.parse(xhr.responseText);
|
||||
Ember.run(function() {
|
||||
reject(response.message);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
invalidate() {
|
||||
console.log('invalidate...');
|
||||
return Ember.RSVP.resolve();
|
||||
}
|
||||
});
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* File: custom.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 04.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Base from 'ember-simple-auth/authorizers/base';
|
||||
|
||||
export default Base.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
|
||||
authorize(data, block) {
|
||||
if (this.get('session.isAuthenticated') && !Ember.isEmpty(data.token)) {
|
||||
block('x-access-token', data.token);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,41 +0,0 @@
|
|||
/**
|
||||
* File: draggable-dropzone.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
var { set } = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'div',
|
||||
classNames: [ 'draggableDropzone' ],
|
||||
classNameBindings: [ 'dragClass' ],
|
||||
dragClass: 'deactivated',
|
||||
|
||||
dragLeave(event) {
|
||||
event.preventDefault();
|
||||
set(this, 'dragClass', 'deactivated');
|
||||
},
|
||||
|
||||
dragOver(event) {
|
||||
event.preventDefault();
|
||||
set(this, 'dragClass', 'activated');
|
||||
},
|
||||
|
||||
drop(event) {
|
||||
var data = event.dataTransfer.getData('text/data');
|
||||
var position = {
|
||||
x: event.originalEvent.pageX - Ember.$(event.target).offset().left - parseFloat(event.dataTransfer.getData('offset/x')),
|
||||
y: event.originalEvent.pageY - Ember.$(event.target).offset().top - parseFloat(event.dataTransfer.getData('offset/y'))
|
||||
};
|
||||
|
||||
this.sendAction('dropped', data, position);
|
||||
|
||||
set(this, 'dragClass', 'deactivated');
|
||||
}
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* File: draggable-item.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
var { get } = Ember;
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: [ 'draggableItem' ],
|
||||
attributeBindings: [ 'draggable' ],
|
||||
draggable: 'true',
|
||||
|
||||
dragStart(event) {
|
||||
event.dataTransfer.setData('offset/x', event.originalEvent.pageX - Ember.$(event.target).offset().left);
|
||||
event.dataTransfer.setData('offset/y', event.originalEvent.pageY - Ember.$(event.target).offset().top);
|
||||
|
||||
return event.dataTransfer.setData('text/data', get(this, 'content'));
|
||||
}
|
||||
});
|
|
@ -1,27 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'div',
|
||||
classNames: [ 'flow-plot' ],
|
||||
attributeBindings: [ 'style' ],
|
||||
|
||||
plot: null,
|
||||
data: [],
|
||||
options: {},
|
||||
height: '85%',
|
||||
|
||||
setupPlot: Ember.on('didInsertElement', function() {
|
||||
var plot = Ember.$.plot('#' + this.get('element').id, this.get('data'), this.get('options'));
|
||||
this.set('plot', plot);
|
||||
}),
|
||||
|
||||
updateData: Ember.observer('data.@each', function() {
|
||||
// update plot
|
||||
var plot = Ember.$.plot('#' + this.get('element').id, this.get('data'), this.get('options'));
|
||||
this.set('plot', plot);
|
||||
}),
|
||||
|
||||
style: Ember.computed('height', function() {
|
||||
return Ember.String.htmlSafe("height: " + this.get('height') + ";");
|
||||
})
|
||||
});
|
|
@ -1,93 +0,0 @@
|
|||
/**
|
||||
* File: widget-abstract.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 15.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Resizable from '../mixins/resizable';
|
||||
import Draggable from '../mixins/draggable';
|
||||
|
||||
export default Ember.Component.extend(Resizable, Draggable, {
|
||||
tagName: 'div',
|
||||
classNames: [ 'widgetAbstract' ],
|
||||
classNameBindings: [ 'widgetEditing' ],
|
||||
attributeBindings: [ 'style' ],
|
||||
|
||||
widget: null,
|
||||
widgetEditing: true,
|
||||
editing: false,
|
||||
grid: false,
|
||||
data: null,
|
||||
|
||||
disabled_resize: false,
|
||||
autoHide_resize: true,
|
||||
grid_resize: [ 10, 10 ],
|
||||
|
||||
disabled_drag: false,
|
||||
containment_drag: 'parent',
|
||||
grid_drag: [ 10, 10 ],
|
||||
scroll_drag: true,
|
||||
|
||||
style: Ember.computed('widget', function() {
|
||||
return Ember.String.htmlSafe('width: ' + this.get('widget.width') + 'px; height: ' + this.get('widget.height') + 'px; left: ' + this.get('widget.x') + 'px; top: ' + this.get('widget.y') + 'px;');
|
||||
}),
|
||||
|
||||
name: Ember.computed('widget', function() {
|
||||
return this.get('widget.name');
|
||||
}),
|
||||
|
||||
stop_resize(event, ui) {
|
||||
var width = ui.size.width;
|
||||
var height = ui.size.height;
|
||||
|
||||
this.set('widget.width', width);
|
||||
this.set('widget.height', height);
|
||||
},
|
||||
|
||||
resize_resize(/* event, ui */) {
|
||||
|
||||
},
|
||||
|
||||
stop_drag(event, ui) {
|
||||
this.set('widget.x', ui.position.left);
|
||||
this.set('widget.y', ui.position.top);
|
||||
},
|
||||
|
||||
drag_drag(/* event, ui */) {
|
||||
|
||||
},
|
||||
|
||||
_updateUI: Ember.on('init', Ember.observer('editing', 'grid', 'isShowingModal', function() {
|
||||
if (this.get('editing') === true) {
|
||||
this.set('disabled_resize', false);
|
||||
//this.set('autoHide_resize', false);
|
||||
this.set('disabled_drag', false);
|
||||
|
||||
this.set('widgetEditing', true);
|
||||
} else {
|
||||
this.set('disabled_resize', true);
|
||||
//this.set('autoHide_resize', true);
|
||||
this.set('disabled_drag', true);
|
||||
|
||||
this.set('widgetEditing', false);
|
||||
}
|
||||
|
||||
if (this.get('grid') === true) {
|
||||
this.set('grid_resize', [ 10, 10 ]);
|
||||
this.set('grid_drag', [ 10, 10 ]);
|
||||
} else {
|
||||
this.set('grid_resize', false);
|
||||
this.set('grid_drag', false);
|
||||
}
|
||||
})),
|
||||
|
||||
/*doubleClick() {
|
||||
if (this.get('editing')) {
|
||||
this.sendAction('showPlotDialog', this.get('plot'));
|
||||
}
|
||||
}*/
|
||||
});
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* File: widget-container.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 05.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
tagName: 'div',
|
||||
classNames: [ 'widgets' ],
|
||||
attributeBindings: [ 'style' ],
|
||||
|
||||
widgets: null,
|
||||
editing: false,
|
||||
grid: false,
|
||||
data: null,
|
||||
|
||||
style: Ember.computed('widgets.@each.height', 'widgets.@each.y', function() {
|
||||
var height = this._calculateHeight();
|
||||
if (this.get('editing') === true && height < 400) {
|
||||
height = 400;
|
||||
}
|
||||
|
||||
return Ember.String.htmlSafe('height: ' + height + 'px;');
|
||||
}),
|
||||
|
||||
_calculateHeight() {
|
||||
var maxHeight = 0;
|
||||
var widgets = this.get('widgets');
|
||||
|
||||
widgets.forEach(function(widget) {
|
||||
var widgetHeight = widget.get('y') + widget.get('height');
|
||||
if (widgetHeight > maxHeight) {
|
||||
maxHeight = widgetHeight;
|
||||
}
|
||||
});
|
||||
|
||||
// add padding to height
|
||||
maxHeight += 40;
|
||||
|
||||
return maxHeight;
|
||||
},
|
||||
|
||||
actions: {
|
||||
showWidgetDialog(widget) {
|
||||
this.sendAction('showWidgetDialog', widget);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,105 +0,0 @@
|
|||
/**
|
||||
* File: widget-image.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 05.12.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import WidgetAbstract from './widget-abstract';
|
||||
import Ember from 'ember';
|
||||
import ENV from '../config/environment';
|
||||
import EmberUploader from 'ember-uploader';
|
||||
|
||||
const {
|
||||
inject: { service }
|
||||
} = Ember;
|
||||
|
||||
export default WidgetAbstract.extend({
|
||||
classNames: [ 'widgetImage' ],
|
||||
|
||||
session: service('session'),
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
store: service(),
|
||||
|
||||
url: 'http://' + ENV.APP.API_HOST,
|
||||
namespace: 'api/v1',
|
||||
|
||||
doubleClick() {
|
||||
if (this.get('editing') === true) {
|
||||
// prepare modal
|
||||
this.set('name', this.get('widget.name'));
|
||||
|
||||
// show modal
|
||||
this.set('isShowingModal', true);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitModal() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name');
|
||||
properties.widgetData = { path: this.get('image.path') };
|
||||
|
||||
this.get('widget').setProperties(properties);
|
||||
|
||||
let self = this;
|
||||
|
||||
this.get('widget').save().then(function() {
|
||||
self.set('isShowingModal', false);
|
||||
});
|
||||
},
|
||||
|
||||
cancelModal() {
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
selectImage(image) {
|
||||
// get image by path
|
||||
var self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('owner').then((user) => {
|
||||
user.get('files').then((files) => {
|
||||
files.forEach(function(file) {
|
||||
if (file.get('name') === image) {
|
||||
// set image
|
||||
self.set('image', file);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
upload() {
|
||||
// check if any files to upload
|
||||
let files = this.get('uploadFiles');
|
||||
|
||||
if (!Ember.isEmpty(files)) {
|
||||
var uploadURL = this.get('url') + '/' + this.get('namespace') + '/upload';
|
||||
|
||||
const uploader = EmberUploader.Uploader.create({
|
||||
multiple: true,
|
||||
url: uploadURL,
|
||||
ajaxSettings: {
|
||||
headers: {
|
||||
'x-access-token': this.get('session.data.authenticated.token')
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var self = this;
|
||||
|
||||
uploader.upload(files).then(function() {
|
||||
// reload user
|
||||
var user = self.get('sessionUser.user');
|
||||
self.get('store').findRecord('user', user.get('id'));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,60 +0,0 @@
|
|||
/**
|
||||
* File: widget-label.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 03.11.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import WidgetAbstract from './widget-abstract';
|
||||
|
||||
export default WidgetAbstract.extend({
|
||||
classNames: [ 'widgetLabel' ],
|
||||
|
||||
minWidth_resize: 50,
|
||||
minHeight_resize: 20,
|
||||
|
||||
doubleClick() {
|
||||
if (this.get('editing') === true) {
|
||||
// prepare modal
|
||||
this.set('name', this.get('widget.name'));
|
||||
this.set('errorMessage', null);
|
||||
|
||||
// show modal
|
||||
this.set('isShowingModal', true);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitModal() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name');
|
||||
|
||||
if (properties['name'] === null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Widget name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// save properties
|
||||
this.get('widget').setProperties(properties);
|
||||
|
||||
let self = this;
|
||||
|
||||
this.get('widget').save().then(function() {
|
||||
self.set('isShowingModal', false);
|
||||
});
|
||||
},
|
||||
|
||||
cancelModal() {
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
deleteModal() {
|
||||
// delete widget
|
||||
this.get('widget').destroyRecord();
|
||||
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
}
|
||||
});
|
|
@ -1,292 +0,0 @@
|
|||
/**
|
||||
* File: widget-value.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 08.12.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import WidgetAbstract from './widget-abstract';
|
||||
|
||||
export default WidgetAbstract.extend({
|
||||
classNames: [ 'widgetPlot' ],
|
||||
|
||||
plotData: Ember.A([]),
|
||||
|
||||
plotOptions: {
|
||||
series: {
|
||||
lines: {
|
||||
show: true,
|
||||
lineWidth: 2
|
||||
},
|
||||
shadowSize: 0
|
||||
},
|
||||
xaxis: {
|
||||
mode: 'time',
|
||||
timeformat: '%M:%S',
|
||||
axisLabel: 'time [min]',
|
||||
axisLabelUseCanvas: true
|
||||
}/*,
|
||||
yaxis: {
|
||||
tickDecimals: 1,
|
||||
axisLabel: this.data.get('type'),
|
||||
axisLabelUseCanvas: true
|
||||
}*/
|
||||
},
|
||||
|
||||
signals: Ember.A([]),
|
||||
checkedSignals: {},
|
||||
plotType: "multiple",
|
||||
time: null,
|
||||
observeQuery: null,
|
||||
selectedSignal: null,
|
||||
|
||||
_updateDataObserver: Ember.on('init', Ember.observer('widget.widgetData.simulator', 'widget.widgetData.type', 'widget.widgetData.signals', function() {
|
||||
// get query for observer
|
||||
let simulatorId = this.get('widget.widgetData.simulator');
|
||||
let query = 'data.' + simulatorId + '.sequence';
|
||||
|
||||
// get plot settings
|
||||
let signals = this.get('widget.widgetData.signals');
|
||||
this.set('signals', signals);
|
||||
|
||||
let plotType = this.get('widget.widgetData.type');
|
||||
this.set('plotType', plotType);
|
||||
|
||||
if (plotType === 'table') {
|
||||
// set simulation model for table with signals
|
||||
var self = this;
|
||||
let simulatorid = this.get('widget.widgetData.simulator');
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by simulatorid
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
if (simulator.get('simulatorid') === simulatorid) {
|
||||
// set simulation model
|
||||
self.set('simulationModel', simulationModel);
|
||||
|
||||
if (self.get('selectedSignal') === null) {
|
||||
self.set('selectedSignal', simulationModel.get('mapping')[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// update observer TODO: Only update when (query) changed
|
||||
let observeQuery = this.get('observeQuery');
|
||||
if (query !== observeQuery) {
|
||||
if (observeQuery != null) {
|
||||
this.removeObserver(observeQuery, this._updateData);
|
||||
}
|
||||
|
||||
this.addObserver(query, this._updateData);
|
||||
this.set('observeQuery', query);
|
||||
}
|
||||
})),
|
||||
|
||||
_updateData() {
|
||||
// get values from array
|
||||
let simulatorId = this.get('widget.widgetData.simulator');
|
||||
let values = this.get('data.' + simulatorId + '.flotValues');
|
||||
var updatedValues = Ember.A([]);
|
||||
|
||||
// update plot options
|
||||
var plotOptions = this.get('plotOptions');
|
||||
|
||||
// calculate diff for first and last timestamp
|
||||
var firstTimestamp = values[0][0][0];
|
||||
var lastTimestamp = values[0][values[0].length - 1][0];
|
||||
|
||||
var diff = lastTimestamp - firstTimestamp;
|
||||
var diffValue = this.get('widget.widgetData.time') * 1000; // javascript timestamps are in milliseconds
|
||||
|
||||
if (diff > diffValue) {
|
||||
firstTimestamp = lastTimestamp - diffValue;
|
||||
} else {
|
||||
lastTimestamp = firstTimestamp + diffValue;
|
||||
}
|
||||
|
||||
plotOptions.xaxis.min = firstTimestamp;
|
||||
plotOptions.xaxis.max = lastTimestamp;
|
||||
this.set('plotOptions', plotOptions);
|
||||
|
||||
// update values
|
||||
var index = 0;
|
||||
|
||||
this.get('signals').forEach(function(signal) {
|
||||
updatedValues.replace(index, 1, Ember.A([ values[signal] ]));
|
||||
index += 1;
|
||||
});
|
||||
|
||||
this.set('plotData', updatedValues);
|
||||
},
|
||||
|
||||
doubleClick() {
|
||||
if (this.get('editing') === true) {
|
||||
// prepare modal
|
||||
this.set('name', this.get('widget.name'));
|
||||
this.set('plotType', this.get('widget.widgetData.type'));
|
||||
this.set('time', this.get('widget.widgetData.time'));
|
||||
this.set('errorMessage', null);
|
||||
|
||||
// get signal mapping for simulation model
|
||||
let self = this;
|
||||
let simulatorid = this.get('widget.widgetData.simulator');
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by simulatorid
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
if (simulator.get('simulatorid') === simulatorid) {
|
||||
// set simulation model
|
||||
self.set('simulationModel', simulationModel);
|
||||
self.set('simulationModelName', simulationModel.get('name'));
|
||||
|
||||
// set signals
|
||||
let mapping = simulationModel.get('mapping');
|
||||
let checkedSignals = {};
|
||||
|
||||
// uncheck all signals
|
||||
mapping.forEach(function(key) {
|
||||
checkedSignals[key] = false;
|
||||
});
|
||||
|
||||
self.get('signals').forEach(function(signal) {
|
||||
checkedSignals[mapping[signal]] = true;
|
||||
});
|
||||
|
||||
self.set('checkedSignals', checkedSignals);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// show modal
|
||||
this.set('isShowingModal', true);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitModal() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name');
|
||||
|
||||
// set simulator by simulation model name
|
||||
let simulationModelName = this.get('simulationModelName');
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by name
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
if (simulationModel.get('name') === simulationModelName) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
// set simulator
|
||||
let widgetData = {
|
||||
type: self.get('plotType')
|
||||
};
|
||||
|
||||
widgetData.simulator = simulator.get('simulatorid');
|
||||
widgetData.time = self.get('time');
|
||||
|
||||
// set signals
|
||||
let mapping = simulationModel.get('mapping');
|
||||
widgetData.signals = [];
|
||||
|
||||
// uncheck all signals
|
||||
let checkedSignals = self.get('checkedSignals');
|
||||
|
||||
for (var i = 0; i < mapping.length; i++) {
|
||||
if (checkedSignals[mapping[i]]) {
|
||||
widgetData.signals.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
// save properties
|
||||
properties['widgetData'] = widgetData;
|
||||
|
||||
self.get('widget').setProperties(properties);
|
||||
|
||||
self.get('widget').save().then(function() {
|
||||
self.set('isShowingModal', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancelModal() {
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
deleteModal() {
|
||||
// delete widget
|
||||
this.get('widget').destroyRecord();
|
||||
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
selectSimulationModel(simulationModelName) {
|
||||
// save simulation model
|
||||
this.set('simulationModelName', simulationModelName);
|
||||
|
||||
// get signal mapping for simulation model
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by name
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
if (simulationModel.get('name') === simulationModelName) {
|
||||
self.set('simulationModel', simulationModel);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
selectType(type) {
|
||||
this.set('plotType', type);
|
||||
},
|
||||
|
||||
selectTableSignal(signal) {
|
||||
// display signal
|
||||
let mapping = this.get('simulationModel.mapping');
|
||||
|
||||
for (var i = 0; i < mapping.length; i++) {
|
||||
if (mapping[i] === signal) {
|
||||
this.set('widget.widgetData.signals', [ i ]);
|
||||
}
|
||||
}
|
||||
|
||||
this.set('selectedSignal', signal);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,170 +0,0 @@
|
|||
/**
|
||||
* File: widget-table.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 05.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import WidgetAbstract from './widget-abstract';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default WidgetAbstract.extend({
|
||||
classNames: [ 'widgetTable' ],
|
||||
|
||||
minWidth_resize: 200,
|
||||
minHeight_resize: 60,
|
||||
|
||||
signals: [],
|
||||
|
||||
observeQuery: null,
|
||||
|
||||
_updateDataObserver: Ember.on('init', Ember.observer('widget.widgetData.simulator', function() {
|
||||
// get query for observer
|
||||
let simulatorId = this.get('widget.widgetData.simulator');
|
||||
let query = 'data.' + simulatorId + '.sequence';
|
||||
let observeQuery = this.get('observeQuery');
|
||||
if (observeQuery != null) {
|
||||
this.removeObserver(observeQuery, this._updateData);
|
||||
}
|
||||
|
||||
this.addObserver(query, this._updateData);
|
||||
this.set('observeQuery', query);
|
||||
|
||||
// get signal names
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// get simulation model by simulatorId
|
||||
simulationModels.forEach((simulationModel) => {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
if (simulator.get('simulatorid') === simulatorId) {
|
||||
// set signal names
|
||||
let signals = [];
|
||||
|
||||
simulationModel.get('mapping').forEach((signalName) => {
|
||||
signals.push({ name: signalName, value: null });
|
||||
});
|
||||
|
||||
self.set('signals', signals);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
})),
|
||||
|
||||
_updateData() {
|
||||
// get signal names to fill data in
|
||||
let signals = this.get('signals');
|
||||
if (!signals) {
|
||||
// wait till names are loaded
|
||||
return;
|
||||
}
|
||||
|
||||
// get values from array
|
||||
let values = this.get('data.' + this.get('widget.widgetData.simulator') + '.values');
|
||||
for (let i = 0; i < values.length; i++) {
|
||||
if (!signals[i]) {
|
||||
break;
|
||||
}
|
||||
|
||||
Ember.set(signals[i], 'value', values[i]);
|
||||
}
|
||||
},
|
||||
|
||||
doubleClick() {
|
||||
if (this.get('editing') === true) {
|
||||
// prepare modal
|
||||
this.set('name', this.get('widget.name'));
|
||||
this.set('errorMessage', null);
|
||||
|
||||
// get simlator name from id
|
||||
let self = this;
|
||||
let simulatorid = this.get('widget.widgetData.simulator');
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by simulatorid
|
||||
simulationModels.forEach((simulationModel) => {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
if (simulator.get('simulatorid') === simulatorid) {
|
||||
// set simulation model
|
||||
self.set('simulationModel', simulationModel);
|
||||
self.set('simulationModelName', simulationModel.get('name'));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// show modal
|
||||
this.set('isShowingModal', true);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitModal() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name');
|
||||
|
||||
// set simulator by simulation model name
|
||||
let simulationModelName = this.get('simulationModelName');
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by name
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
if (simulationModel.get('name') === simulationModelName) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
// set simulator
|
||||
let widgetData = {};
|
||||
widgetData.simulator = simulator.get('simulatorid');
|
||||
|
||||
// save properties
|
||||
properties['widgetData'] = widgetData;
|
||||
|
||||
self.get('widget').setProperties(properties);
|
||||
|
||||
self.get('widget').save().then(function() {
|
||||
self.set('isShowingModal', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancelModal() {
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
deleteModal() {
|
||||
// delete widget
|
||||
this.get('widget').destroyRecord();
|
||||
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
selectSimulationModel(simulationModelName) {
|
||||
// save simulation model
|
||||
this.set('simulationModelName', simulationModelName);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,167 +0,0 @@
|
|||
/**
|
||||
* File: widget-value.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 04.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import WidgetAbstract from './widget-abstract';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default WidgetAbstract.extend({
|
||||
classNames: [ 'widgetValue' ],
|
||||
|
||||
minWidth_resize: 50,
|
||||
minHeight_resize: 20,
|
||||
|
||||
observeQuery: null,
|
||||
|
||||
_updateDataObserver: Ember.on('init', Ember.observer('widget.widgetData.simulator', 'widget.widgetData.signal', function() {
|
||||
// update observer
|
||||
let query = 'data.' + this.get('widget.widgetData.simulator') + '.sequence';
|
||||
let observeQuery = this.get('observeQuery');
|
||||
if (observeQuery != null) {
|
||||
this.removeObserver(observeQuery, this._updateData);
|
||||
}
|
||||
|
||||
this.addObserver(query, this._updateData);
|
||||
this.set('observeQuery', query);
|
||||
})),
|
||||
|
||||
_updateData() {
|
||||
// get value from array
|
||||
let values = this.get('data.' + this.get('widget.widgetData.simulator') + '.values');
|
||||
if (values) {
|
||||
this.set('value', values[this.get('widget.widgetData.signal')]);
|
||||
} else {
|
||||
this.set('value', null);
|
||||
}
|
||||
},
|
||||
|
||||
doubleClick() {
|
||||
if (this.get('editing') === true) {
|
||||
// prepare modal
|
||||
this.set('name', this.get('widget.name'));
|
||||
this.set('errorMessage', null);
|
||||
|
||||
// get signal mapping for simulation model
|
||||
let self = this;
|
||||
let simulatorid = this.get('widget.widgetData.simulator');
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by simulatorid
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
if (simulator.get('simulatorid') === simulatorid) {
|
||||
// set simulation model
|
||||
self.set('simulationModel', simulationModel);
|
||||
self.set('simulationModelName', simulationModel.get('name'));
|
||||
|
||||
// set signal
|
||||
let mapping = simulationModel.get('mapping');
|
||||
self.set('signalName', mapping[self.get('widget.widgetData.signal')]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// show modal
|
||||
this.set('isShowingModal', true);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
submitModal() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name');
|
||||
|
||||
// set simulator by simulation model name
|
||||
let simulationModelName = this.get('simulationModelName');
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by name
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
if (simulationModel.get('name') === simulationModelName) {
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
// set simulator
|
||||
let widgetData = {};
|
||||
widgetData.simulator = simulator.get('simulatorid');
|
||||
|
||||
// set signal by name
|
||||
let mapping = simulationModel.get('mapping');
|
||||
let signalName = self.get('signalName');
|
||||
|
||||
for (let i = 0; i < mapping.length; i++) {
|
||||
if (mapping[i] === signalName) {
|
||||
widgetData.signal = i;
|
||||
}
|
||||
}
|
||||
|
||||
// save properties
|
||||
properties['widgetData'] = widgetData;
|
||||
|
||||
self.get('widget').setProperties(properties);
|
||||
|
||||
self.get('widget').save().then(function() {
|
||||
self.set('isShowingModal', false);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
cancelModal() {
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
deleteModal() {
|
||||
// delete widget
|
||||
this.get('widget').destroyRecord();
|
||||
|
||||
this.set('isShowingModal', false);
|
||||
},
|
||||
|
||||
selectSimulationModel(simulationModelName) {
|
||||
// save simulation model
|
||||
this.set('simulationModelName', simulationModelName);
|
||||
|
||||
// get signal mapping for simulation model
|
||||
let self = this;
|
||||
|
||||
this.get('widget.visualization').then((visualization) => {
|
||||
visualization.get('project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
// find simulation model by name
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
if (simulationModel.get('name') === simulationModelName) {
|
||||
self.set('simulationModel', simulationModel);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
selectSignal(signalName) {
|
||||
this.set('signalName', signalName);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* File: login.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
|
||||
actions: {
|
||||
authenticate() {
|
||||
let { username, password } = this.getProperties('username', 'password');
|
||||
this.get('session').authenticate('authenticator:custom', username, password).catch((reason) => {
|
||||
this.set('errorMessage', reason);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* File: me.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
isAdmin: Ember.computed('model', function() {
|
||||
var level = this.get('model.adminLevel');
|
||||
return level >= 1;
|
||||
}),
|
||||
|
||||
actions: {
|
||||
changeUser() {
|
||||
// save the changes
|
||||
var user = this.get('model');
|
||||
user.save();
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,116 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
isShowingNewModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
visualization: null,
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('name', null);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingNewModal', true);
|
||||
},
|
||||
|
||||
showEditModal(visualization) {
|
||||
// set properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('visualization', visualization);
|
||||
this.set('name', visualization.get('name'));
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingEditModal', true);
|
||||
},
|
||||
|
||||
showDeleteModal(visualization) {
|
||||
// set properties
|
||||
this.set('visualization', visualization);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingDeleteModal', true);
|
||||
},
|
||||
|
||||
submitNew() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Visualization name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set project property
|
||||
properties['project'] = this.get('model.id');
|
||||
|
||||
// create new project
|
||||
var visualization = this.store.createRecord('visualization', properties);
|
||||
var controller = this;
|
||||
|
||||
// this change will not be saved, but it is nessecary otherwise ember will omit the project's id in the post request
|
||||
var project = this.get('model');
|
||||
project.get('visualizations').pushObject(visualization);
|
||||
|
||||
visualization.save().then(function() {
|
||||
controller.set('isShowingNewModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new visualization');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNew() {
|
||||
this.set('isShowingNewModal', false);
|
||||
},
|
||||
|
||||
submitEdit() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Visualization name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// save properties
|
||||
this.get('visualization').setProperties(properties);
|
||||
|
||||
var controller = this;
|
||||
|
||||
this.get('visualization').save().then(function() {
|
||||
controller.set('isShowingEditModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving edit visualization');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.set('isShowingEditModal', false);
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete the visualization
|
||||
var visualization = this.get('visualization');
|
||||
visualization.destroyRecord();
|
||||
|
||||
// hide the dialog
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
cancelDelete() {
|
||||
this.set('isShowingDeleteModal', false);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,151 +0,0 @@
|
|||
/**
|
||||
* File: projects.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 01.10.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
isShowingNewModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
project: null,
|
||||
projectSimulation: null,
|
||||
|
||||
_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]);
|
||||
}
|
||||
}),
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('name', null);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingNewModal', true);
|
||||
},
|
||||
|
||||
showEditModal(project) {
|
||||
// set properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('project', project);
|
||||
this.set('name', project.get('name'));
|
||||
this.set('projectSimulation', project.get('simulation'));
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingEditModal', true);
|
||||
},
|
||||
|
||||
showDeleteModal(project) {
|
||||
// set properties
|
||||
this.set('project', project);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingDeleteModal', true);
|
||||
},
|
||||
|
||||
submitNew() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Project name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set owner property
|
||||
var user = this.get('sessionUser.user');
|
||||
properties['owner'] = user;
|
||||
|
||||
// set simulation property
|
||||
properties['simulation'] = this.get('projectSimulation.id');
|
||||
|
||||
// create new project
|
||||
var project = this.store.createRecord('project', properties);
|
||||
|
||||
// this change will not be saved, but it is nessecary otherwise ember will omit the simulation's id in the post request
|
||||
this.get('projectSimulation.projects').pushObject(project);
|
||||
|
||||
var controller = this;
|
||||
|
||||
project.save().then(function() {
|
||||
controller.set('isShowingNewModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new project');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNew() {
|
||||
this.set('isShowingNewModal', false);
|
||||
},
|
||||
|
||||
submitEdit() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Project name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// remove from old simulation
|
||||
|
||||
|
||||
// save properties
|
||||
properties['simulation'] = this.get('projectSimulation.id');
|
||||
|
||||
this.get('project').setProperties(properties);
|
||||
|
||||
// this change will not be saved, but it is nessecary otherwise ember will omit the simulation's id in the post request
|
||||
this.get('projectSimulation.projects').pushObject(this.get('project'));
|
||||
|
||||
var controller = this;
|
||||
|
||||
this.get('project').save().then(function() {
|
||||
controller.set('isShowingEditModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving edit project');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.set('isShowingEditModal', false);
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete the project
|
||||
var project = this.get('project');
|
||||
project.destroyRecord();
|
||||
|
||||
// hide the dialog
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
cancelDelete() {
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
selectSimulation(simulationName) {
|
||||
// get simulation by name
|
||||
var simulations = this.get('model.simulations');
|
||||
var controller = this;
|
||||
|
||||
simulations.forEach(function(simulation) {
|
||||
if (simulation.get('name') === simulationName) {
|
||||
controller.set('projectSimulation', simulation);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,48 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
_setSignalNames: Ember.observer('model', 'model.length', function() {
|
||||
// loop through signals
|
||||
let length = this.get('model.length');
|
||||
let mapping = this.get('model.mapping');
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
this.set('name' + i, mapping[i]);
|
||||
}
|
||||
}),
|
||||
|
||||
actions: {
|
||||
saveMapping() {
|
||||
// save all signal names
|
||||
let length = this.get('model.length');
|
||||
let mapping = this.get('model.mapping');
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
mapping[i] = this.get('name' + i);
|
||||
}
|
||||
|
||||
this.set('model.mapping', mapping);
|
||||
|
||||
// save the changed model
|
||||
let self = this;
|
||||
|
||||
this.get('model').save().then(function() {
|
||||
// go back to simulation
|
||||
self.get('model.simulation').then((simulation) => {
|
||||
self.transitionToRoute('/simulation/' + simulation.get('id'));
|
||||
});
|
||||
}, function() {
|
||||
Ember.debug('Unable to save simulation model');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,193 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 30.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
isShowingNewModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
simulationModel: null,
|
||||
simulatorName: null,
|
||||
|
||||
_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'));
|
||||
}
|
||||
}),
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('name', null);
|
||||
this.set('length', 1);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingNewModal', true);
|
||||
},
|
||||
|
||||
showEditModal(simulationModel) {
|
||||
// set properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('simulationModel', simulationModel);
|
||||
this.set('name', simulationModel.get('name'));
|
||||
this.set('length', simulationModel.get('length'));
|
||||
|
||||
let simulators = this.get('model.simulators');
|
||||
let simulatorId = simulationModel.get('simulator.id');
|
||||
let simulatorName = null;
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('id') === simulatorId) {
|
||||
simulatorName = simulator.get('name');
|
||||
}
|
||||
});
|
||||
|
||||
this.set('simulatorName', simulatorName);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingEditModal', true);
|
||||
},
|
||||
|
||||
showDeleteModal(simulationModel) {
|
||||
// set properties
|
||||
this.set('simulationModel', simulationModel);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingDeleteModal', true);
|
||||
},
|
||||
|
||||
submitNew() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name', 'length');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Simulation model name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set simuatlion properties
|
||||
let simulation = this.get('model.simulation');
|
||||
properties['simulation'] = simulation;
|
||||
|
||||
// get the simulator by simulator name
|
||||
let simulators = this.get('model.simulators');
|
||||
let simulatorName = this.get('simulatorName');
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('name') === simulatorName) {
|
||||
properties['simulator'] = simulator;
|
||||
}
|
||||
});
|
||||
|
||||
// create mapping
|
||||
let mapping = [];
|
||||
|
||||
for (let i = 0; i < properties['length']; i++) {
|
||||
mapping.push('Signal ' + (i + 1));
|
||||
}
|
||||
|
||||
properties['mapping'] = mapping;
|
||||
|
||||
// create new model
|
||||
let simulationModel = this.store.createRecord('simulation-model', properties);
|
||||
|
||||
// this change will not be saved, but it is nessecary otherwise ember will omit the simulation's id in the post request
|
||||
simulation.get('models').pushObject(simulationModel);
|
||||
|
||||
let controller = this;
|
||||
|
||||
simulationModel.save().then(function() {
|
||||
controller.set('isShowingNewModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new model');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNew() {
|
||||
this.set('isShowingNewModal', false);
|
||||
},
|
||||
|
||||
submitEdit() {
|
||||
// verify properties
|
||||
let properties = this.getProperties('name', 'length');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Simulation model name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set simuatlion properties
|
||||
let simulation = this.get('model.simulation');
|
||||
properties['simulation'] = simulation;
|
||||
|
||||
// get the simulator by simulator name
|
||||
let simulators = this.get('model.simulators');
|
||||
let simulatorName = this.get('simulatorName');
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('name') === simulatorName) {
|
||||
properties['simulator'] = simulator;
|
||||
}
|
||||
});
|
||||
|
||||
// change mapping
|
||||
let mapping = this.get('simulationModel.mapping');
|
||||
|
||||
if (mapping.length < properties['length']) {
|
||||
// add more signals
|
||||
for (let i = mapping.length; i < properties['length']; i++) {
|
||||
mapping.push('Signal ' + (i + 1));
|
||||
}
|
||||
} else if (mapping.length > properties['length']) {
|
||||
// remove signals
|
||||
mapping = mapping.slice(0, Number(properties['length']));
|
||||
}
|
||||
|
||||
console.log(mapping);
|
||||
|
||||
properties['mapping'] = mapping;
|
||||
|
||||
// save properties
|
||||
let controller = this;
|
||||
|
||||
this.get('simulationModel').setProperties(properties);
|
||||
|
||||
this.get('simulationModel').save().then(function() {
|
||||
controller.set('isShowingEditModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving edit simulation model');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.set('isShowingEditModal', false);
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete the model
|
||||
let simulationModel = this.get('simulationModel');
|
||||
simulationModel.destroyRecord();
|
||||
|
||||
// hide the dialog
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
cancelDelete() {
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
selectSimulator(simulator) {
|
||||
this.set('simulatorName', simulator);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,153 +0,0 @@
|
|||
/**
|
||||
* File: simulation.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 30.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
isShowingNewModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
simulation: null,
|
||||
simulationRunning: true,
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('name', null);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingNewModal', true);
|
||||
},
|
||||
|
||||
showEditModal(simulation) {
|
||||
// set properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('simulation', simulation);
|
||||
this.set('name', simulation.get('name'));
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingEditModal', true);
|
||||
},
|
||||
|
||||
showDeleteModal(simulation) {
|
||||
// set properties
|
||||
this.set('simulation', simulation);
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingDeleteModal', true);
|
||||
},
|
||||
|
||||
showRunningModal(simulation) {
|
||||
// set properties
|
||||
this.set('simulation', simulation);
|
||||
this.set('simulationRunning', simulation.get('running'));
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingRunningModal', true);
|
||||
},
|
||||
|
||||
submitNew() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Simulation name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set owner properties
|
||||
var user = this.get('sessionUser.user');
|
||||
properties['owner'] = user;
|
||||
|
||||
// create new simulation
|
||||
var simulation = this.store.createRecord('simulation', properties);
|
||||
var controller = this;
|
||||
|
||||
simulation.save().then(function() {
|
||||
controller.set('isShowingNewModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new simulation');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNew() {
|
||||
this.set('isShowingNewModal', false);
|
||||
},
|
||||
|
||||
submitEdit() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] === "") {
|
||||
this.set('errorMessage', 'Simulation name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// save properties
|
||||
this.get('simulation').set('name', properties['name']);
|
||||
|
||||
var controller = this;
|
||||
|
||||
this.get('simulation').save().then(function() {
|
||||
controller.set('isShowingEditModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving edit simulation');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.set('isShowingEditModal', false);
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete the simulation
|
||||
var simulation = this.get('simulation');
|
||||
simulation.destroyRecord();
|
||||
|
||||
// hide the dialog
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
cancelDelete() {
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
confirmRunningSimulation() {
|
||||
// set the property
|
||||
var simulation = this.get('simulation');
|
||||
simulation.set('running', this.get('simulationRunning'));
|
||||
|
||||
// save property
|
||||
var controller = this;
|
||||
|
||||
simulation.save().then(function() {
|
||||
controller.set('isShowingRunningModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving running simulation');
|
||||
});
|
||||
},
|
||||
|
||||
cancelRunningSimulation() {
|
||||
this.set('isShowingRunningModal', false);
|
||||
},
|
||||
|
||||
selectRunning(running) {
|
||||
// NOTE: running is a string and not a boolean value
|
||||
if (running === 'true') {
|
||||
this.set('simulationRunning', true);
|
||||
} else {
|
||||
this.set('simulationRunning', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,158 +0,0 @@
|
|||
/**
|
||||
* File: simulators.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 30.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
isShowingNewModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingRunningModal: false,
|
||||
|
||||
simulatorid: 1,
|
||||
errorMessage: null,
|
||||
simulator: null,
|
||||
simulatorName: null,
|
||||
simulatorEdit: null,
|
||||
simulatorRunning: true,
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset the properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('simulatorid', 1);
|
||||
this.set('name', null);
|
||||
this.set('endpoint', null);
|
||||
|
||||
// show the modal dialog
|
||||
this.set('isShowingNewModal', true);
|
||||
},
|
||||
|
||||
showDeleteModal(simulator) {
|
||||
this.set('isShowingDeleteModal', true);
|
||||
this.set('simulator', simulator);
|
||||
},
|
||||
|
||||
showEditModal(simulator) {
|
||||
// set properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('simulator', simulator);
|
||||
this.set('simulatorid', simulator.get('simulatorid'));
|
||||
this.set('simulatorName', simulator.get('name'));
|
||||
this.set('simulatorEndpoint', simulator.get('endpoint'));
|
||||
|
||||
// show the modal dialog
|
||||
this.set('isShowingEditModal', true);
|
||||
},
|
||||
|
||||
showRunningModal(simulator) {
|
||||
// set properties
|
||||
this.set('simulator', simulator);
|
||||
this.set('simulatorRunning', simulator.get('running'));
|
||||
|
||||
// show the dialog
|
||||
this.set('isShowingRunningModal', true);
|
||||
},
|
||||
|
||||
newSimulator() {
|
||||
// verify properties
|
||||
var properties = this.getProperties('name', 'simulatorid', 'endpoint');
|
||||
if (properties['name'] == null) {
|
||||
this.set('errorMessage', 'Simulator name is missing');
|
||||
return;
|
||||
} else if (properties['endpoint'] == null) {
|
||||
this.set('errorMessage', 'Simulator endpoint is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// create new simulator from properties
|
||||
var simulator = this.store.createRecord('simulator', properties);
|
||||
var controller = this;
|
||||
|
||||
simulator.save().then(function() {
|
||||
controller.set('isShowingNewModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new simulator');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNewSimulator() {
|
||||
this.set('isShowingNewModal', false);
|
||||
},
|
||||
|
||||
cancelDeleteSimulator() {
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
confirmDeleteSimulator() {
|
||||
// delete the simulator
|
||||
var simulator = this.get('simulator');
|
||||
simulator.destroyRecord();
|
||||
|
||||
// hide the modal dialog
|
||||
this.set('isShowingDeleteModal', false);
|
||||
},
|
||||
|
||||
editSimulator() {
|
||||
// verify new properties
|
||||
if (this.get('simulatorName') == null) {
|
||||
this.set('errorMessage', 'Simulator name is missing');
|
||||
return;
|
||||
} else if (this.get('simulatorEndpoint') == null) {
|
||||
this.set('errorMessage', 'Simulator endpoint is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// save property changes
|
||||
this.get('simulator').set('name', this.get('simulatorName'));
|
||||
this.get('simulator').set('simulatorid', this.get('simulatorid'));
|
||||
this.get('simulator').set('endpoint', this.get('simulatorEndpoint'));
|
||||
|
||||
var controller = this;
|
||||
|
||||
this.get('simulator').save().then(function() {
|
||||
controller.set('isShowingEditModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving edit simulator');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEditSimulator() {
|
||||
this.set('isShowingEditModal', false);
|
||||
},
|
||||
|
||||
confirmRunningSimulation() {
|
||||
// set the property
|
||||
var simulator = this.get('simulator');
|
||||
simulator.set('running', this.get('simulatorRunning'));
|
||||
|
||||
// save property
|
||||
var controller = this;
|
||||
|
||||
simulator.save().then(function() {
|
||||
controller.set('isShowingRunningModal', false);
|
||||
}, function() {
|
||||
Ember.debug('Error saving running simulator');
|
||||
});
|
||||
},
|
||||
|
||||
cancelRunningSimulation() {
|
||||
this.set('isShowingRunningModal', false);
|
||||
},
|
||||
|
||||
selectRunning(running) {
|
||||
// NOTE: running is a string and not a boolean value
|
||||
if (running === 'true') {
|
||||
this.set('simulatorRunning', true);
|
||||
} else {
|
||||
this.set('simulatorRunning', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* File: delete.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
actions: {
|
||||
cancelDelete() {
|
||||
this.transitionToRoute('/user/');
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete all projects
|
||||
var user = this.get('model');
|
||||
user.destroyRecord();
|
||||
|
||||
this.transitionToRoute('/user/');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* File: edit.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
saveEdit() {
|
||||
// save the changes
|
||||
var user = this.get('model');
|
||||
var controller = this;
|
||||
|
||||
user.save().then(function() {
|
||||
controller.transitionToRoute('/user/');
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
this.transitionToRoute('/user/');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
users: Ember.computed('model.@each', function() {
|
||||
var filteredUsers = this.get('model');
|
||||
filteredUsers.forEach(function(user) {
|
||||
// catch undefined user
|
||||
if (user) {
|
||||
if (user.get('id') === 'me') {
|
||||
filteredUsers.removeObject(user);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return filteredUsers;
|
||||
})
|
||||
});
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* File: new.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
newUser() {
|
||||
// create new user from properties
|
||||
var properties = this.getProperties('username', 'password');
|
||||
|
||||
var user = this.store.createRecord('user', properties);
|
||||
var controller = this;
|
||||
|
||||
user.save().then(function() {
|
||||
controller.transitionToRoute('/user');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNewUser() {
|
||||
this.transitionToRoute('/user');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,137 +0,0 @@
|
|||
/**
|
||||
* File: edit.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 05.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import FetchLiveDataMixin from '../../mixins/fetch-live-data';
|
||||
|
||||
export default Ember.Controller.extend(FetchLiveDataMixin, {
|
||||
isShowingWidgetValueModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
widget: null,
|
||||
name: null,
|
||||
simulator: null,
|
||||
simulatorName: null,
|
||||
signal: null,
|
||||
|
||||
actions: {
|
||||
addWidget(name, position) {
|
||||
// get first simulator id
|
||||
let defaultSimulatorid = 0;
|
||||
|
||||
this.get('model.project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
simulationModels.toArray()[0].get('simulator').then((simulator) => {
|
||||
defaultSimulatorid = simulator.get('simulatorid');
|
||||
|
||||
// create widget
|
||||
let widget = null;
|
||||
let properties = {
|
||||
x: position.x,
|
||||
y: position.y,
|
||||
name: 'widget',
|
||||
type: null
|
||||
};
|
||||
|
||||
if (name === 'label') {
|
||||
properties.type = 'widget-label';
|
||||
properties.width = 100;
|
||||
properties.height = 20;
|
||||
properties.name = 'Label';
|
||||
} else if (name === 'table') {
|
||||
properties.type = 'widget-table';
|
||||
properties.name = "Table";
|
||||
properties.width = 500;
|
||||
properties.height = 200;
|
||||
properties.widgetData = { simulator: defaultSimulatorid };
|
||||
} else if (name === 'value') {
|
||||
properties.type = 'widget-value';
|
||||
properties.name = 'Value';
|
||||
properties.width = 250;
|
||||
properties.height = 20;
|
||||
properties.widgetData = { signal: 0, simulator: defaultSimulatorid };
|
||||
} else if (name === 'plot') {
|
||||
properties.type = 'widget-plot';
|
||||
properties.name = 'Plot';
|
||||
properties.width = 500;
|
||||
properties.height = 400;
|
||||
properties.widgetData = { signals: [0], simulator: defaultSimulatorid, type: 'multiple', time: 300 };
|
||||
} else if (name === 'image') {
|
||||
properties.type = 'widget-image';
|
||||
properties.name = 'Image';
|
||||
properties.width = 300;
|
||||
properties.height = 300;
|
||||
properties.widgetData = { path: null };
|
||||
} else {
|
||||
// DEBUG
|
||||
console.log('Add unknown widget ' + name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (properties.type != null) {
|
||||
// create widget
|
||||
widget = this.store.createRecord('widget', properties);
|
||||
|
||||
// add widget to visualization
|
||||
this.get('model.widgets').pushObject(widget);
|
||||
|
||||
// save new widget
|
||||
var visualization = this.get('model');
|
||||
|
||||
widget.save().then(function() {
|
||||
// save the widget in the visualization
|
||||
visualization.get('widgets').pushObject(widget);
|
||||
visualization.save();
|
||||
});
|
||||
} else {
|
||||
console.error('Unknown widget type: ' + name);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
saveEdit() {
|
||||
// save changes to store
|
||||
var widgets = this.get('model.widgets');
|
||||
widgets.forEach(function(widget) {
|
||||
widget.save();
|
||||
});
|
||||
|
||||
// go back to index
|
||||
var id = this.get('model.id');
|
||||
this.transitionToRoute('/visualization/' + id);
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
// TODO: revert changes
|
||||
|
||||
let id = this.get('model.id');
|
||||
this.transitionToRoute('/visualization/' + id);
|
||||
},
|
||||
|
||||
showWidgetDialog(widget) {
|
||||
// show dialog by widget type
|
||||
let widgetType = widget.get('type');
|
||||
if (widgetType === 'value') {
|
||||
// set properties
|
||||
this.set('widget', widget);
|
||||
/*this.set('name', plot.get('name'));
|
||||
this.set('signal', plot.get('signal'));*/
|
||||
|
||||
//this.set('simulatorName', simulatorName);
|
||||
|
||||
this.set('isShowingWidgetValueModal', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>VillaswebFrontend</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for "head"}}
|
||||
|
||||
<link rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
||||
<link rel="stylesheet" href="{{rootURL}}assets/villasweb-frontend.css">
|
||||
|
||||
{{content-for "head-footer"}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for "body"}}
|
||||
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script src="{{rootURL}}assets/villasweb-frontend.js"></script>
|
||||
|
||||
{{content-for "body-footer"}}
|
||||
</body>
|
||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* File: draggable.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 15.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
uiDragOptions: [ 'disabled_drag', 'addClasses_drag', 'appendTo_drag', 'axis_drag',
|
||||
'cancel_drag', 'connectToSortable_drag', 'containment_drag', 'cursor_drag',
|
||||
'delay_drag', 'distance_drag', 'grid_drag', 'handle_drag','helper_drag',
|
||||
'iframeFix_drag','opacity_drag','scope_drag', 'snap_drag', 'snapMode_drag', 'stack_drag' ],
|
||||
uiDragEvents: [ 'create_drag', 'start_drag', 'drag_drag', 'stop_drag' ],
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
// get available options and events
|
||||
var options = this._gatherDragOptions();
|
||||
this._gatherDragEvents(options);
|
||||
|
||||
// create a new jQuery UI widget
|
||||
var ui = Ember.$.ui['draggable'](options, this.get('element'));
|
||||
this.set('ui', ui);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
var ui = this.get('ui');
|
||||
|
||||
if (ui) {
|
||||
// remove all observers for jQuery UI widget
|
||||
var observers = this._observers;
|
||||
for (var property in observers) {
|
||||
this.removeObserver(property, observers[property]);
|
||||
}
|
||||
|
||||
ui.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
_gatherDragOptions() {
|
||||
// parse all options and add observers for them
|
||||
var uiDragOptions = this.get('uiDragOptions') || [];
|
||||
var options = {};
|
||||
|
||||
uiDragOptions.forEach(function(key) {
|
||||
// save the drag option without the prefix
|
||||
options[key.split('_')[0]] = this.get(key);
|
||||
|
||||
// create an observer for this option
|
||||
var observer = function() {
|
||||
var value = this.get(key);
|
||||
this.get('ui').option(key.split('_')[0], value);
|
||||
};
|
||||
|
||||
this.addObserver(key, observer);
|
||||
|
||||
// save observer to remove it later on
|
||||
this._observers = this._observers || {};
|
||||
this._observers[key] = observer;
|
||||
}, this);
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_gatherDragEvents(options) {
|
||||
// register callbacks for each event
|
||||
var uiDragEvents = this.get('uiDragEvents') || [];
|
||||
var _this = this;
|
||||
|
||||
uiDragEvents.forEach(function(event) {
|
||||
var callback = _this[event];
|
||||
if (callback) {
|
||||
options[event.split('_')[0]] = function(event, ui) {
|
||||
callback.call(_this, event, ui);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,83 +0,0 @@
|
|||
/**
|
||||
* File: droppable.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 15.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
uiDropOptions: [ 'accept_drop', 'addClasses_drop', 'disabled_drop', 'greedy_drop',
|
||||
'hoverClass_drop', 'scope_drop' ],
|
||||
uiDropEvents: [ 'create_drop', 'activate_drop', 'deactivate_drop', 'over_drop',
|
||||
'out_drop', 'drop_drop' ],
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
// get available options and events
|
||||
var options = this._gatherDropOptions();
|
||||
this._gatherDropEvents(options);
|
||||
|
||||
// create a new jQuery UI widget
|
||||
var ui = Ember.$.ui['droppable'](options, this.get('element'));
|
||||
this.set('ui', ui);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
var ui = this.get('ui');
|
||||
|
||||
if (ui) {
|
||||
// remove all observers for jQuery UI widget
|
||||
var observers = this._observers;
|
||||
for (var property in observers) {
|
||||
this.removeObserver(property, observers[property]);
|
||||
}
|
||||
|
||||
ui.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
_gatherDropOptions() {
|
||||
// parse all options and add observers for them
|
||||
var uiDropOptions = this.get('uiDropOptions') || [];
|
||||
var options = {};
|
||||
|
||||
uiDropOptions.forEach(function(key) {
|
||||
// save the drop option without the postfix
|
||||
options[key.split('_')[0]] = this.get(key);
|
||||
|
||||
// create an observer for this option
|
||||
var observer = function() {
|
||||
var value = this.get(key);
|
||||
this.get('ui').option(key.split('_')[0], value);
|
||||
};
|
||||
|
||||
this.addObserver(key, observer);
|
||||
|
||||
// save observer to remove it later on
|
||||
this._observers = this._observers || {};
|
||||
this._observers[key] = observer;
|
||||
}, this);
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_gatherDropEvents(options) {
|
||||
// register callbacks for each event
|
||||
var uiDropEvents = this.get('uiDropEvents') || [];
|
||||
var _this = this;
|
||||
|
||||
uiDropEvents.forEach(function(event) {
|
||||
var callback = _this[event];
|
||||
if (callback) {
|
||||
options[event.split('_')[0]] = function(event, ui) {
|
||||
callback.call(_this, event, ui);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,61 +0,0 @@
|
|||
/**
|
||||
* File: fetch-live-data.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 12.10.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
data: Ember.Object.create(),
|
||||
|
||||
_getData: Ember.observer('model', function() {
|
||||
// check if simulation is running
|
||||
let self = this;
|
||||
|
||||
this.get('model.project').then((project) => {
|
||||
project.get('simulation').then((simulation) => {
|
||||
if (simulation.get('running')) {
|
||||
// get all models to access data
|
||||
simulation.get('models').then((simulationModels) => {
|
||||
simulationModels.forEach(function(simulationModel) {
|
||||
// get simulator
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
let simulatorID = simulator.get('simulatorid');
|
||||
if (simulatorID) {
|
||||
// add simulation data to list
|
||||
self._loadDataForSimulator(simulatorID);
|
||||
} else {
|
||||
Ember.debug('undefined simulator id');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// check again if simulation is running
|
||||
Ember.run.later(this, function() {
|
||||
// trigger _getData observer
|
||||
this.notifyPropertyChange('model');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}),
|
||||
|
||||
_loadDataForSimulator(simulatorID) {
|
||||
// get data by simulator id
|
||||
let simulationData = this.store.peekRecord('simulation-data', simulatorID);
|
||||
if (simulationData) {
|
||||
// add data to list
|
||||
this.set('data.' + simulatorID, simulationData);
|
||||
} else {
|
||||
// try to load data later
|
||||
Ember.run.later(this, function() {
|
||||
this._loadDataForSimulator(simulatorID);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,186 +0,0 @@
|
|||
/**
|
||||
* File: live-data.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 06.10.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
const { service } = Ember.inject;
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
store: service(),
|
||||
sessionUser: service('session-user'),
|
||||
|
||||
INTERVAL: 5000,
|
||||
|
||||
_sockets: {},
|
||||
|
||||
init: function() {
|
||||
this._super();
|
||||
|
||||
// fetch the simulations for the first time
|
||||
this._fetchRunningSimulations();
|
||||
|
||||
// start the polling loop
|
||||
setInterval((function(self) {
|
||||
return function() {
|
||||
self._fetchRunningSimulations();
|
||||
};
|
||||
})(this), this.INTERVAL);
|
||||
},
|
||||
|
||||
_fetchRunningSimulations: function() {
|
||||
// check if the user is logged in
|
||||
if (this.get('sessionUser.user') != null) {
|
||||
// get all simulations to find all running ones
|
||||
var self = this;
|
||||
|
||||
this.get('store').findAll('simulation').then(function(simulations) {
|
||||
simulations.forEach(function(simulation) {
|
||||
// check if the simulation is running
|
||||
if (simulation.get('running')) {
|
||||
// get all models for this simulation
|
||||
simulation.get('models').then((models) => {
|
||||
models.forEach(function(simulationModel) {
|
||||
self._addSocket(simulationModel);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_addSocket(simulationModel) {
|
||||
// check if socket is already open
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
let id = simulator.get('simulatorid');
|
||||
if (this.get('_sockets')[id] !== undefined) {
|
||||
//Ember.debug('skip ' + simulationModel.get('name'));
|
||||
return;
|
||||
}
|
||||
|
||||
// get simulator endpoint
|
||||
simulationModel.get('simulator').then((simulator) => {
|
||||
// get simulator endpoint
|
||||
let endpoint = simulator.get('endpoint');
|
||||
if (endpoint) {
|
||||
// add new socket
|
||||
let socket = new WebSocket('ws://' + endpoint, 'live');
|
||||
socket.binaryType = 'arraybuffer';
|
||||
|
||||
// register callbacks
|
||||
let self = this;
|
||||
|
||||
socket.onopen = function(event) { self._onSocketOpen.apply(self, [event]); };
|
||||
socket.onclose = function(event) { self._onSocketClose.apply(self, [event]); };
|
||||
socket.onmessage = function(event) { self._onSocketMessage.apply(self, [event]); };
|
||||
socket.onerror = function(event) { self._onSocketError.apply(self, [event]); };
|
||||
|
||||
// add socket to list of known sockets
|
||||
this.get('_sockets')[id] = socket;
|
||||
|
||||
//Ember.debug('Socket created for ' + simulationModel.get('name') + ': ws://' + endpoint);
|
||||
} else {
|
||||
Ember.debug('Undefined endpoint for ' + simulationModel.get('name'));
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
_removeSocket(socket) {
|
||||
// search through all sockets
|
||||
let sockets = this.get('_sockets');
|
||||
|
||||
for (let id in sockets) {
|
||||
if (sockets[id] === socket) {
|
||||
// remove socket from list
|
||||
delete sockets[id];
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onSocketOpen(/* event */) {
|
||||
//Ember.debug('websocket opened');
|
||||
},
|
||||
|
||||
_onSocketClose(event) {
|
||||
if (event.wasClean) {
|
||||
Ember.debug('websocket closed');
|
||||
} else {
|
||||
Ember.debug('websocket closed: ' + event.code);
|
||||
}
|
||||
|
||||
// remove socket from array
|
||||
this._removeSocket(event.target);
|
||||
},
|
||||
|
||||
_onSocketMessage(event) {
|
||||
// read the message into JSON
|
||||
var message = this._messageToJSON(event.data);
|
||||
|
||||
// set simulator by socket
|
||||
if (message.simulator === 0) {
|
||||
// search for socket in list
|
||||
let sockets = this.get('_sockets');
|
||||
|
||||
for (let id in sockets) {
|
||||
if (sockets[id] === event.target) {
|
||||
// set id as simulator
|
||||
message.simulator = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create or update simulation data object
|
||||
var simulationData = this.store.peekRecord('simulation-data', message.simulator);
|
||||
if (simulationData != null) {
|
||||
simulationData.set('sequence', message.sequence);
|
||||
simulationData.set('timestamp', new Date(message.timestamp).getTime());
|
||||
simulationData.set('values', message.values);
|
||||
} else {
|
||||
this.store.createRecord('simulation-data', {
|
||||
sequence: message.sequence,
|
||||
timestamp: new Date(message.timestamp).getTime(),
|
||||
values: message.values,
|
||||
id: message.simulator
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_onSocketError(/* event */) {
|
||||
Ember.debug('websocket error');
|
||||
},
|
||||
|
||||
_messageToJSON(blob) {
|
||||
// parse incoming message into usable data
|
||||
var data = new DataView(blob);
|
||||
|
||||
let OFFSET_ENDIAN = 1;
|
||||
let OFFSET_TYPE = 2;
|
||||
let OFFSET_VERSION = 4;
|
||||
|
||||
var bits = data.getUint8(0);
|
||||
var simulator = data.getUint8(0x01);
|
||||
var endian = (bits >> OFFSET_ENDIAN) & 0x1 ? 0 : 1;
|
||||
var length = data.getUint16(0x02, endian);
|
||||
|
||||
var values = new Float32Array(data.buffer, data.byteOffset + 0x10, length);
|
||||
|
||||
return {
|
||||
endian: endian,
|
||||
version: (bits >> OFFSET_VERSION) & 0xF,
|
||||
type: (bits >> OFFSET_TYPE) & 0x3,
|
||||
length: length,
|
||||
sequence: data.getUint32(0x04, endian),
|
||||
timestamp: data.getUint32(0x08, endian) * 1e3 + data.getUint32(0x0C, endian) * 1e-6,
|
||||
values: values,
|
||||
simulator: simulator
|
||||
};
|
||||
}
|
||||
});
|
|
@ -1,88 +0,0 @@
|
|||
/**
|
||||
* File: resizable.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 12.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
uiResizeOptions: [ 'disabled_resize', 'alsoResize_resize', 'animate_resize',
|
||||
'animateDuration_resize', 'animateEasing_resize', 'aspectRatio_resize',
|
||||
'autoHide_resize', 'cancel_resize', 'containment_resize', 'delay_resize',
|
||||
'distance_resize', 'ghost_resize', 'grid_resize', 'handles_resize', 'helper_resize',
|
||||
'maxHeight_resize', 'maxWidth_resize', 'minHeight_resize', 'minWidth_resize' ],
|
||||
uiResizeEvents: [ 'create_resize', 'start_resize', 'resize_resize', 'stop_resize' ],
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
// get available options and events
|
||||
var options = this._gatherResizeOptions();
|
||||
this._gatherResizeEvents(options);
|
||||
|
||||
// create a new jQuery UI widget
|
||||
var ui = Ember.$.ui['resizable'](options, this.get('element'));
|
||||
this.set('ui', ui);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
var ui = this.get('ui');
|
||||
|
||||
if (ui) {
|
||||
// remove all observers for jQuery UI widget
|
||||
var observers = this._observers;
|
||||
for (var prop in observers) {
|
||||
if (observers.hasOwnProperty(prop)) {
|
||||
this.removeObserver(prop, observers[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
ui.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
_gatherResizeOptions() {
|
||||
// parse all options and add observers for them
|
||||
var uiResizeOptions = this.get('uiResizeOptions') || [];
|
||||
var options = {};
|
||||
|
||||
uiResizeOptions.forEach(function(key) {
|
||||
// save the resize option without the postfix
|
||||
options[key.split('_')[0]] = this.get(key);
|
||||
|
||||
// create an observer for this option
|
||||
var observer = function() {
|
||||
var value = this.get(key);
|
||||
//console.log(key + ': ' + value);
|
||||
this.get('ui').option(key.split('_')[0], value);
|
||||
};
|
||||
|
||||
this.addObserver(key, observer);
|
||||
|
||||
// save observer to remove it later on
|
||||
this._observers = this._observers || {};
|
||||
this._observers[key] = observer;
|
||||
}, this);
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_gatherResizeEvents(options) {
|
||||
// register callbacks for each event
|
||||
var uiResizeEvents = this.get('uiResizeEvents') || [];
|
||||
var _this = this;
|
||||
|
||||
uiResizeEvents.forEach(function(event) {
|
||||
var callback = _this[event];
|
||||
if (callback) {
|
||||
options[event.split('_')[0]] = function(event, ui) {
|
||||
callback.call(_this, event, ui);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* File: sortable.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 15.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Mixin.create({
|
||||
uiSortOptions: [ 'appendTo_sort', 'axis_sort', 'cancel_sort', 'connectWith_sort',
|
||||
'containment_sort', 'cursor_sort', 'cursorAt_sort', 'delay_sort', 'disabled_sort',
|
||||
'distance_sort', 'dropOnEmpty_sort', 'forceHelperSize_sort', 'forcePlaceholderSize_sort',
|
||||
'grid_sort', 'handle_sort', 'helper_sort', 'items_sort', 'opacity_sort',
|
||||
'placeholder_sort', 'revert_sort', 'scroll_sort', 'scrollSensitivity_sort',
|
||||
'scrollSpeed_sort', 'tolerance_sort', 'zIndex_sort' ],
|
||||
uiSortEvents: [ 'activate_sort', 'beforeStop_sort', 'change_sort', 'create_sort',
|
||||
'deactivate_sort', 'out_sort', 'over_sort', 'receive_sort', 'remove_sort',
|
||||
'sort_sort', 'start_sort', 'stop_sort', 'update_sort' ],
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
// get available options and events
|
||||
var options = this._gatherSortOptions();
|
||||
this._gatherSortEvents(options);
|
||||
|
||||
// create a new jQuery UI widget
|
||||
var ui = Ember.$.ui['sortable'](options, this.get('element'));
|
||||
this.set('ui', ui);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
var ui = this.get('ui');
|
||||
|
||||
if (ui) {
|
||||
// remove all observers for jQuery UI widget
|
||||
var observers = this._observers;
|
||||
for (var prop in observers) {
|
||||
if (observers.hasOwnProperty(prop)) {
|
||||
this.removeObserver(prop, observers[prop]);
|
||||
}
|
||||
}
|
||||
|
||||
ui.destroy();
|
||||
}
|
||||
},
|
||||
|
||||
_gatherSortOptions() {
|
||||
// parse all options and add observers for them
|
||||
var uiSortOptions = this.get('uiSortOptions') || [];
|
||||
var options = {};
|
||||
|
||||
uiSortOptions.forEach(function(key) {
|
||||
// save the sort option without the postfix
|
||||
options[key.split('_')[0]] = this.get(key);
|
||||
|
||||
// create an observer for this option
|
||||
var observer = function() {
|
||||
var value = this.get(key);
|
||||
//console.log(key + ': ' + value);
|
||||
this.get('ui').option(key.split('_')[0], value);
|
||||
};
|
||||
|
||||
this.addObserver(key, observer);
|
||||
|
||||
// save observer to remove it later on
|
||||
this._observers = this._observers || {};
|
||||
this._observers[key] = observer;
|
||||
}, this);
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_gatherSortEvents(options) {
|
||||
// register callbacks for each event
|
||||
var uiSortEvents = this.get('uiSortEvents') || [];
|
||||
var _this = this;
|
||||
|
||||
uiSortEvents.forEach(function(event) {
|
||||
var callback = _this[event];
|
||||
if (callback) {
|
||||
options[event.split('_')[0]] = function(event, ui) {
|
||||
callback.call(_this, event, ui);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: file.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 25.01.2017
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
name: DS.attr('string'),
|
||||
path: DS.attr('string'),
|
||||
type: DS.attr('string'),
|
||||
user: DS.belongsTo('user', { async: true }),
|
||||
date: DS.attr('date')
|
||||
});
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* File: project.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 04.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { hasMany, belongsTo } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
owner: belongsTo('user', { async: true }),
|
||||
visualizations: hasMany('visualization', { async: true }),
|
||||
simulation: belongsTo('simulation', { async: true })
|
||||
});
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* File: simulation-data.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
// import { belongsTo, hasMany } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
simulator: Ember.computed.alias('id'),
|
||||
sequence: attr('number'),
|
||||
timestamp: attr('number'),
|
||||
values: attr('array'),
|
||||
|
||||
flotValues: Ember.computed('_flotValues', function() {
|
||||
return this._flotValues;
|
||||
}),
|
||||
|
||||
_flotValues: [],
|
||||
|
||||
_updateHistories: Ember.observer('values', function() {
|
||||
// update flot values
|
||||
let values = this.get('values');
|
||||
|
||||
// add empty arrays for each value
|
||||
while (this._flotValues.length < values.length) {
|
||||
this._flotValues.push([]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
this._flotValues[i].push([this.get('timestamp'), values[i]]);
|
||||
|
||||
// discard old values
|
||||
while (this._flotValues[i].length > 1200) {
|
||||
this._flotValues[i].shift();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* File: simulation-model.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo/*, hasMany*/ } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
simulator: belongsTo('simulator', { async: true }),
|
||||
length: attr('number'),
|
||||
mapping: attr('array'),
|
||||
simulation: belongsTo('simulation', { async: true })
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* File: simulation.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo, hasMany } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
running: attr('boolean'),
|
||||
owner: belongsTo('user', { async: true }),
|
||||
models: hasMany('simulation-model', { aync: true }),
|
||||
projects: hasMany('project', { async: true })
|
||||
});
|
|
@ -1,5 +0,0 @@
|
|||
import DS from 'ember-data';
|
||||
|
||||
export default DS.Model.extend({
|
||||
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: simulator.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import DS from 'ember-data';
|
||||
import attr from 'ember-data/attr';
|
||||
|
||||
export default DS.Model.extend({
|
||||
name: attr('string'),
|
||||
running: attr('boolean'),
|
||||
simulatorid: attr('number'),
|
||||
endpoint: attr('string')
|
||||
});
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* File: user.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { hasMany } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
username: attr('string'),
|
||||
password: attr('string'),
|
||||
adminLevel: attr('number'),
|
||||
projects: hasMany('project', { async: true }),
|
||||
simulations: hasMany('simulation', { async: true }),
|
||||
mail: attr('string'),
|
||||
files: hasMany('file', { async: true })
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: visualization.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo, hasMany } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
widgets: hasMany('widget', { async: true }),
|
||||
project: belongsTo('project', { async: true })
|
||||
});
|
|
@ -1,23 +0,0 @@
|
|||
/**
|
||||
* File: widget.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
widgetData: attr(),
|
||||
width: attr('number', { defaultValue: 100 }),
|
||||
height: attr('number', { defaultValue: 100 }),
|
||||
type: attr('string'),
|
||||
x: attr('number', { defaultValue: 0 }),
|
||||
y: attr('number', { defaultValue: 0 }),
|
||||
visualization: belongsTo('Visualization', { async: true })
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
import Resolver from 'ember-resolver';
|
||||
|
||||
export default Resolver;
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* File: router.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import config from './config/environment';
|
||||
|
||||
const Router = Ember.Router.extend({
|
||||
location: config.locationType,
|
||||
rootURL: config.rootURL
|
||||
});
|
||||
|
||||
Router.map(function() {
|
||||
this.route('login');
|
||||
this.route('logout');
|
||||
|
||||
this.route('projects');
|
||||
this.route('project', function() {
|
||||
this.route('index', { path: '/:projectid' });
|
||||
});
|
||||
|
||||
this.route('me');
|
||||
|
||||
this.route('visualization', function() {
|
||||
this.route('index', { path: '/:visualizationid' });
|
||||
this.route('edit', { path: '/edit/:visualizationid' });
|
||||
});
|
||||
|
||||
this.route('user', function() {
|
||||
this.route('edit', { path: '/edit/:userid' });
|
||||
this.route('new');
|
||||
this.route('delete', { path: '/delete/:userid' });
|
||||
});
|
||||
|
||||
this.route('404', { path: '/*path' });
|
||||
|
||||
this.route('simulation-model', function() {
|
||||
this.route('index', { path: '/:modelid' });
|
||||
});
|
||||
|
||||
this.route('simulations');
|
||||
this.route('simulation', function() {
|
||||
this.route('index', { path: '/:simulationid' });
|
||||
});
|
||||
|
||||
this.route('simulators');
|
||||
this.route('simulator');
|
||||
});
|
||||
|
||||
export default Router;
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* File: application.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
|
||||
|
||||
const { service } = Ember.inject;
|
||||
|
||||
export default Ember.Route.extend(ApplicationRouteMixin, {
|
||||
sessionUser: service('session-user'),
|
||||
|
||||
beforeModel() {
|
||||
return this._loadCurrentUser();
|
||||
},
|
||||
|
||||
sessionAuthenticated() {
|
||||
this._loadCurrentUser().then(() => {
|
||||
this.transitionTo('/');
|
||||
}).catch(function(/* reason */) {
|
||||
//console.log(reason);
|
||||
this.get('session').invalidate();
|
||||
});
|
||||
},
|
||||
|
||||
_loadCurrentUser() {
|
||||
return this.get('sessionUser').loadCurrentUser();
|
||||
}
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
import LiveDataMixin from '../mixins/live-data';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, LiveDataMixin, {
|
||||
});
|
|
@ -1,14 +0,0 @@
|
|||
/**
|
||||
* File: login.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 25.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: logout.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 05.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel() {
|
||||
this.get('session').invalidate();
|
||||
}
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: me.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 27.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model() {
|
||||
// get session user
|
||||
return this.store.findRecord('user', 'me');
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('project', params.projectid);
|
||||
}
|
||||
});
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* File: project.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
model() {
|
||||
// get projects for current user, simulations are needed for the simulation picker
|
||||
var user = this.get('sessionUser.user');
|
||||
|
||||
return Ember.RSVP.hash({
|
||||
projects: user.get('projects'),
|
||||
simulations: this.store.findAll('simulation')
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('simulation-model', params.modelid);
|
||||
}
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return Ember.RSVP.hash({
|
||||
simulation: this.store.findRecord('simulation', params.simulationid),
|
||||
simulators: this.store.findAll('simulator')
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* File: simulations.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
model() {
|
||||
// get simulations for current user
|
||||
var user = this.get('sessionUser.user');
|
||||
return user.get('simulations');
|
||||
}
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: simulators.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model() {
|
||||
// get simulators
|
||||
return this.store.findAll('simulator');
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: delete.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('user', params.userid);
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: edit.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('user', params.userid);
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model() {
|
||||
return this.store.findAll('user');
|
||||
}
|
||||
});
|
|
@ -1,14 +0,0 @@
|
|||
/**
|
||||
* File: new.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 11.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: edit.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('visualization', params.visualizationid);
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: index.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('visualization', params.visualizationid);
|
||||
}
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
/**
|
||||
* File: application.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import RESTSerializer from 'ember-data/serializers/rest';
|
||||
import DS from 'ember-data';
|
||||
|
||||
export default RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
|
||||
primaryKey: '_id'
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: project.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 04.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
attrs: {
|
||||
owner: { serialize: 'ids' },
|
||||
visualizations: { serialize: 'ids' }
|
||||
}
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* File: simulation-model.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
attrs: {
|
||||
simulation: { serialize: 'ids' }
|
||||
}
|
||||
});
|
|
@ -1,18 +0,0 @@
|
|||
/**
|
||||
* File: simulation.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
attrs: {
|
||||
owner: { serialize: 'ids' },
|
||||
models: { serialize: 'ids' },
|
||||
projects: { serialize: 'ids' }
|
||||
}
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
/**
|
||||
* File: user.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 27.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
attrs: {
|
||||
projects: { serialize: 'ids' }
|
||||
}
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: visualization.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 28.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import ApplicationSerializer from './application';
|
||||
|
||||
export default ApplicationSerializer.extend({
|
||||
attrs: {
|
||||
project: { serialize: 'ids' },
|
||||
widgets: { serialize: 'ids' }
|
||||
}
|
||||
});
|
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* File: session-user.js
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
import Ember from 'ember';
|
||||
|
||||
const {
|
||||
inject: { service },
|
||||
RSVP
|
||||
} = Ember;
|
||||
|
||||
export default Ember.Service.extend({
|
||||
session: service('session'),
|
||||
store: service(),
|
||||
|
||||
loadCurrentUser() {
|
||||
var _this = this;
|
||||
|
||||
return new RSVP.Promise((resolve, reject) => {
|
||||
const token = this.get('session.data.authenticated.token');
|
||||
if (!Ember.isEmpty(token)) {
|
||||
return this.get('store').queryRecord('user', 'me').then(function(user) {
|
||||
_this.set('user', user);
|
||||
resolve();
|
||||
}, function() {
|
||||
_this.get('session').invalidate();
|
||||
reject();
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,277 +0,0 @@
|
|||
/**
|
||||
* File: app.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.06.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
@import 'widgets';
|
||||
@import 'models';
|
||||
@import 'simulations';
|
||||
@import 'projects';
|
||||
@import 'simulators';
|
||||
@import 'simulation-models';
|
||||
|
||||
@import "ember-modal-dialog/ember-modal-structure";
|
||||
@import "ember-modal-dialog/ember-modal-appearance";
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Application skeleton
|
||||
*/
|
||||
.ember-application {
|
||||
min-width: 800px;
|
||||
|
||||
background: #ddd;
|
||||
color: #4d4d4d;
|
||||
|
||||
font: 16px 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-weight: 300;
|
||||
font-smoothing: antialiased;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
header {
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
|
||||
padding: 10px 0 0 0;
|
||||
|
||||
color: #fff;
|
||||
background-color: #151;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
width: 100%;
|
||||
|
||||
text-align: center
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 100%;
|
||||
|
||||
color: #666;
|
||||
|
||||
margin-top: 20px;
|
||||
|
||||
text-align: center;
|
||||
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main layout
|
||||
*/
|
||||
#main-menu {
|
||||
float: left;
|
||||
|
||||
width: 125px;
|
||||
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
|
||||
0 9px 18px 0 rgba(0, 0, 0, 0.1);
|
||||
|
||||
margin: 20px 0 0 20px;
|
||||
padding: 20px 20px 20px 30px;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
min-height: 100px;
|
||||
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
|
||||
0 9px 18px 0 rgba(0, 0, 0, 0.1);
|
||||
|
||||
margin: 20px 20px 20px 220px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login layout
|
||||
*/
|
||||
#login-container {
|
||||
width: 320px;
|
||||
height: 180px;
|
||||
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2),
|
||||
0 9px 18px 0 rgba(0, 0, 0, 0.1);
|
||||
|
||||
margin: 80px auto;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
#login-container h1 {
|
||||
background-color: #cdcdcd;
|
||||
|
||||
text-align: center;
|
||||
|
||||
font-size: 24;
|
||||
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
#login {
|
||||
|
||||
}
|
||||
|
||||
#login-form {
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visualization
|
||||
*/
|
||||
.draggableDropzone {
|
||||
display: block;
|
||||
|
||||
min-height: 400px;
|
||||
|
||||
border: 3px dashed #aaa;
|
||||
|
||||
&.activated {
|
||||
border-color: #2ecc71;
|
||||
}
|
||||
&.deactivated {
|
||||
border-color: #e1e1e1;
|
||||
}
|
||||
}
|
||||
|
||||
.draggableItem[draggable=true] {
|
||||
display: inline-block;
|
||||
background: #e1e1e1;
|
||||
cursor: move;
|
||||
|
||||
padding: 5px 10px;
|
||||
|
||||
border: 1px solid gray;
|
||||
|
||||
&:hover {
|
||||
background-color: #aaa;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Table
|
||||
*/
|
||||
.column-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/**
|
||||
* Table full width
|
||||
*/
|
||||
.table-full-width {
|
||||
width: 100%;
|
||||
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.table-full-width th, td {
|
||||
padding: 5px;
|
||||
|
||||
text-align: left;
|
||||
|
||||
border: none;
|
||||
}
|
||||
|
||||
.table-full-width th {
|
||||
background-color: #151;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.table-full-width tr:nth-child(even) {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form create record
|
||||
*/
|
||||
.form-create-record {
|
||||
padding: 0;
|
||||
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.form-create-record table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.form-create-record td {
|
||||
padding: 5px 10px 5px 0;
|
||||
}
|
||||
|
||||
.form-create-record input {
|
||||
padding: 2px 4px;
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.form-create-record input[type=number] {
|
||||
width: 60px;
|
||||
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.form-create-record button {
|
||||
background-color: #151;
|
||||
color: #fff;
|
||||
|
||||
font-size: 14px;
|
||||
|
||||
padding: 4px 8px;
|
||||
|
||||
border: none;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-create-record button:hover {
|
||||
background: #373;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #151;
|
||||
color: #fff;
|
||||
|
||||
font-size: 14px;
|
||||
|
||||
margin-top: 10px;
|
||||
padding: 4px 8px;
|
||||
|
||||
border: none;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #373;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
.popover {
|
||||
z-index: 1010;
|
||||
|
||||
width: 120px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-right-color: red !important;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
visibility: hidden;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/**
|
||||
* File: models.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 20.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Route: simulation-models
|
||||
*/
|
||||
.simulation-models-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.simulation-models-container table {
|
||||
width: 100%;
|
||||
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.simulation-models-container th, td {
|
||||
padding: 5px;
|
||||
|
||||
text-align: left;
|
||||
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.simulation-models-container th {
|
||||
background-color: #151;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.simulation-models-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.simulation-models-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.simulation-models-container tr:nth-child(even) {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.simulation-models-new-container {
|
||||
margin-top: 20px;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/**
|
||||
* File: projects.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Route: projects
|
||||
*/
|
||||
.projects-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.projects-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.projects-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.projects-new-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route: project.index
|
||||
*/
|
||||
.project-index-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.project-index-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.project-index-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.project-index-new-visualization {
|
||||
margin-top: 20px;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* File: simulation-models.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 12.10.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Route: simulation-model/index
|
||||
*/
|
||||
.simulation-model-index-mapping {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.simulation-model-index-buttons {
|
||||
margin-top: 20px;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/**
|
||||
* File: simulations.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 26.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Route: simulations
|
||||
*/
|
||||
.simulations-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.simulations-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.simulations-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.simulations-new-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Route: simulation/index
|
||||
*/
|
||||
.simulation-index-models-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.simulation-index-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.simulation-index-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.simulation-index-new-model {
|
||||
margin-top: 20px;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
* File: simulators.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 30.09.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Route: simulators
|
||||
*/
|
||||
.simulators-container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.simulators-row-controls {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.simulators-row-controls a {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.simulators-new-container {
|
||||
margin-top: 50px;
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* File: widgets.css
|
||||
* Author: Markus Grigull <mgrigull@eonerc.rwth-aachen.de>
|
||||
* Date: 19.07.2016
|
||||
* Copyright: 2016, Institute for Automation of Complex Power Systems, EONERC
|
||||
* This file is part of VILLASweb. All Rights Reserved. Proprietary and confidential.
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited.
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* Component: widget-container
|
||||
*/
|
||||
.widgets {
|
||||
overflow: scroll;
|
||||
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: widget-toolbox
|
||||
*/
|
||||
.widget-toolbox {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: widget-abstract
|
||||
*/
|
||||
.widgetAbstract {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.widget-editing {
|
||||
border: 1px solid lightgray;
|
||||
|
||||
padding: 5px 10px;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: widget-value
|
||||
*/
|
||||
.widgetValue {
|
||||
|
||||
}
|
||||
|
||||
.widget-edit-container {
|
||||
width: 200px !important;
|
||||
|
||||
background-color: #ddd;
|
||||
|
||||
border: 1px dotted black;
|
||||
}
|
||||
|
||||
.widget-edit-form {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: widget-table
|
||||
*/
|
||||
.widgetTable {
|
||||
|
||||
}
|
||||
|
||||
.widgetTable table {
|
||||
width: 100%;
|
||||
/*height: 100%;*/
|
||||
|
||||
border: 1px solid gray;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.widgetTable td, th {
|
||||
border: 1px solid gray;
|
||||
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Component: widget-plot
|
||||
*/
|
||||
.widgetPlot-signal-table {
|
||||
border: 1px solid gray;
|
||||
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
.widgetPlot-signal-table th {
|
||||
border: 0;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<h1>404 - Not found</h1>
|
|
@ -1,28 +0,0 @@
|
|||
<header>
|
||||
<h1>VILLAS</h1>
|
||||
</header>
|
||||
|
||||
{{#if session.isAuthenticated}}
|
||||
<div id="main-menu">
|
||||
<h2>Menu</h2>
|
||||
|
||||
<ul>
|
||||
<li>{{#link-to 'index'}}Home{{/link-to}}</li>
|
||||
<li>{{#link-to 'projects'}}Projects{{/link-to}}</li>
|
||||
<li>{{#link-to 'simulations'}}Simulations{{/link-to}}</li>
|
||||
<li>{{#link-to 'simulators'}}Simulators{{/link-to}}</li>
|
||||
<li>{{#link-to 'me'}}Account{{/link-to}}</li>
|
||||
<li>{{#link-to 'logout'}}Logout{{/link-to}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<section id="wrapper">
|
||||
{{outlet}}
|
||||
</section>
|
||||
{{else}}
|
||||
{{outlet}}
|
||||
{{/if}}
|
||||
|
||||
<footer>
|
||||
Copyright © 2016
|
||||
</footer>
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
|
@ -1 +0,0 @@
|
|||
{{yield}}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue