1
0
Fork 0
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:
Markus Grigull 2016-06-28 10:57:34 +02:00
parent 75c8464b6c
commit 5bc260b81c
19 changed files with 157 additions and 4 deletions

12
app/models/plot.js Normal file
View 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:
});

View file

@ -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 })
});

View 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 })
});

View file

@ -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;

View 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);
}
});

View 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);
}
});

View 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);
}
});

View 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, {
});

View file

@ -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>

View file

@ -0,0 +1 @@
<h1>Delete</h1>

View file

@ -0,0 +1 @@
<h1>Edit</h1>

View 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>

View file

@ -0,0 +1 @@
<h1>New visualization</h1>

View 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);
});

View 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);
});

View 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);
});

View 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);
});

View 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);
});

View 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);
});