Rough measurements search (WIP)

This commit is contained in:
Matthew Dillon 2015-06-09 14:32:15 -08:00
parent 1976b49608
commit c70dd933c5
8 changed files with 166 additions and 47 deletions

View file

@ -1,11 +1,9 @@
<td>
{{#link-to 'strains.show' data.strain.id}}
{{scientific-name strain=data.strain}}
{{/link-to}}
{{scientific-name strain=data.strain}}
</td>
<td>
{{data.characteristic.characteristicName}}
</td>
<td>
{{{data.computedValue}}}
{{{data.value}}}
</td>

View file

@ -0,0 +1,32 @@
import Ember from 'ember';
export default Ember.Component.extend({
isLoading: false,
actions: {
search: function() {
this.set('isLoading', true);
let strain = this.get('selectedStrain');
let characteristic = this.get('selectedCharacteristic');
if ((strain === 'all') && (characteristic === 'all')) {
this.store.findAll('measurement').then((measurements)=>{
this.set('measurements', measurements);
});
this.set('isLoading', false);
console.log(this.get('isLoading'));
return false;
}
let search = {};
if (strain !== 'all') {
search['strain'] = strain;
}
if (characteristic !== 'all') {
search['characteristic'] = characteristic;
}
this.store.find('measurement', search).then((measurements)=>{
this.set('measurements', measurements);
});
this.set('isLoading', false);
return false;
}
},
});

View file

@ -0,0 +1,29 @@
<div class="grid-12 gutter-50">
<div class="span-12">
{{search-button isLoading=isLoading action='search'}}
</div>
</div>
<div class="grid-12 gutter-50">
<div class="span-12">
<h3>Total matching measurements: {{measurements.length}}</h3>
</div>
</div>
{{#if isLoading}}
{{loading-panel}}
{{else}}
<table class="flakes-table">
<thead>
<tr>
<th>Strain</th>
<th>Characteristic</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{{#each measurements as |measurement|}}
{{measurement-index-row data=measurement}}
{{/each}}
</tbody>
</table>
{{/if}}