mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Add modal dialogs to projects and simulation-models
This commit is contained in:
parent
ab5bf2ed16
commit
35b885f19b
57 changed files with 835 additions and 655 deletions
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* File: delete.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({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
actions: {
|
||||
cancelDelete() {
|
||||
// go back to project view
|
||||
let projectId = this.get('model.id');
|
||||
this.transitionToRoute('/project/' + projectId);
|
||||
},
|
||||
|
||||
confirmDelete() {
|
||||
// delete the project
|
||||
var project = this.get('model');
|
||||
project.destroyRecord();
|
||||
|
||||
this.transitionToRoute('/projects');
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,37 +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({
|
||||
name: function() {
|
||||
return this.get('model.name');
|
||||
}.property('model.name'),
|
||||
|
||||
actions: {
|
||||
saveEdit() {
|
||||
// apply the changes
|
||||
var project = this.get('model');
|
||||
project.set('name', this.get('name'));
|
||||
|
||||
// save the changes
|
||||
let projectId = project.get('id');
|
||||
var controller = this;
|
||||
|
||||
project.save().then(function() {
|
||||
controller.transitionToRoute('/project/' + projectId);
|
||||
});
|
||||
},
|
||||
|
||||
cancelEdit() {
|
||||
let projectId = this.get('model.id');
|
||||
this.transitionToRoute('/project/' + projectId);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -10,19 +10,107 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
actions: {
|
||||
newVisualization() {
|
||||
// get the project
|
||||
var project = this.get('model');
|
||||
var projectId = this.get('model.id');
|
||||
isShowingNewModal: false,
|
||||
isShowingEditModal: false,
|
||||
isShowingDeleteModal: false,
|
||||
|
||||
// create the visualization
|
||||
var visualization = this.store.createRecord('visualization', { name: 'Visualization', project: projectId });
|
||||
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();
|
||||
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,36 +0,0 @@
|
|||
/**
|
||||
* File: new.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({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
actions: {
|
||||
newProject() {
|
||||
// get current user
|
||||
var user = this.get('sessionUser.user');
|
||||
|
||||
// create new project from properties
|
||||
var properties = this.getProperties('name');
|
||||
properties['owner'] = user;
|
||||
|
||||
var project = this.store.createRecord('project', properties);
|
||||
var controller = this;
|
||||
|
||||
project.save().then(function() {
|
||||
controller.transitionToRoute('/projects');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNewProject() {
|
||||
this.transitionToRoute('/projects');
|
||||
}
|
||||
}
|
||||
});
|
115
app/controllers/projects.js
Normal file
115
app/controllers/projects.js
Normal file
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* 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,
|
||||
|
||||
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'));
|
||||
|
||||
// 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 properties
|
||||
var user = this.get('sessionUser.user');
|
||||
properties['owner'] = user;
|
||||
|
||||
// create new project
|
||||
var project = this.store.createRecord('project', properties);
|
||||
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;
|
||||
}
|
||||
|
||||
// save properties
|
||||
this.get('project').setProperties(properties);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
|
@ -1,21 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sequence: function() {
|
||||
return this.get('model.sequence');
|
||||
}.property('model.sequence'),
|
||||
|
||||
values: function() {
|
||||
return this.get('model.values');
|
||||
}.property('model.values.@each'),
|
||||
|
||||
_updateModel: function() {
|
||||
if (this.get('model') === null) {
|
||||
Ember.run.later(this, function() {
|
||||
var simulationData = this.store.peekRecord('simulation-data', 1);
|
||||
this.set('model', simulationData);
|
||||
this.notifyPropertyChange('model');
|
||||
}, 500);
|
||||
}
|
||||
}.observes('model').on('init')
|
||||
});
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* File: new.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({
|
||||
simulator: null,
|
||||
|
||||
actions: {
|
||||
newModel() {
|
||||
// get the simulation
|
||||
var simulation = this.get('model.simulation');
|
||||
var simulationId = this.get('model.simulation.id');
|
||||
|
||||
// create new model from properties
|
||||
var properties = this.getProperties('name');
|
||||
properties['simulation'] = simulationId;
|
||||
|
||||
// get the simulator id by simulator name
|
||||
if (this.get('simulator') == null) {
|
||||
this.set('simulator', this.get('model.simulators')[0]);
|
||||
}
|
||||
|
||||
console.log(this.get('model.simulators')[0]);
|
||||
|
||||
/*var 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);
|
||||
|
||||
var controller = this;
|
||||
|
||||
simulationModel.save().then(function() {
|
||||
controller.transitionToRoute('/simulation/' + simulationId);
|
||||
}, function() {
|
||||
Ember.debug('Error saving new model');
|
||||
});*/
|
||||
},
|
||||
|
||||
cancelNewModel() {
|
||||
var simulationId = this.get('model.simulation.id');
|
||||
this.transitionToRoute('/simulation/' + simulationId);
|
||||
},
|
||||
|
||||
selectSimulator(simulator) {
|
||||
this.set('simulator', simulator);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
});
|
|
@ -1,4 +1,181 @@
|
|||
/**
|
||||
* 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: function() {
|
||||
if (this.get('model.simulators') != null && this.get('model.simulators.length') > 0) {
|
||||
var simulators = this.get('model.simulators');
|
||||
this.set('simulatorName', simulators.toArray()[0].get('name'));
|
||||
}
|
||||
}.observes('model'),
|
||||
|
||||
actions: {
|
||||
showNewModal() {
|
||||
// reset properties
|
||||
this.set('errorMessage', null);
|
||||
this.set('name', null);
|
||||
|
||||
// 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'));
|
||||
|
||||
var simulators = this.get('model.simulators');
|
||||
var simulatorId = simulationModel.get('simulator');
|
||||
var simulatorName = null;
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('simulatorid') == 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
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] == "") {
|
||||
this.set('errorMessage', 'Simulation model name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set simuatlion properties
|
||||
var simulation = this.get('model.simulation');
|
||||
properties['simulation'] = simulation.get('id');;
|
||||
|
||||
// get the simulator id by simulator name
|
||||
var simulators = this.get('model.simulators');
|
||||
var simulatorId = null;
|
||||
var simulatorName = this.get('simulatorName');
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('name') === simulatorName) {
|
||||
simulatorId = simulator.get('simulatorid');
|
||||
}
|
||||
});
|
||||
|
||||
if (simulatorId == null) {
|
||||
Ember.debug('Unable to find simulator by name');
|
||||
return;
|
||||
}
|
||||
|
||||
properties['simulator'] = simulatorId;
|
||||
|
||||
// create new model
|
||||
var 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);
|
||||
|
||||
var 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
|
||||
var properties = this.getProperties('name');
|
||||
if (properties['name'] == null || properties['name'] == "") {
|
||||
this.set('errorMessage', 'Simulation model name is missing');
|
||||
return;
|
||||
}
|
||||
|
||||
// set simuatlion properties
|
||||
var simulation = this.get('model.simulation');
|
||||
properties['simulation'] = simulation.get('id');;
|
||||
|
||||
// get the simulator id by simulator name
|
||||
var simulators = this.get('model.simulators');
|
||||
var simulatorId = null;
|
||||
var simulatorName = this.get('simulatorName');
|
||||
|
||||
simulators.forEach(function(simulator) {
|
||||
if (simulator.get('name') === simulatorName) {
|
||||
simulatorId = simulator.get('simulatorid');
|
||||
}
|
||||
});
|
||||
|
||||
if (simulatorId == null) {
|
||||
Ember.debug('Unable to find simulator by name');
|
||||
return;
|
||||
}
|
||||
|
||||
properties['simulator'] = simulatorId;
|
||||
|
||||
// save properties
|
||||
var 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
|
||||
var 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,38 +0,0 @@
|
|||
/**
|
||||
* File: new.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';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
actions: {
|
||||
newSimulation() {
|
||||
// get current user
|
||||
var user = this.get('sessionUser.user');
|
||||
|
||||
// create new simulation from properties
|
||||
var properties = this.getProperties('name');
|
||||
properties['owner'] = user;
|
||||
|
||||
var simulation = this.store.createRecord('simulation', properties);
|
||||
var controller = this;
|
||||
|
||||
simulation.save().then(function() {
|
||||
controller.transitionToRoute('/simulations');
|
||||
}, function() {
|
||||
Ember.debug('Error saving new simulation');
|
||||
});
|
||||
},
|
||||
|
||||
cancelNewSimulation() {
|
||||
this.transitionToRoute('/simulations');
|
||||
}
|
||||
}
|
||||
});
|
115
app/controllers/simulations.js
Normal file
115
app/controllers/simulations.js
Normal file
|
@ -0,0 +1,115 @@
|
|||
/**
|
||||
* 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,
|
||||
isShowingEditModal: false,
|
||||
|
||||
errorMessage: null,
|
||||
|
||||
simulation: null,
|
||||
|
||||
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);
|
||||
},
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -21,9 +21,6 @@ Router.map(function() {
|
|||
this.route('projects');
|
||||
this.route('project', function() {
|
||||
this.route('index', { path: '/:projectid' });
|
||||
this.route('new');
|
||||
this.route('edit', { path: '/edit/:projectid' });
|
||||
this.route('delete', { path: '/delete/:projectid' });
|
||||
});
|
||||
|
||||
this.route('me');
|
||||
|
@ -45,18 +42,11 @@ Router.map(function() {
|
|||
|
||||
this.route('simulation-model', function() {
|
||||
this.route('index', { path: '/:modelid' });
|
||||
this.route('new', { path: '/new/:simulationid' });
|
||||
this.route('delete', { path: '/delete/:modelid' });
|
||||
this.route('edit', { path: '/edit/:modelid' });
|
||||
});
|
||||
this.route('simulation-models');
|
||||
|
||||
this.route('simulations');
|
||||
this.route('simulation', function() {
|
||||
this.route('index', { path: '/:simulationid' });
|
||||
this.route('delete', { path: '/delete/:simulationid' });
|
||||
this.route('new');
|
||||
this.route('edit', { path: '/edit/:simulationid' });
|
||||
});
|
||||
|
||||
this.route('simulators');
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* File: delete.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,17 +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 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,14 +0,0 @@
|
|||
/**
|
||||
* File: new.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, {
|
||||
});
|
|
@ -14,10 +14,8 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
sessionUser: Ember.inject.service('session-user'),
|
||||
|
||||
model() {
|
||||
// get session user
|
||||
var userId = this.get('sessionUser.user.id');
|
||||
let user = this.store.peekRecord('user', userId);
|
||||
|
||||
// get projects for current user
|
||||
var user = this.get('sessionUser.user');
|
||||
return user.get('projects');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
|
@ -1,7 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
model() {
|
||||
return this.store.peekRecord('simulation-data', 1);
|
||||
}
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
/**
|
||||
* File: new.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 Ember.RSVP.hash({
|
||||
simulation: this.store.findRecord('simulation', params.simulationid),
|
||||
simulators: this.store.findAll('simulator')
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,14 +0,0 @@
|
|||
/**
|
||||
* File: simulation-models.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, {
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
});
|
|
@ -12,6 +12,9 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
|
|||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
model(params) {
|
||||
return this.store.findRecord('simulation', params.simulationid);
|
||||
return Ember.RSVP.hash({
|
||||
simulation: this.store.findRecord('simulation', params.simulationid),
|
||||
simulators: this.store.findAll('simulator')
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
/**
|
||||
* File: new.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, {
|
||||
});
|
|
@ -21,6 +21,7 @@ export default Ember.Service.extend({
|
|||
var self = this;
|
||||
|
||||
// check every second for running simulation
|
||||
/*
|
||||
setInterval(function() {
|
||||
// check if running simulation did changed
|
||||
self.get('store').findAll('simulation').then(function(simulations) {
|
||||
|
@ -36,6 +37,6 @@ export default Ember.Service.extend({
|
|||
self.set('simulation', newSimulation);
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}, 1000);*/
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<h1>Delete Project</h1>
|
||||
|
||||
<p>Are you sure you want to delete the project?</p>
|
||||
|
||||
<button {{action 'cancelDelete'}}>Cancel</button>
|
||||
<button {{action 'confirmDelete'}}>Delete</button>
|
|
@ -1,15 +0,0 @@
|
|||
<h1>Edit project</h1>
|
||||
|
||||
<form id="project-edit-form" {{action 'saveEdit' on='submit'}} >
|
||||
<p>
|
||||
<label for="name">Name</label>
|
||||
{{input id='name' placeholder='Enter project name' value=name}}
|
||||
</p>
|
||||
|
||||
<button {{action 'cancelEdit'}}>Cancel</button>
|
||||
<button type="submit">Save</button>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p>{{errorMessage.message}}</p>
|
||||
{{/if}}
|
||||
</form>
|
|
@ -1,3 +1,5 @@
|
|||
{{#link-to 'projects'}}Back to projects{{/link-to}}
|
||||
|
||||
<h1>{{model.name}}</h1>
|
||||
|
||||
<div class="project-index-container">
|
||||
|
@ -13,8 +15,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="project-index-row-controls">
|
||||
{{#link-to "visualization.edit" visualization.id}}Edit{{/link-to}}
|
||||
{{#link-to "visualization.delete" visualization.id}}Delete{{/link-to}}
|
||||
<a href="" {{action 'showEditModal' visualization}}>Edit</a>
|
||||
<a href="" {{action 'showDeleteModal' visualization}}>Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -23,5 +25,74 @@
|
|||
</div>
|
||||
|
||||
<div class="project-index-new-visualization">
|
||||
<a href="" {{action 'newVisualization'}}>New visualization</a>
|
||||
<button {{action 'showNewModal'}}>New visualization</button>
|
||||
</div>
|
||||
|
||||
{{#if isShowingNewModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>New visualization</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'submitNew' on='submit'}} >
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter visualization name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNew'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingEditModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Edit visualization</h1>
|
||||
|
||||
<form class="form-edit-record" {{action 'submitEdit' on='submit'}} >
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter visualization name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelEdit'}}>Cancel</button>
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingDeleteModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Delete visualization</h1>
|
||||
|
||||
<p>Are you sure you want to delete the visualization <b><i>{{visualization.name}}</i></b>?</p>
|
||||
|
||||
<button {{action 'cancelDelete'}}>Cancel</button>
|
||||
<button {{action 'confirmDelete'}}>Delete</button>
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<h1>New project</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'newProject' on='submit'}} >
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter project name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNewProject'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p>{{errorMessage.message}}</p>
|
||||
{{/if}}
|
||||
</form>
|
|
@ -13,8 +13,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="projects-row-controls">
|
||||
{{#link-to "project.edit" project.id}}Edit{{/link-to}}
|
||||
{{#link-to "project.delete" project.id}}Delete{{/link-to}}
|
||||
<a href="" {{action 'showEditModal' project}}>Edit</a>
|
||||
<a href="" {{action 'showDeleteModal' project}}>Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -23,5 +23,74 @@
|
|||
</div>
|
||||
|
||||
<div class="projects-new-container">
|
||||
{{#link-to "project.new"}}New project{{/link-to}}
|
||||
<button {{action 'showNewModal'}}>New Project</button>
|
||||
</div>
|
||||
|
||||
{{#if isShowingNewModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>New project</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'submitNew' on='submit'}} >
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter project name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNew'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingEditModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Edit project</h1>
|
||||
|
||||
<form class="form-edit-record" {{action 'submitEdit' on='submit'}} >
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter project name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelEdit'}}>Cancel</button>
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingDeleteModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Delete project</h1>
|
||||
|
||||
<p>Are you sure you want to delete the project <b><i>{{project.name}}</i></b>?</p>
|
||||
|
||||
<button {{action 'cancelDelete'}}>Cancel</button>
|
||||
<button {{action 'confirmDelete'}}>Delete</button>
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
{{outlet}}
|
|
@ -1,8 +0,0 @@
|
|||
{{sequence}}
|
||||
|
||||
<br />
|
||||
|
||||
{{#each values as |value|}}
|
||||
{{value}}
|
||||
<br />
|
||||
{{/each}}
|
|
@ -1,32 +0,0 @@
|
|||
<h1>New model</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'newModel' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter model name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="simulator">Simulator</label>
|
||||
</td>
|
||||
<td>
|
||||
<select onchange={{action "selectSimulator" value="target.value"}}>
|
||||
{{#each model.simulators as |simulator|}}
|
||||
<option value={{simulator.name}}>{{simulator.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNewModel'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
|
@ -1,24 +0,0 @@
|
|||
<h1>Models</h1>
|
||||
|
||||
<div class="simulation-models-container">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
{{#each model as |simulationModel|}}
|
||||
<tr>
|
||||
<td>
|
||||
{{#link-to "simulation-model.index" simulationModel.id}}{{simulationModel.name}}{{/link-to}}
|
||||
<div class="simulation-models-row-controls">
|
||||
{{#link-to "simulation-model.edit" simulationModel.id}}Edit{{/link-to}}
|
||||
{{#link-to "simulation-model.delete" simulationModel.id}}Delete{{/link-to}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="simulation-models-new-container">
|
||||
{{#link-to "simulation-model.new"}}New model{{/link-to}}
|
||||
</div>
|
|
@ -1 +0,0 @@
|
|||
{{outlet}}
|
|
@ -1 +0,0 @@
|
|||
{{outlet}}
|
|
@ -1,4 +1,6 @@
|
|||
<h1>{{model.name}}</h1>
|
||||
{{#link-to 'simulations'}}Back to simulations{{/link-to}}
|
||||
|
||||
<h1>{{model.simulation.name}}</h1>
|
||||
|
||||
<div class="simulation-index-models-container">
|
||||
<table class="table-full-width">
|
||||
|
@ -7,7 +9,7 @@
|
|||
<th width="80px" class="column-center">Simulator</th>
|
||||
<th width="100px"></th>
|
||||
</tr>
|
||||
{{#each model.models as |simulationModel|}}
|
||||
{{#each model.simulation.models as |simulationModel|}}
|
||||
<tr>
|
||||
<td>
|
||||
{{#link-to "simulation-model.index" simulationModel.id}}{{simulationModel.name}}{{/link-to}}
|
||||
|
@ -17,8 +19,8 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="simulation-index-row-controls">
|
||||
{{#link-to "simulation-model.edit" simulationModel.id}}Edit{{/link-to}}
|
||||
{{#link-to "simulation-model.delete" simulationModel.id}}Delete{{/link-to}}
|
||||
<a href="" {{action 'showEditModal' simulationModel}}>Edit</a>
|
||||
<a href="" {{action 'showDeleteModal' simulationModel}}>Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -27,5 +29,98 @@
|
|||
</div>
|
||||
|
||||
<div class="simulation-index-new-model">
|
||||
{{#link-to "simulation-model.new" model.id}}New model{{/link-to}}
|
||||
<button {{action 'showNewModal'}}>New model</button>
|
||||
</div>
|
||||
|
||||
{{#if isShowingNewModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>New model</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'submitNew' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter model name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="simulator">Simulator</label>
|
||||
</td>
|
||||
<td>
|
||||
<select onchange={{action "selectSimulator" value="target.value"}}>
|
||||
{{#each model.simulators as |simulator|}}
|
||||
<option value={{simulator.name}}>{{simulator.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNew'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingEditModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Edit model</h1>
|
||||
|
||||
<form class="form-edit-record" {{action 'submitEdit' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter model name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="simulator">Simulator</label>
|
||||
</td>
|
||||
<td>
|
||||
<select onchange={{action "selectSimulator" value="target.value"}}>
|
||||
{{#each model.simulators as |simulator|}}
|
||||
<option value={{simulator.name}} selected={{eq simulatorName simulator.name}}>{{simulator.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelEdit'}}>Cancel</button>
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingDeleteModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Delete simulation-model</h1>
|
||||
|
||||
<p>Are you sure you want to delete the simulation-model <b><i>{{simulationModel.name}}</i></b>?</p>
|
||||
|
||||
<button {{action 'cancelDelete'}}>Cancel</button>
|
||||
<button {{action 'confirmDelete'}}>Delete</button>
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<h1>New simulation</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'newSimulation' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter simulation name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNewSimulation'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
|
@ -17,8 +17,10 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="simulations-row-controls">
|
||||
{{#link-to "simulation.edit" simulation.id}}Edit{{/link-to}}
|
||||
{{#link-to "simulation.delete" simulation.id}}Delete{{/link-to}}
|
||||
<!-- {{#link-to "simulation.edit" simulation.id}}Edit{{/link-to}} -->
|
||||
<!-- {{#link-to "simulation.delete" simulation.id}}Delete{{/link-to}} -->
|
||||
<a href="" {{action 'showEditModal' simulation}}>Edit</a>
|
||||
<a href="" {{action 'showDeleteModal' simulation}}>Delete</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -27,5 +29,74 @@
|
|||
</div>
|
||||
|
||||
<div class="simulations-new-container">
|
||||
{{#link-to "simulation.new"}}New simulation{{/link-to}}
|
||||
<button {{action 'showNewModal'}}>New Simulation</button>
|
||||
</div>
|
||||
|
||||
{{#if isShowingNewModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>New simulation</h1>
|
||||
|
||||
<form class="form-create-record" {{action 'submitNew' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter simulation name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelNew'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingEditModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Edit simulator</h1>
|
||||
|
||||
<form class="form-edit-record" {{action 'submitEdit' on='submit'}}>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="name">Name</label>
|
||||
</td>
|
||||
<td>
|
||||
{{input id='name' placeholder='Enter simulation name' value=name}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelEdit'}}>Cancel</button>
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
{{#if errorMessage}}
|
||||
<p><strong>Error:</strong> {{errorMessage}}</p>
|
||||
{{/if}}
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isShowingDeleteModal}}
|
||||
{{#modal-dialog attachment="middle center" translucentOverlay=true}}
|
||||
<h1>Delete simulation</h1>
|
||||
|
||||
<p>Are you sure you want to delete the simulation <b><i>{{simulation.name}}</i></b>?</p>
|
||||
|
||||
<button {{action 'cancelDelete'}}>Cancel</button>
|
||||
<button {{action 'confirmDelete'}}>Delete</button>
|
||||
{{/modal-dialog}}
|
||||
{{/if}}
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
<tr>
|
||||
<td colspan="2">
|
||||
<button {{action 'cancelEditSimulator'}}>Cancel</button>
|
||||
<button type="submit">Create</button>
|
||||
<button type="submit">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
"ember-resolver": "^2.0.3",
|
||||
"ember-simple-auth": "^1.1.0",
|
||||
"ember-tether": "0.3.1",
|
||||
"ember-truth-helpers": "1.2.0",
|
||||
"loader.js": "^4.0.1"
|
||||
},
|
||||
"dependencies": {}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:project/delete', 'Unit | Controller | project/delete', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:project/edit', 'Unit | Controller | project/edit', {
|
||||
moduleFor('controller:projects', 'Unit | Controller | projects', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation-model/delete', 'Unit | Controller | simulation-model/delete', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation-model/edit', 'Unit | Controller | simulation-model/edit', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation-model/new', 'Unit | Controller | simulation-model/new', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation/delete', 'Unit | Controller | simulation/delete', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation/edit', 'Unit | Controller | simulation/edit', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let controller = this.subject();
|
||||
assert.ok(controller);
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:simulation/new', 'Unit | Controller | simulation/new', {
|
||||
moduleFor('controller:simulations', 'Unit | Controller | simulations', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation-model/delete', 'Unit | Route | simulation-model/delete', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation-model/edit', 'Unit | Route | simulation-model/edit', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation-model/new', 'Unit | Route | simulation-model/new', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation/delete', 'Unit | Route | simulation/delete', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation/edit', 'Unit | Route | simulation/edit', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
|
@ -1,11 +0,0 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:simulation/new', 'Unit | Route | simulation/new', {
|
||||
// Specify the other units that are required for this test.
|
||||
// needs: ['controller:foo']
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.subject();
|
||||
assert.ok(route);
|
||||
});
|
Loading…
Add table
Reference in a new issue