Compare commits
67 commits
master
...
clostridiu
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4f4b5d8a4d | ||
![]() |
b3c646cb18 | ||
![]() |
26dcecaa05 | ||
![]() |
d2c1609e86 | ||
![]() |
935a3511de | ||
![]() |
732e8482a5 | ||
![]() |
d6d9c92ef6 | ||
![]() |
ab964bbca1 | ||
![]() |
7c503876ac | ||
![]() |
acb17480ec | ||
![]() |
019031dd58 | ||
![]() |
838588da54 | ||
![]() |
74e901380e | ||
![]() |
2aa432376f | ||
![]() |
4aaa9cdfb9 | ||
![]() |
0815e4c4c9 | ||
![]() |
d93f4a3152 | ||
![]() |
aa4ca05897 | ||
![]() |
09650e0f1b | ||
![]() |
6574f4986c | ||
![]() |
27c2788bd2 | ||
![]() |
8730b6659f | ||
![]() |
dc5b54cfbf | ||
![]() |
0a039e57c4 | ||
![]() |
6bdbacf978 | ||
![]() |
d674d07951 | ||
![]() |
6509f63f00 | ||
![]() |
6810c209d8 | ||
![]() |
6a8a4c1a36 | ||
![]() |
80bd608045 | ||
![]() |
fd9157007a | ||
![]() |
c17abc6829 | ||
38daf6ea5b | |||
7665452f72 | |||
13f8c5afcc | |||
![]() |
f6a175980a | ||
![]() |
075585c54f | ||
![]() |
c505afd0fe | ||
![]() |
421831b5a6 | ||
![]() |
096e2dca20 | ||
![]() |
418b294634 | ||
![]() |
56888c7fba | ||
![]() |
f4939a962e | ||
![]() |
53650c7808 | ||
![]() |
1ce84c7269 | ||
![]() |
9696313568 | ||
![]() |
4d7cc5fc56 | ||
![]() |
765bc45ce7 | ||
![]() |
b5a260615b | ||
![]() |
8c3bf30ace | ||
![]() |
c996dd5374 | ||
![]() |
cbac28e040 | ||
![]() |
cca97e7542 | ||
![]() |
14a678092e | ||
![]() |
0ab0cf5a6a | ||
![]() |
f295082592 | ||
![]() |
8ab97c00e1 | ||
![]() |
9e8b02ac90 | ||
![]() |
3436989a89 | ||
![]() |
583d7ca0db | ||
![]() |
38894d94e7 | ||
![]() |
ae7f3bdafa | ||
![]() |
4bbf931853 | ||
![]() |
9aed858982 | ||
![]() |
622cd0faaf | ||
![]() |
236a622505 | ||
![]() |
6d04a8a6c8 |
27 changed files with 114 additions and 13305 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,4 +15,3 @@
|
||||||
/libpeerconnection.log
|
/libpeerconnection.log
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
testem.log
|
testem.log
|
||||||
.firebase
|
|
||||||
|
|
|
@ -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).
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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');
|
||||||
|
|
|
@ -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'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -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>
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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) => {
|
|
||||||
promises.push(measurement.save());
|
|
||||||
});
|
|
||||||
|
|
||||||
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.transitionToRoute(fallbackRoute, model);
|
|
||||||
});
|
|
||||||
}, (errors) => {
|
|
||||||
this.get('ajaxError').alert(errors);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function() {
|
saveMeasurement: function(measurement, properties) {
|
||||||
const model = this.get('model');
|
measurement.setProperties(properties);
|
||||||
|
measurement.save().then(() => {
|
||||||
|
this.get('flashMessages').clearMessages();
|
||||||
|
}, () => {
|
||||||
|
ajaxError(measurement.get('errors'), this.get('flashMessages'));
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
model.get('errors').clear();
|
deleteMeasurement: function(measurement) {
|
||||||
model.rollbackAttributes();
|
const characteristic = measurement.get('characteristic');
|
||||||
|
if (characteristic.get('isNew')) {
|
||||||
if (model.get('isNew')) {
|
characteristic.destroyRecord();
|
||||||
this.transitionToRoute(this.get('fallbackRouteCancel'));
|
|
||||||
} else {
|
|
||||||
this.transitionToRoute(this.get('fallbackRouteCancel'), model);
|
|
||||||
}
|
}
|
||||||
},
|
measurement.destroyRecord();
|
||||||
|
|
||||||
addMeasurement: function() {
|
|
||||||
return this.store.createRecord('measurement');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
|
@ -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")
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
{{loading-panel}}
|
|
|
@ -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'}}>
|
{{#if isDirty}}
|
||||||
|
<button class="button-green smaller" {{action 'save'}}>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
{{else}}
|
||||||
|
<button class="button-gray smaller" {{action 'save'}}>
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
{{#if isDirty}}
|
|
||||||
<button class="button-green smaller" {{action 'save'}}>
|
|
||||||
Save
|
|
||||||
</button>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
{{#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 paramsChanged}}
|
{{#if measurementsPresent}}
|
||||||
<button class="button-gray smaller" {{action 'resetSortParam'}}>
|
{{#if paramsChanged}}
|
||||||
Reset sort
|
<button class="button-gray smaller" {{action 'resetSortParam'}}>
|
||||||
</button>
|
Reset sort
|
||||||
{{/if}}
|
</button>
|
||||||
|
{{/if}}
|
||||||
<table class="flakes-table">
|
<table class="flakes-table">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
{{#if canEdit}}
|
{{#if canEdit}}
|
||||||
|
@ -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}}
|
||||||
|
|
|
@ -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
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -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') {
|
this.set(field, valueInStrain);
|
||||||
const tempArray = this._resetArray(valueInStrain);
|
|
||||||
this.set(field, tempArray);
|
|
||||||
} else {
|
|
||||||
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);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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'));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -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) {
|
hasMany.forEach((item) => {
|
||||||
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
|
json[key].push(+item.id);
|
||||||
}
|
});
|
||||||
json[payloadKey] = [];
|
|
||||||
hasMany.forEach((item) => {
|
|
||||||
json[payloadKey].push(+item);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -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}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
7
app/utils/ajax-error-new.js
Normal file
7
app/utils/ajax-error-new.js
Normal 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}`);
|
||||||
|
});
|
||||||
|
}
|
|
@ -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",
|
||||||
|
|
|
@ -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',
|
||||||
|
|
|
@ -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
13051
package-lock.json
generated
File diff suppressed because it is too large
Load diff
14
package.json
14
package.json
|
@ -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"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Reference in a new issue