Compare commits

..

67 commits

Author SHA1 Message Date
Matthew Dillon
4f4b5d8a4d Merge branch 'master' into clostridium
* master:
  ember-cli 1.13.13
2015-11-28 11:35:23 -07:00
Matthew Dillon
b3c646cb18 Merge branch 'master' into clostridium
* master:
  ember 2.2.0 & ember-data 2.2.1
2015-11-25 21:48:26 -07:00
Matthew Dillon
26dcecaa05 Merge branch 'master' into clostridium
* master:
  Easiest to just unload the entire store
  Hide measurements on new strain
  Fix char/strain sort order
2015-11-25 21:31:24 -07:00
Matthew Dillon
d2c1609e86 Merge branch 'master' into clostridium
* master:
  Context-sensitive save-model mixin
2015-11-17 16:36:48 -07:00
Matthew Dillon
935a3511de Merge branch 'master' into clostridium
* master:
  Removing char edit text
2015-11-17 16:18:05 -07:00
Matthew Dillon
732e8482a5 Merge branch 'master' into clostridium
* master:
  Detailed characteristics view
2015-11-17 16:11:22 -07:00
Matthew Dillon
d6d9c92ef6 Merge branch 'master' into clostridium
* master:
  Use API sort order for species
2015-11-17 15:54:29 -07:00
Matthew Dillon
ab964bbca1 Merge branch 'master' into clostridium
* master:
  Compare - link to chars
2015-11-17 13:47:39 -07:00
Matthew Dillon
7c503876ac Merge branch 'master' into clostridium
* master:
  Fix up full name, again
  Force sort order for compare
2015-11-17 13:19:39 -07:00
Matthew Dillon
acb17480ec Merge branch 'master' into clostridium
* master:
  select2 4.0
2015-11-17 12:34:20 -07:00
Matthew Dillon
019031dd58 Merge branch 'master' into clostridium
* master:
  User adapter
2015-11-17 09:59:12 -07:00
Matthew Dillon
838588da54 Merge branch 'master' into clostridium
* master:
  User permission error handling
2015-11-17 09:34:43 -07:00
Matthew Dillon
74e901380e Merge branch 'master' into clostridium
* master:
  Password reset verbiage
2015-11-17 09:20:25 -07:00
Matthew Dillon
2aa432376f Merge branch 'master' into clostridium
* master:
  Fix strains index strain name formatting
2015-11-17 09:08:42 -07:00
Matthew Dillon
4aaa9cdfb9 Merge branch 'master' into clostridium
* master:
  ember 2 series
  Remove globals initializer
2015-11-17 08:13:07 -07:00
Matthew Dillon
0815e4c4c9 Merge branch 'master' into clostridium
* master:
  ESA 1.0.1
2015-11-16 18:29:15 -07:00
Matthew Dillon
d93f4a3152 Merge branch 'master' into clostridium
* master:
  Lint
2015-11-16 18:15:42 -07:00
Matthew Dillon
aa4ca05897 Merge branch 'master' into clostridium
* master:
  Customizing refresh token flow
  Remove quint-notifications
  Tweaking bower.json to fix CI build errors
  Changed mind on strain model MU prop
  Remove ES6 features from config
2015-11-16 16:59:10 -07:00
Matthew Dillon
09650e0f1b Merge branch 'master' into clostridium
* master:
  Inline images in CSP
  Strains form formatting
  Clean up delete button and tests
  Lint
2015-11-16 10:55:10 -07:00
Matthew Dillon
6574f4986c Merge branch 'master' into clostridium
* master:
  select2 ember-cli-build
2015-11-13 17:01:36 -07:00
Matthew Dillon
27c2788bd2 Merge branch 'master' into clostridium
* master:
  Dropping ember-select2 for custom component
  Update getProperty helper
  #55, species
  Rest of strain MU
  strain.strainNameMU to component
  Refactor delete button
  Handle password change errors
  New Ajax Error util
  ember-cli 1.13.12
2015-11-13 15:50:32 -07:00
Matthew Dillon
8730b6659f fixed merge conflict in tests/index 2015-11-13 08:33:04 -07:00
Matthew Dillon
dc5b54cfbf Merge branch 'master' into clostridium
* master:
  Refactor characteristics/new
  Refactor characteristics/edit
  Refactor characteristics/show
  Refactor characteristics/index
  MetaData mixin
  Additional creation checks
  Set up tests for existing pod
2015-11-05 15:37:01 -07:00
Matthew Dillon
0a039e57c4 Merge branch 'master' into clostridium
* master:
  Add staging env
  Tweak shippable config
