diff --git a/app/models/characteristic.js b/app/models/characteristic.js
index 2ab12f2..ce41fc3 100644
--- a/app/models/characteristic.js
+++ b/app/models/characteristic.js
@@ -3,8 +3,8 @@ import DS from 'ember-data';
export default DS.Model.extend({
characteristicName: DS.attr('string'),
characteristicType: DS.attr('string'),
- strains: DS.hasMany('strain'),
- measurements: DS.hasMany('measurements'),
+ strains: DS.hasMany('strain', { async: true }),
+ measurements: DS.hasMany('measurements', { async: true }),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date'),
deletedAt: DS.attr('date'),
diff --git a/app/models/measurement.js b/app/models/measurement.js
index de2b93b..5ddb298 100644
--- a/app/models/measurement.js
+++ b/app/models/measurement.js
@@ -2,8 +2,8 @@ import DS from 'ember-data';
import Ember from 'ember';
export default DS.Model.extend({
- strain: DS.belongsTo('strain'),
- characteristic: DS.attr('string'),
+ strain: DS.belongsTo('strain', { async: true }),
+ characteristic: DS.belongsTo('characteristic', { async: true }),
textMeasurementType: DS.attr('string'),
txtValue: DS.attr('string'),
numValue: DS.attr('number'),
diff --git a/app/pods/application/template.hbs b/app/pods/application/template.hbs
index 686e66b..3d14835 100644
--- a/app/pods/application/template.hbs
+++ b/app/pods/application/template.hbs
@@ -13,6 +13,9 @@
{{#link-to 'characteristics' tagName='li' href=false}}
{{#link-to 'characteristics'}}Characteristics{{/link-to}}
{{/link-to}}
+ {{#link-to 'measurements' tagName='li' href=false}}
+ {{#link-to 'measurements'}}Measurements{{/link-to}}
+ {{/link-to}}
{{#link-to 'about' tagName='li' href=false}}
{{#link-to 'about'}}About{{/link-to}}
{{/link-to}}
diff --git a/app/pods/components/measurement-index-row/component.js b/app/pods/components/measurement-index-row/component.js
new file mode 100644
index 0000000..f48ea57
--- /dev/null
+++ b/app/pods/components/measurement-index-row/component.js
@@ -0,0 +1,5 @@
+import Ember from 'ember';
+
+export default Ember.Component.extend({
+ tagName: 'tr',
+});
diff --git a/app/pods/components/measurement-index-row/template.hbs b/app/pods/components/measurement-index-row/template.hbs
new file mode 100644
index 0000000..23b22ab
--- /dev/null
+++ b/app/pods/components/measurement-index-row/template.hbs
@@ -0,0 +1,11 @@
+
+ {{#link-to 'strains.show' data.strain.id}}
+ {{scientific-name strain=data.strain}}
+ {{/link-to}}
+ |
+
+ {{data.characteristic.characteristicName}}
+ |
+
+ {{{data.computedValue}}}
+ |
diff --git a/app/pods/measurements/route.js b/app/pods/measurements/route.js
new file mode 100644
index 0000000..d393715
--- /dev/null
+++ b/app/pods/measurements/route.js
@@ -0,0 +1,21 @@
+import Ember from 'ember';
+import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
+
+export default Ember.Route.extend(AuthenticatedRouteMixin, {
+ model: function() {
+ return Ember.RSVP.hash({
+ measurements: this.store.findAll('measurement'),
+ species: this.store.findAll('species')
+ });
+ },
+ setupController: function(controller, models) {
+ var tableAttrs = [
+ { name: 'Strain', attr: 'strain.strainName' },
+ { name: 'Characteristic', attr: 'characteristic.CharacteristicName' },
+ { name: 'Value', attr: 'computedValue'}
+ ];
+ controller.set('model', models);
+ controller.set('tableAttrs', tableAttrs);
+ controller.set('row', 'measurement-index-row');
+ },
+});
diff --git a/app/pods/measurements/template.hbs b/app/pods/measurements/template.hbs
new file mode 100644
index 0000000..00d2ca6
--- /dev/null
+++ b/app/pods/measurements/template.hbs
@@ -0,0 +1,11 @@
+{{genus-name}} Measurements
+Total measurements: {{model.length}}
+
+{{
+ view "select"
+ content=model.species
+ optionValuePath="content.id"
+ optionLabelPath="content.speciesName"
+}}
+
+{{sortable-table content=model.measurements tableAttrs=tableAttrs row=row}}
diff --git a/app/router.js b/app/router.js
index 6cff3a0..b46afb6 100644
--- a/app/router.js
+++ b/app/router.js
@@ -20,6 +20,7 @@ Router.map(function() {
this.route('show', { path: ':strain_id' });
});
+ this.route('measurements');
});
export default Router;
diff --git a/server/mocks/characteristics.js b/server/mocks/characteristics.js
index ba312f4..49d4cdf 100644
--- a/server/mocks/characteristics.js
+++ b/server/mocks/characteristics.js
@@ -7,8 +7,8 @@ module.exports = function(app) {
id: 1,
characteristicName: 'α-fucosidase (API ZYM)',
characteristicType: 'Type 1',
- strains: [1],
- measurements: [1],
+ strains: [1,2],
+ measurements: [1,6],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
@@ -20,8 +20,8 @@ module.exports = function(app) {
id: 2,
characteristicName: 'α-glucosidase',
characteristicType: 'Type 2',
- strains: [1],
- measurements: [2],
+ strains: [1,2],
+ measurements: [2,7],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
@@ -33,8 +33,34 @@ module.exports = function(app) {
id: 3,
characteristicName: 'Chloramphenicol',
characteristicType: 'Type 3',
- strains: [1],
- measurements: [3],
+ strains: [1,2],
+ measurements: [3,8],
+ createdAt: "0001-01-01T00:00:00Z",
+ updatedAt: "0001-01-01T00:00:00Z",
+ deletedAt: null,
+ createdBy: 1,
+ updatedBy: 1,
+ deletedBy: null
+ },
+ {
+ id: 4,
+ characteristicName: 'Bacitracin',
+ characteristicType: 'Type 1',
+ strains: [1,2],
+ measurements: [4,9],
+ createdAt: "0001-01-01T00:00:00Z",
+ updatedAt: "0001-01-01T00:00:00Z",
+ deletedAt: null,
+ createdBy: 1,
+ updatedBy: 1,
+ deletedBy: null
+ },
+ {
+ id: 5,
+ characteristicName: 'Indole',
+ characteristicType: 'Type 2',
+ strains: [1,2],
+ measurements: [5,10],
createdAt: "0001-01-01T00:00:00Z",
updatedAt: "0001-01-01T00:00:00Z",
deletedAt: null,
diff --git a/server/mocks/measurements.js b/server/mocks/measurements.js
index 102ee0c..e4e7fdc 100644
--- a/server/mocks/measurements.js
+++ b/server/mocks/measurements.js
@@ -6,7 +6,7 @@ module.exports = function(app) {
{
id: 1,
strain: 1,
- characteristic: 'α-fucosidase (API ZYM)',
+ characteristic: 1,
textMeasurementType: 'Meas. Type 1',
txtValue: null,
numValue: null,
@@ -22,7 +22,7 @@ module.exports = function(app) {
{
id: 2,
strain: 1,
- characteristic: 'α-glucosidase',
+ characteristic: 2,
textMeasurementType: 'Meas. Type 1',
txtValue: null,
numValue: null,
@@ -38,7 +38,7 @@ module.exports = function(app) {
{
id: 3,
strain: 1,
- characteristic: 'Chloramphenicol',
+ characteristic: 3,
textMeasurementType: null,
txtValue: "text value",
numValue: null,
@@ -54,7 +54,7 @@ module.exports = function(app) {
{
id: 4,
strain: 1,
- characteristic: 'Bacitracin',
+ characteristic: 4,
textMeasurementType: null,
txtValue: null,
numValue: 123.4,
@@ -70,7 +70,7 @@ module.exports = function(app) {
{
id: 5,
strain: 1,
- characteristic: 'Indole',
+ characteristic: 5,
textMeasurementType: null,
txtValue: null,
numValue: 567.8,
@@ -86,7 +86,7 @@ module.exports = function(app) {
{
id: 6,
strain: 2,
- characteristic: 'Characteristic 1',
+ characteristic: 1,
textMeasurementType: 'Meas. Type 1',
txtValue: null,
numValue: null,
@@ -102,7 +102,7 @@ module.exports = function(app) {
{
id: 7,
strain: 2,
- characteristic: 'Characteristic 2',
+ characteristic: 2,
textMeasurementType: 'Meas. Type 1',
txtValue: null,
numValue: null,
@@ -118,7 +118,7 @@ module.exports = function(app) {
{
id: 8,
strain: 2,
- characteristic: 'Characteristic 3',
+ characteristic: 3,
textMeasurementType: null,
txtValue: "text value",
numValue: null,
@@ -134,7 +134,7 @@ module.exports = function(app) {
{
id: 9,
strain: 2,
- characteristic: 'Characteristic 4',
+ characteristic: 4,
textMeasurementType: null,
txtValue: null,
numValue: 123.4,
@@ -150,7 +150,7 @@ module.exports = function(app) {
{
id: 10,
strain: 2,
- characteristic: 'Characteristic 4',
+ characteristic: 5,
textMeasurementType: null,
txtValue: null,
numValue: 567.8,
diff --git a/tests/unit/pods/components/measurement-index-row/component-test.js b/tests/unit/pods/components/measurement-index-row/component-test.js
new file mode 100644
index 0000000..af52af6
--- /dev/null
+++ b/tests/unit/pods/components/measurement-index-row/component-test.js
@@ -0,0 +1,18 @@
+import { moduleForComponent, test } from 'ember-qunit';
+
+moduleForComponent('measurement-index-row', 'Unit | Component | measurement index row', {
+ // Specify the other units that are required for this test
+ // needs: ['component:foo', 'helper:bar']
+});
+
+test('it renders', function(assert) {
+ assert.expect(2);
+
+ // Creates the component instance
+ var component = this.subject();
+ assert.equal(component._state, 'preRender');
+
+ // Renders the component to the page
+ this.render();
+ assert.equal(component._state, 'inDOM');
+});
diff --git a/tests/unit/pods/measurements/route-test.js b/tests/unit/pods/measurements/route-test.js
new file mode 100644
index 0000000..74e119e
--- /dev/null
+++ b/tests/unit/pods/measurements/route-test.js
@@ -0,0 +1,11 @@
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('route:measurements', 'Unit | Route | measurements', {
+ // Specify the other units that are required for this test.
+ // needs: ['controller:foo']
+});
+
+test('it exists', function(assert) {
+ var route = this.subject();
+ assert.ok(route);
+});