mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Add visulization and plot
Plot has no routes defined. Visualization edit and delete routes are not working.
This commit is contained in:
parent
75c8464b6c
commit
5bc260b81c
19 changed files with 157 additions and 4 deletions
12
app/models/plot.js
Normal file
12
app/models/plot.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
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'),
|
||||
signal: attr('string'),
|
||||
//position:
|
||||
//size:
|
||||
title: attr('string')
|
||||
//backgroundColor:
|
||||
});
|
|
@ -1,8 +1,9 @@
|
|||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { belongsTo } from 'ember-data/relationships';
|
||||
import { hasMany, belongsTo } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
owner: belongsTo('user', { async: true })
|
||||
owner: belongsTo('user', { async: true }),
|
||||
visualizations: hasMany('visualization', { async: true })
|
||||
});
|
||||
|
|
8
app/models/visualization.js
Normal file
8
app/models/visualization.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
import { hasMany } from 'ember-data/relationships';
|
||||
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
plots: hasMany('plot', { async: true })
|
||||
});
|
|
@ -19,6 +19,12 @@ Router.map(function() {
|
|||
this.route('user', function() {
|
||||
this.route('edit');
|
||||
});
|
||||
this.route('visualization', function() {
|
||||
this.route('index', { path: '/:visualizationid' });
|
||||
this.route('new');
|
||||
this.route('edit', { path: '/edit/:visualizationid' });
|
||||
this.route('delete', { path: '/delete/:visualizationid' });
|
||||
});
|
||||
});
|
||||
|
||||
export default Router;
|
||||
|
|
8
app/routes/visualization/delete.js
Normal file
8
app/routes/visualization/delete.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
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);
|
||||
}
|
||||
});
|
8
app/routes/visualization/edit.js
Normal file
8
app/routes/visualization/edit.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
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);
|
||||
}
|
||||
});
|
8
app/routes/visualization/index.js
Normal file
8
app/routes/visualization/index.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
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);
|
||||
}
|
||||
});
|
5
app/routes/visualization/new.js
Normal file
5
app/routes/visualization/new.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
});
|
|
@ -1,4 +1,24 @@
|
|||
<h1>{{model.name}}</h1>
|
||||
|
||||
{{#link-to "project.edit" model.id}}Edit project{{/link-to}}
|
||||
{{#link-to "project.delete" model.id}}Delete project{{/link-to}}
|
||||
<br />
|
||||
|
||||
<p>
|
||||
<h3>Visualizations</h3>
|
||||
|
||||
<ul>
|
||||
{{#each model.visualizations as |visualization|}}
|
||||
<li>{{#link-to 'visualization.index' visualization.id}}{{visualization.name}}{{/link-to}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<br />
|
||||
|
||||
{{#link-to 'visualization.new'}}New visualization{{/link-to}}
|
||||
</p>
|
||||
|
||||
<br />
|
||||
|
||||
<p>
|
||||
{{#link-to "project.edit" model.id}}Edit project{{/link-to}}
|
||||
{{#link-to "project.delete" model.id}}Delete project{{/link-to}}
|
||||
</p>
|
||||
|
|
1
app/templates/visualization/delete.hbs
Normal file
1
app/templates/visualization/delete.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>Delete</h1>
|
1
app/templates/visualization/edit.hbs
Normal file
1
app/templates/visualization/edit.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>Edit</h1>
|
6
app/templates/visualization/index.hbs
Normal file
6
app/templates/visualization/index.hbs
Normal file
|
@ -0,0 +1,6 @@
|
|||
<h1>{{model.name}}</h1>
|
||||
|
||||
<p>
|
||||
{{#link-to "visualization.edit" model.id}}Edit visualization{{/link-to}}
|
||||
{{#link-to "visualization.delete" model.id}}Delete visualization{{/link-to}}
|
||||
</p>
|
1
app/templates/visualization/new.hbs
Normal file
1
app/templates/visualization/new.hbs
Normal file
|
@ -0,0 +1 @@
|
|||
<h1>New visualization</h1>
|
12
tests/unit/models/plot-test.js
Normal file
12
tests/unit/models/plot-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { moduleForModel, test } from 'ember-qunit';
|
||||
|
||||
moduleForModel('plot', 'Unit | Model | plot', {
|
||||
// Specify the other units that are required for this test.
|
||||
needs: []
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let model = this.subject();
|
||||
// let store = this.store();
|
||||
assert.ok(!!model);
|
||||
});
|
12
tests/unit/models/visualization-test.js
Normal file
12
tests/unit/models/visualization-test.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { moduleForModel, test } from 'ember-qunit';
|
||||
|
||||
moduleForModel('visualization', 'Unit | Model | visualization', {
|
||||
// Specify the other units that are required for this test.
|
||||
needs: []
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let model = this.subject();
|
||||
// let store = this.store();
|
||||
assert.ok(!!model);
|
||||
});
|
11
tests/unit/routes/visualization/delete-test.js
Normal file
11
tests/unit/routes/visualization/delete-test.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:visualization/delete', 'Unit | Route | visualization/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);
|
||||
});
|
11
tests/unit/routes/visualization/edit-test.js
Normal file
11
tests/unit/routes/visualization/edit-test.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:visualization/edit', 'Unit | Route | visualization/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);
|
||||
});
|
11
tests/unit/routes/visualization/index-test.js
Normal file
11
tests/unit/routes/visualization/index-test.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:visualization/index', 'Unit | Route | visualization/index', {
|
||||
// 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);
|
||||
});
|
11
tests/unit/routes/visualization/new-test.js
Normal file
11
tests/unit/routes/visualization/new-test.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:visualization/new', 'Unit | Route | visualization/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