2015-11-05 09:38:50 -07:00
Matthew Dillon
6bdbacf978 Tweak mirage for clostridium 2015-11-04 20:32:22 -07:00
Matthew Dillon
d674d07951 Merge branch 'master' into clostridium
* master: (27 commits)
  Temporary fix for quill editor use in strains edit
  Test new species (plus minor cleanup)
  Wrapping up form cleanup
  Quill DDAU
  Fixed up checkbox input
  WIP (checkbox)
  ember-one-way-input
  DeleteModel Mixin
  Using mixins on new species
  ElevatedAccess Mixin
  SaveModel Mixin
  Refactor species edit
  Refactor species/show
  fix format date import
  nvm
  Drop node version
  trying a different phantomjs route
  Rough in species index test
  Tweak mirage config
  ember-cli-mirage
  ...
2015-11-04 20:29:14 -07:00
Matthew Dillon
6509f63f00 Merge branch 'master' into clostridium
* master:
  Upgrade ember-cli-flash
2015-10-29 13:06:30 -07:00
Matthew Dillon
6810c209d8 update merge 2015-10-29 12:09:26 -07:00
Matthew Dillon
6a8a4c1a36 Merge branch 'master' into clostridium
* master:
  Clean up password reset
2015-10-27 16:20:20 -07:00
Matthew Dillon
80bd608045 Merge branch 'master' into clostridium
* master:
  Revert #22
2015-10-21 07:28:59 -07:00
Matthew Dillon
fd9157007a Merge branch 'master' into clostridium
* master:
  Missing semicolon in login controller
2015-10-20 20:35:31 -07:00
Matthew Dillon
c17abc6829 Missing pod prefix 2015-10-20 18:16:41 -07:00
38daf6ea5b fixing config 2015-10-20 16:46:11 -07:00
7665452f72 Merge branch 'master' into clostridium
* master:
  Fix "New Strain" button under species edit
  Don't transition to loading route during login
2015-10-19 16:52:31 -07:00
13f8c5afcc Merge branch 'master' into clostridium
* master:
  Add clickable to strains chars table
  Sort meas table in chars
  Fixes #33
  Manually sort strains/chars
  Refresh token notes
  Linting
2015-10-19 15:42:57 -07:00
Matthew Dillon
f6a175980a Merge branch 'master' into clostridium
* master:
  Clean up beforeModel(s)
  Remove unneeded user model hook
  404/Not Found
2015-10-14 13:12:48 -07:00
Matthew Dillon
075585c54f Merge branch 'master' into clostridium
* master:
  Show validation errors on save
2015-10-14 10:30:00 -07:00
Matthew Dillon
c505afd0fe Merge branch 'master' into clostridium
* master:
  Drop soft delete
2015-10-13 16:34:23 -07:00
Matthew Dillon
421831b5a6 Merge branch 'master' into clostridium
* master:
  Need to wait for currentUser promise
  Tweak custom session
  Keep non-admins out of user profiles
2015-10-13 10:49:52 -07:00
Matthew Dillon
096e2dca20 Merge branch 'master' into clostridium
* master:
  Change password
  Clear store on role change
  Roughing in roles selection
  Confirm delete on meas/char
  Delete strains
  Delete species
  Delete characteristic
  minor cleanup
  ember 1.13.7 & ember-data 1.13.13
  Edit user
  Adapter error deprecated.
  Add characteristic/measurement to strain
  Delete measurement
  Track changes
2015-10-12 20:48:27 -07:00
Matthew Dillon
418b294634 Merge branch 'master' into clostridium
* master:
  Refresh token
2015-09-17 15:58:25 -07:00
Matthew Dillon
56888c7fba Merge branch 'master' into clostridium
* master:
  Notes
  Cleaning up measurement edit
  Dummy measurement edit
  Fix login error transition
2015-09-17 11:01:04 -07:00
Matthew Dillon
f4939a962e Merge branch 'master' into clostridium
* master:
  Drop isEditing
  Fix table widths
2015-09-10 16:26:28 -07:00
Matthew Dillon
53650c7808 Merge branch 'master' into clostridium
* master:
  Working on users
  Roughing in user admin
  Add measurements to strains page
  Clean up models
  Application-wide serializer
  Create and edit characteristics
  Characteristics details
  Rough in detail view for characteristics
  Restructuring forms
2015-09-09 16:54:10 -07:00
Matthew Dillon
1ce84c7269 Merge branch 'master' into clostridium
* master:
  Removing measurements route
  Edit characteristic
  'Select All' in compare.
  Fixed sort order in strains list
  genbank url for whole genome sequences
2015-09-04 09:32:05 -07:00
Matthew Dillon
9696313568 Merge branch 'master' into clostridium
* master:
  DS deprecation (rollback)
  Fix up moment js
  Drop brocfile
  ember-cli 1.13.8
  Fix transition deprecation
  Upgrade ember-cli-flash
