compare/results component
This commit is contained in:
parent
268ab18cf6
commit
aeb3206fd9
8 changed files with 113 additions and 63 deletions
|
@ -0,0 +1,19 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component, computed, inject: { service } } = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
session: service(),
|
||||
|
||||
strains: null,
|
||||
characteristics: null,
|
||||
strain_ids: null,
|
||||
characteristic_ids: null,
|
||||
|
||||
csvLink: computed('strain_ids', 'characteristic_ids', function() {
|
||||
const token = encodeURIComponent(this.get('session.data.authenticated.access_token'));
|
||||
return `${this.get('globals.apiURL')}/api/${this.get('globals.genus')}/` +
|
||||
`compare?token=${token}&strain_ids=${this.get('strain_ids')}&` +
|
||||
`characteristic_ids=${this.get('characteristic_ids')}&mimeType=csv`;
|
||||
}),
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
<table class="flakes-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Characteristic</th>
|
||||
{{#each strains as |strain|}}
|
||||
<th>
|
||||
{{#link-to 'protected.strains.show' strain.id classBinding="data.typeStrain:type-strain"}}
|
||||
{{strain.fullNameMU}}
|
||||
{{/link-to}}
|
||||
</th>
|
||||
{{/each}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each characteristics as |row|}}
|
||||
<tr>
|
||||
{{#each row key="@index" as |col|}}
|
||||
<td>{{col}}</td>
|
||||
{{/each}}
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
<hr>
|
||||
<a href="{{csvLink}}" download>Download as CSV</a>
|
Reference in a new issue