2015-08-24 19:29:10 -07:00
Matthew Dillon
4d7cc5fc56 Merge branch 'master' into clostridium
* master:
  Enabling user zoom

Conflicts:
	app/index.html
2015-07-20 16:19:38 -08:00
Matthew Dillon
765bc45ce7 Merge branch 'master' into clostridium
* master:
  Fix broken strain reference
  Rich text species and strains
  Add in quill WYSIWYG
2015-07-20 12:23:17 -08:00
Matthew Dillon
b5a260615b Merge branch 'master' into clostridium
* master:
  Add CSV download for compare (change backing service, too)
  Drop new user component, for now
  Clean up some loading stuff
2015-07-17 16:39:57 -08:00
Matthew Dillon
8c3bf30ace Merge branch 'master' into clostridium
* master:
  Clean up forms a bit
  Missing import in ajax-request
2015-07-16 21:24:46 -08:00
Matthew Dillon
c996dd5374 Merge branch 'master' into clostridium
* master:
  Handle user lockouts (new authenticator added)
  catch split exception in parsebase64
  Refactor ajax request
2015-07-16 21:13:54 -08:00
Matthew Dillon
cbac28e040 Merge branch 'master' into clostridium
* master:
  Working on deprecations
2015-07-15 15:51:54 -08:00
Matthew Dillon
cca97e7542 Merge branch 'master' into clostridium
* master:
  Clean up verification
  Update flash message
  Inject global var service in routes
2015-07-14 13:43:57 -08:00
Matthew Dillon
14a678092e Missed in merge 2015-07-14 08:05:01 -08:00
Matthew Dillon
0ab0cf5a6a Merge branch 'master' into clostridium
* master:
  Remove duplicate mixins
  auto-reload compare/results model, cleanup
2015-07-14 08:03:21 -08:00
Matthew Dillon
f295082592 update merge from master 2015-07-13 16:32:03 -08:00
Matthew Dillon
8ab97c00e1 Updated merge from master 2015-07-07 14:41:40 -08:00
Matthew Dillon
9e8b02ac90 Overflow table 2015-07-07 14:38:36 -08:00
Matthew Dillon
3436989a89 Edit species 2015-07-07 14:28:16 -08:00
Matthew Dillon
583d7ca0db SQUASH 2015-07-07 14:28:06 -08:00
Matthew Dillon
38894d94e7 Sideload strains in species list 2015-07-07 11:09:41 -08:00
Matthew Dillon
ae7f3bdafa Test-drive metadata 2015-07-07 09:56:49 -08:00
Matthew Dillon
4bbf931853 Going back to model reference 2015-07-07 08:38:05 -08:00
Matthew Dillon
9aed858982 Continuing with species refactor 2015-07-07 07:30:48 -08:00
Matthew Dillon
622cd0faaf Species edit refactor (wip) 2015-07-06 11:02:41 -08:00
Matthew Dillon
236a622505 Merge branch 'master' into clostridium
* master:
  Stopgap sort order + cleanup
2015-06-17 16:24:23 -08:00
Matthew Dillon
6d04a8a6c8 init clostridium 2015-06-17 14:47:40 -08:00
27 changed files with 114 additions and 13305 deletions

1
.gitignore vendored
View file

@ -15,4 +15,3 @@
/libpeerconnection.log /libpeerconnection.log
npm-debug.log npm-debug.log
testem.log testem.log
.firebase

View file

@ -1,4 +1,4 @@
# hymenobacterdotinfo # clostridiumdotinfo
This ember application is an interface for the [bactdb](https://github.com/thermokarst/bactdb). This ember application is an interface for the [bactdb](https://github.com/thermokarst/bactdb).

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>hymenobacter.info</title> <title>clostridium.info</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=10.0, minimum-scale=1.0, user-scalable=yes"> <meta name="viewport" content="initial-scale=1.0, maximum-scale=10.0, minimum-scale=1.0, user-scalable=yes">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
@ -12,7 +12,7 @@
{{content-for 'head'}} {{content-for 'head'}}
<link rel="stylesheet" href="assets/vendor.css"> <link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/hymenobacterdotinfo.css"> <link rel="stylesheet" href="assets/clostridiumdotinfo.css">
{{content-for 'head-footer'}} {{content-for 'head-footer'}}
</head> </head>
@ -20,7 +20,7 @@
{{content-for 'body'}} {{content-for 'body'}}
<script src="assets/vendor.js"></script> <script src="assets/vendor.js"></script>
<script src="assets/hymenobacterdotinfo.js"></script> <script src="assets/clostridiumdotinfo.js"></script>
{{content-for 'body-footer'}} {{content-for 'body-footer'}}
</body> </body>

View file

@ -7,7 +7,7 @@ export default function() {
export function testConfig() { export function testConfig() {
this.urlPrefix = 'https://bactdb-test.herokuapp.com'; this.urlPrefix = 'https://bactdb-test.herokuapp.com';
this.namespace = '/api/hymenobacter'; this.namespace = '/api/clostridium';
this.timing = 0; this.timing = 0;
this.get('/users'); this.get('/users');

View file

@ -8,10 +8,7 @@ export default Mixin.create({
actions: { actions: {
delete: function() { delete: function() {
this.get('model').destroyRecord().then(() => { this.get('model').destroyRecord().then(() => {
// Instead of unloading the entire store, we keep the loaded user models this.get('store').unloadAll();
['species', 'strain', 'characteristic', 'measurement'].map((model) => {
this.get('store').unloadAll(model);
});
this.transitionToRoute(this.get('transitionRoute')); this.transitionToRoute(this.get('transitionRoute'));
}); });
}, },

View file

@ -10,7 +10,3 @@
<div> <div>
{{link-to 'Forget your password?' 'users.requestlockouthelp'}} {{link-to 'Forget your password?' 'users.requestlockouthelp'}}
</div> </div>
<br>
<div>
Just checking things out? Log in with email <code>read-only</code> and password <code>bacteria</code>!
</div>

View file

@ -1,3 +1,3 @@
<div class="about"> <div class="about">
<p>This is some information about hymenobacter.info</p> <p>This is some information about clostridium.info</p>
</div> </div>

View file

@ -1,61 +1,36 @@
import Ember from 'ember'; import Ember from 'ember';
import SaveModel from '../../../../mixins/save-model';
import ajaxError from '../../../../utils/ajax-error';
const { Controller, RSVP, inject: { service } } = Ember; const { Controller } = Ember;
export default Controller.extend({
ajaxError: service('ajax-error'),
export default Controller.extend(SaveModel, {
// Required for SaveModel mixin
fallbackRouteSave: 'protected.strains.show', fallbackRouteSave: 'protected.strains.show',
fallbackRouteCancel: 'protected.strains.show', fallbackRouteCancel: 'protected.strains.show',
actions: { actions: {
save: function(properties, deleteQueue, updateQueue) { addCharacteristic: function() {
let promises = []; return this.store.createRecord('measurement', {
properties.measurements.forEach((measurement) => { characteristic: this.store.createRecord('characteristic', { sortOrder: -999 }),
if (measurement.get('isNew')) {
promises.push(measurement.save());
}
}); });
},
updateQueue.forEach((measurement) => { saveMeasurement: function(measurement, properties) {
promises.push(measurement.save()); measurement.setProperties(properties);
}); measurement.save().then(() => {
deleteQueue.forEach((measurement) => {
promises.push(measurement.destroyRecord());
});
const model = this.get('model');
const fallbackRoute = this.get('fallbackRouteSave');
RSVP.all(promises).then(() => {
// Can't call _super inside promise, have to reproduce save-model
// mixin here :-(
model.setProperties(properties);
model.save().then((model) => {
this.get('flashMessages').clearMessages(); this.get('flashMessages').clearMessages();
this.transitionToRoute(fallbackRoute, model); }, () => {
}); ajaxError(measurement.get('errors'), this.get('flashMessages'));
}, (errors) => {
this.get('ajaxError').alert(errors);
}); });
}, },
cancel: function() { deleteMeasurement: function(measurement) {
const model = this.get('model'); const characteristic = measurement.get('characteristic');
if (characteristic.get('isNew')) {
model.get('errors').clear(); characteristic.destroyRecord();
model.rollbackAttributes();
if (model.get('isNew')) {
this.transitionToRoute(this.get('fallbackRouteCancel'));
} else {
this.transitionToRoute(this.get('fallbackRouteCancel'), model);
} }
}, measurement.destroyRecord();
addMeasurement: function() {
return this.store.createRecord('measurement');
}, },
}, },

View file

@ -2,8 +2,10 @@
protected/strains/strain-form protected/strains/strain-form
strain=model strain=model
speciesList=speciesList speciesList=speciesList
add-measurement=(action "addMeasurement") add-characteristic=(action "addCharacteristic")
allCharacteristics=allCharacteristics allCharacteristics=allCharacteristics
save-measurement=(action "saveMeasurement")
delete-measurement=(action "deleteMeasurement")
on-save=(action "save") on-save=(action "save")
on-cancel=(action "cancel") on-cancel=(action "cancel")
}} }}

View file

@ -10,8 +10,6 @@ export default Component.extend({
allCharacteristics: null, allCharacteristics: null,
measurement: null, measurement: null,
isDirty: null, isDirty: null,
isNew: false,
isQueued: false,
// Actions // Actions
"save-measurement": null, "save-measurement": null,
@ -24,23 +22,11 @@ export default Component.extend({
notes: null, notes: null,
resetOnInit: Ember.on('init', function() { resetOnInit: Ember.on('init', function() {
this._resetProperties();
}),
_resetProperties: function() {
this.get('propertiesList').forEach((field) => { this.get('propertiesList').forEach((field) => {
const valueInMeasurement = this.get('measurement').get(field); const valueInMeasurement = this.get('measurement').get(field);
this.set(field, valueInMeasurement); this.set(field, valueInMeasurement);
}); });
// Read-only attributes }),
this.set('isNew', this.get('measurement.isNew'));
if (this.get('isNew') && !this.get('isQueued')) {
this.set('isEditing', true);
} else {
this.set('isEditing', false);
}
this.set('isDirty', false);
},
updateField: function(property, value) { updateField: function(property, value) {
this.set(property, value); this.set(property, value);
@ -54,22 +40,12 @@ export default Component.extend({
actions: { actions: {
edit: function() { edit: function() {
this.set('isEditing', true); this.toggleProperty('isEditing');
}, },
save: function() { save: function() {
this.attrs['save-measurement'](this.get('measurement'), this.getProperties(this.get('propertiesList'))); this.attrs['save-measurement'](this.get('measurement'), this.getProperties(this.get('propertiesList')));
this.set('isQueued', true); this.toggleProperty('isEditing');
this._resetProperties();
},
cancel: function() {
if (this.get('isNew')) {
this.attrs['delete-measurement'](this.get('measurement'));
} else {
this._resetProperties();
this.set('isEditing', false);
}
}, },
delete: function() { delete: function() {

View file

@ -1,7 +1,5 @@
{{#if isEditing}} {{#if isEditing}}
<td> <td></td>
{{{characteristic.characteristicTypeName}}}
</td>
<td> <td>
<select onchange={{action "characteristicDidChange" value="target.value"}}> <select onchange={{action "characteristicDidChange" value="target.value"}}>
{{#each allCharacteristics as |characteristicChoice|}} {{#each allCharacteristics as |characteristicChoice|}}
@ -17,13 +15,14 @@
</td> </td>
{{#if canEdit}} {{#if canEdit}}
<td> <td>
<button class="button-gray smaller" {{action 'cancel'}}>
Cancel
</button>
{{#if isDirty}} {{#if isDirty}}
<button class="button-green smaller" {{action 'save'}}> <button class="button-green smaller" {{action 'save'}}>
Save Save
</button> </button>
{{else}}
<button class="button-gray smaller" {{action 'save'}}>
Cancel
</button>
{{/if}} {{/if}}
</td> </td>
{{/if}} {{/if}}

View file

@ -5,13 +5,13 @@ const { sort } = computed;
export default Component.extend({ export default Component.extend({
// Passed in // Passed in
measurements: null, strain: null,
allCharacteristics: null, allCharacteristics: null,
canEdit: false, canEdit: false,
canAdd: false, canAdd: false,
// Actions // Actions
"add-measurement": null, "add-characteristic": null,
"save-measurement": null, "save-measurement": null,
"delete-measurement": null, "delete-measurement": null,
@ -19,11 +19,15 @@ export default Component.extend({
sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'], sortParams: ['characteristic.characteristicTypeName', 'characteristic.sortOrder', 'characteristic.characteristicName'],
sortAsc: true, sortAsc: true,
paramsChanged: false, paramsChanged: false,
sortedMeasurements: sort('measurements', 'sortParams'), sortedMeasurements: sort('strain.measurements', 'sortParams'),
measurementsPresent: computed('strain.measurements', function() {
return this.get('strain.measurements.length') > 0;
}),
actions: { actions: {
addMeasurement: function() { addCharacteristic: function() {
return this.attrs['add-measurement'](); const newChar = this.attrs['add-characteristic']();
this.get('strain.measurements').addObject(newChar);
}, },
changeSortParam: function(col) { changeSortParam: function(col) {

View file

@ -1,11 +1,12 @@
{{#if canAdd}} {{#if canAdd}}
<br> <br>
<button class="button-green smaller" {{action "addMeasurement"}}> <button class="button-green smaller" {{action "addCharacteristic"}}>
Add measurement Add characteristic
</button> </button>
<br><br> <br><br>
{{/if}} {{/if}}
{{#if measurementsPresent}}
{{#if paramsChanged}} {{#if paramsChanged}}
<button class="button-gray smaller" {{action 'resetSortParam'}}> <button class="button-gray smaller" {{action 'resetSortParam'}}>
Reset sort Reset sort
@ -47,10 +48,9 @@
allCharacteristics=allCharacteristics allCharacteristics=allCharacteristics
canEdit=canEdit canEdit=canEdit
}} }}
{{else}}
<tr>
<td colspan="5">No Measurements on Record</td>
</tr>
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{else}}
No measurements on record.
{{/if}}

View file

@ -71,11 +71,11 @@
{{! ROW 5 }} {{! ROW 5 }}
<div class="grid-1 gutter-20"> <div class="grid-1 gutter-20">
<dl class="span-1"> <dl class="span-1">
<dt>Characteristic Measurements</dt> <dt>Characteristics</dt>
<dd> <dd>
{{ {{
protected/strains/measurements-table protected/strains/measurements-table
measurements=strain.measurements strain=strain
canEdit=false canEdit=false
canAdd=false canAdd=false
}} }}

View file

@ -9,22 +9,22 @@ export default Component.extend(SetupMetaData, {
isNew: null, isNew: null,
isDirty: false, isDirty: false,
speciesList: null, speciesList: null,
allCharacteristics: [], allCharacteristics: null,
updateQueue: [],
deleteQueue: [],
// Actions // Actions
"on-save": null, "on-save": null,
"on-cancel": null, "on-cancel": null,
"on-update": null, "on-update": null,
"add-measurements": null, "add-characteristic": null,
"save-measurement": null,
"delete-measurement": null,
// CPs // CPs
sortParams: ['sortOrder'], sortParams: ['sortOrder'],
sortedSpeciesList: sort('speciesList', 'sortParams'), sortedSpeciesList: sort('speciesList', 'sortParams'),
// Property mapping // Property mapping
propertiesList: ['strainName', 'typeStrain', 'species', 'isolatedFrom', 'accessionNumbers', 'genbank', 'wholeGenomeSequence', 'notes', 'measurements'], propertiesList: ['strainName', 'typeStrain', 'species', 'isolatedFrom', 'accessionNumbers', 'genbank', 'wholeGenomeSequence', 'notes'],
strainName: null, strainName: null,
typeStrain: null, typeStrain: null,
species: null, species: null,
@ -33,55 +33,15 @@ export default Component.extend(SetupMetaData, {
genbank: null, genbank: null,
wholeGenomeSequence: null, wholeGenomeSequence: null,
notes: null, notes: null,
measurements: [],
// Dropdown menu
characteristics: [],
charSortParams: ['characteristicTypeName', 'sortOrder', 'characteristicName'],
sortedCharacteristics: sort('characteristics', 'charSortParams'),
setupCharacteristics: Ember.on('init', function() {
const tempArray = this._resetArray(this.get('allCharacteristics'));
this.set('characteristics', tempArray);
}),
resetOnInit: Ember.on('init', function() { resetOnInit: Ember.on('init', function() {
this._resetProperties();
}),
_resetArray: function(arr) {
let tempArray = [];
arr.forEach((val) => {
if (!val.get('isNew')) {
tempArray.push(val);
}
});
return tempArray;
},
_resetProperties: function() {
// Still some coupling going on here because of adding strain to measurement
this.get('measurements').forEach((val) => {
if (val.get('hasDirtyAttributes')) {
val.rollbackAttributes();
}
if (val.get('isNew')) {
this.get('strain.measurements').removeObject(val);
}
});
this.get('propertiesList').forEach((field) => { this.get('propertiesList').forEach((field) => {
const valueInStrain = this.get('strain').get(field); const valueInStrain = this.get('strain').get(field);
if (field === 'measurements') {
const tempArray = this._resetArray(valueInStrain);
this.set(field, tempArray);
} else {
this.set(field, valueInStrain); this.set(field, valueInStrain);
}
}); });
this.set('updateQueue', []);
this.set('deleteQueue', []);
// Read-only attributes // Read-only attributes
this.set('isNew', this.get('strain.isNew')); this.set('isNew', this.get('strain.isNew'));
}, }),
updateField: function(property, value) { updateField: function(property, value) {
this.set(property, value); this.set(property, value);
@ -95,32 +55,23 @@ export default Component.extend(SetupMetaData, {
actions: { actions: {
save: function() { save: function() {
return this.attrs['on-save'](this.getProperties(this.get('propertiesList')), this.get('deleteQueue'), this.get('updateQueue')); return this.attrs['on-save'](this.getProperties(this.get('propertiesList')));
}, },
cancel: function() { cancel: function() {
this._resetProperties();
return this.attrs['on-cancel'](); return this.attrs['on-cancel']();
}, },
addMeasurement: function() { addCharacteristic: function() {
const measurement = this.attrs['add-measurement'](); return this.attrs['add-characteristic']();
this.get('measurements').pushObject(measurement);
}, },
saveMeasurement: function(measurement, properties) { saveMeasurement: function(measurement, properties) {
measurement.setProperties(properties); return this.attrs['save-measurement'](measurement, properties);
measurement.set('strain', this.get('strain'));
if (!measurement.get('isNew')) {
this.get('updateQueue').pushObject(measurement);
}
this.set('isDirty', true);
}, },
deleteMeasurement: function(measurement) { deleteMeasurement: function(measurement) {
this.get('deleteQueue').pushObject(measurement); return this.attrs['delete-measurement'](measurement);
this.get('measurements').removeObject(measurement);
this.set('isDirty', true);
}, },
strainNameDidChange: function(value) { strainNameDidChange: function(value) {
@ -153,7 +104,7 @@ export default Component.extend(SetupMetaData, {
}, },
notesDidChange: function(value) { notesDidChange: function(value) {
this.updateField('notes', value); this.updateField('strain.notes', value);
}, },
}, },
}); });

View file

@ -61,9 +61,9 @@
<div> <div>
{{ {{
protected/strains/measurements-table protected/strains/measurements-table
measurements=measurements strain=strain
add-measurement=(action "addMeasurement") add-characteristic=(action "addCharacteristic")
allCharacteristics=sortedCharacteristics allCharacteristics=allCharacteristics
save-measurement=(action "saveMeasurement") save-measurement=(action "saveMeasurement")
delete-measurement=(action "deleteMeasurement") delete-measurement=(action "deleteMeasurement")
canEdit=strain.canEdit canEdit=strain.canEdit

View file

@ -1,11 +1,11 @@
import Ember from 'ember'; import Ember from 'ember';
import ajaxErrorNew from '../../../../utils/ajax-error-new';
const { Controller, inject: { service } } = Ember; const { Controller, inject: { service } } = Ember;
export default Controller.extend({ export default Controller.extend({
session: service(), session: service(),
ajax: service(), ajax: service(),
ajaxError: service('ajax-error'),
currentUser: service('session-account'), currentUser: service('session-account'),
actions: { actions: {
@ -15,13 +15,12 @@ export default Controller.extend({
this.get('ajax').post('/users/password', { data: data }).then(() => { this.get('ajax').post('/users/password', { data: data }).then(() => {
this.transitionToRoute('protected.users.show', id); this.transitionToRoute('protected.users.show', id);
this.get('flashMessages').information('Your password has been changed.'); this.get('flashMessages').information('Your password has been changed.');
}, (errors) => { }, (error) => {
this.get('ajaxError').alert(errors); ajaxErrorNew(error, this.get('flashMessages'));
}); });
}, },
cancel: function() { cancel: function() {
this.get('flashMessages').clearMessages();
this.transitionToRoute('protected.users.show', this.get('currentUser.account.id')); this.transitionToRoute('protected.users.show', this.get('currentUser.account.id'));
}, },
}, },

View file

@ -5,41 +5,24 @@ const { RESTSerializer } = DS;
const { isNone } = Ember; const { isNone } = Ember;
export default RESTSerializer.extend({ export default RESTSerializer.extend({
serializeBelongsTo: function(snapshot, json, relationship) { isNewSerializerAPI: true,
const key = relationship.key;
if (this._canSerialize(key)) {
const belongsToId = snapshot.belongsTo(key, { id: true });
let payloadKey = this._getMappedKey(key, snapshot.type);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "belongsTo", "serialize");
}
if (isNone(belongsToId)) {
json[payloadKey] = null;
} else {
json[payloadKey] = +belongsToId;
}
if (relationship.options.polymorphic) { serializeBelongsTo: function(snapshot, json, relationship) {
this.serializePolymorphicType(snapshot, json, relationship); let key = relationship.key;
} const belongsTo = snapshot.belongsTo(key);
} key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;
json[key] = isNone(belongsTo) ? belongsTo : +belongsTo.record.id;
}, },
serializeHasMany: function(snapshot, json, relationship) { serializeHasMany: function(snapshot, json, relationship) {
const key = relationship.key; let key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) { const hasMany = snapshot.hasMany(key);
const hasMany = snapshot.hasMany(key, { ids: true }); key = this.keyForRelationship ? this.keyForRelationship(key, "hasMany", "serialize") : key;
if (hasMany !== undefined) {
let payloadKey = this._getMappedKey(key, snapshot.type); json[key] = [];
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
}
json[payloadKey] = [];
hasMany.forEach((item) => { hasMany.forEach((item) => {
json[payloadKey].push(+item); json[key].push(+item.id);
}); });
}
}
}, },
}); });

View file

@ -1,19 +0,0 @@
import Ember from 'ember';
const { Service, inject: { service } } = Ember;
export default Service.extend({
flashMessages: service(),
alert: function(error) {
const flash = this.get('flashMessages');
flash.clearMessages();
window.scrollTo(0,0);
error.errors.forEach((error) => {
console.error(error);
const source = error.source.pointer.split('/');
flash.error(`${source[source.length-1].replace(/([A-Z])/g, ' $1').capitalize()} - ${error.detail}`);
});
}
});

View file

@ -0,0 +1,7 @@
export default function ajaxErrorNew(error, flash) {
flash.clearMessages();
error.errors.forEach((error) => {
const source = error.source.pointer.split('/');
flash.error(`${source[source.length-1].replace(/([A-Z])/g, ' $1').capitalize()} - ${error.detail}`);
});
}

View file

@ -1,5 +1,5 @@
{ {
"name": "hymenobacterdotinfo", "name": "clostridiumdotinfo",
"dependencies": { "dependencies": {
"jquery": "~2.1.1", "jquery": "~2.1.1",
"ember": "~2.2.0", "ember": "~2.2.0",

View file

@ -2,7 +2,7 @@
module.exports = function(environment) { module.exports = function(environment) {
var ENV = { var ENV = {
modulePrefix: 'hymenobacterdotinfo', modulePrefix: 'clostridiumdotinfo',
environment: environment, environment: environment,
baseURL: '/', baseURL: '/',
locationType: 'auto', locationType: 'auto',
@ -12,9 +12,9 @@ module.exports = function(environment) {
} }
}, },
APP: { APP: {
genus: 'hymenobacter', genus: 'clostridium',
}, },
podModulePrefix: 'hymenobacterdotinfo/pods', podModulePrefix: 'clostridiumdotinfo/pods',
flashMessageDefaults: { flashMessageDefaults: {
sticky: true, sticky: true,
type: 'error', type: 'error',

View file

@ -1,5 +1,5 @@
{ {
"firebase": "hymenobacter-test", "firebase": "clostridium-test",
"public": "./dist", "public": "./dist",
"ignore": [ "ignore": [
"firebase.json", "firebase.json",

13051
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "hymenobacterdotinfo", "name": "clostridiumdotinfo",
"version": "0.0.0", "version": "0.0.0",
"description": "Small description for hymenobacterdotinfo goes here", "description": "Small description for clostridiumdotinfo goes here",
"private": true, "private": true,
"directories": { "directories": {
"doc": "doc", "doc": "doc",
@ -10,11 +10,7 @@
"scripts": { "scripts": {
"build": "ember build", "build": "ember build",
"start": "ember server", "start": "ember server",
"test": "ember test", "test": "ember test"
"bower": "bower",
"ember": "ember",
"firebase": "firebase",
"deployProd": "firebase deploy -e prod"
}, },
"repository": "", "repository": "",
"engines": { "engines": {
@ -44,9 +40,5 @@
"ember-export-application-global": "^1.0.4", "ember-export-application-global": "^1.0.4",
"ember-one-way-input": "0.1.3", "ember-one-way-input": "0.1.3",
"ember-simple-auth": "1.0.1" "ember-simple-auth": "1.0.1"
},
"dependencies": {
"bower": "^1.8.8",
"firebase-tools": "^7.12.1"
} }
} }

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Hymenobacterdotinfo Tests</title> <title>clostridiumdotinfo Tests</title>
<meta name="description" content=""> <meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -11,7 +11,7 @@
{{content-for 'test-head'}} {{content-for 'test-head'}}
<link rel="stylesheet" href="assets/vendor.css"> <link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/hymenobacterdotinfo.css"> <link rel="stylesheet" href="assets/clostridiumdotinfo.css">
<link rel="stylesheet" href="assets/test-support.css"> <link rel="stylesheet" href="assets/test-support.css">
{{content-for 'head-footer'}} {{content-for 'head-footer'}}
@ -23,7 +23,7 @@
<script src="assets/vendor.js"></script> <script src="assets/vendor.js"></script>
<script src="assets/test-support.js"></script> <script src="assets/test-support.js"></script>
<script src="assets/hymenobacterdotinfo.js"></script> <script src="assets/clostridiumdotinfo.js"></script>
<script src="testem.js" integrity=""></script> <script src="testem.js" integrity=""></script>
<script src="assets/tests.js"></script> <script src="assets/tests.js"></script>
<script src="assets/test-loader.js"></script> <script src="assets/test-loader.js"></script>