Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
7548aafdb7 | |||
0cd3cd96f1 | |||
22be697ef6 | |||
bf6023a7b4 | |||
6f6148df9d | |||
437be4fb13 | |||
9d9e67868f | |||
86ab62cb0f | |||
234dc3a34c | |||
d2c485af88 | |||
ab30692021 |
12 changed files with 8554 additions and 5157 deletions
|
@ -19,7 +19,7 @@ export default Component.extend({
|
||||||
let changesets = {};
|
let changesets = {};
|
||||||
changesets['new'] = [];
|
changesets['new'] = [];
|
||||||
changesets['delete'] = [];
|
changesets['delete'] = [];
|
||||||
changesets['hasMany'] = [];
|
changesets['hasMany'] = {};
|
||||||
changesets['model'] = new Changeset(model,
|
changesets['model'] = new Changeset(model,
|
||||||
lookupValidator(validations['collection']),
|
lookupValidator(validations['collection']),
|
||||||
validations['collection']);
|
validations['collection']);
|
||||||
|
|
|
@ -2,7 +2,6 @@ import Mixin from '@ember/object/mixin';
|
||||||
import { get } from '@ember/object';
|
import { get } from '@ember/object';
|
||||||
import RSVP from 'rsvp';
|
import RSVP from 'rsvp';
|
||||||
const { keys } = Object;
|
const { keys } = Object;
|
||||||
const { isArray } = Array;
|
|
||||||
|
|
||||||
export default Mixin.create({
|
export default Mixin.create({
|
||||||
validationSave(changesets, postSave) {
|
validationSave(changesets, postSave) {
|
||||||
|
@ -55,9 +54,13 @@ export default Mixin.create({
|
||||||
for (const model of changesets[key]) {
|
for (const model of changesets[key]) {
|
||||||
model.destroyRecord();
|
model.destroyRecord();
|
||||||
}
|
}
|
||||||
} else if (isArray(changesets[key])) { // hasMany
|
} else if (key === 'hasMany') {
|
||||||
for (const { changeset } of changesets[key]) {
|
const hasMany = changesets[key];
|
||||||
changeset.rollback();
|
for (const hasManyKey of keys(changesets[key])) {
|
||||||
|
const hasManyChangesets = hasMany[hasManyKey];
|
||||||
|
for (const changeset of hasManyChangesets) {
|
||||||
|
changeset.rollback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else { // single
|
} else { // single
|
||||||
const changeset = changesets[key];
|
const changeset = changesets[key];
|
||||||
|
|
|
@ -3,7 +3,7 @@ import DS from 'ember-data';
|
||||||
const { Model, attr, belongsTo } = DS;
|
const { Model, attr, belongsTo } = DS;
|
||||||
|
|
||||||
export default Model.extend({
|
export default Model.extend({
|
||||||
dateMeasured: attr('string'),
|
dateMeasured: attr('ccdb-date'),
|
||||||
timeMeasured: attr('string'),
|
timeMeasured: attr('string'),
|
||||||
waterTempC: attr('number'),
|
waterTempC: attr('number'),
|
||||||
airTempC: attr('number'),
|
airTempC: attr('number'),
|
||||||
|
|
|
@ -7,11 +7,11 @@ const { Model, attr, belongsTo, hasMany } = DS;
|
||||||
export default Model.extend({
|
export default Model.extend({
|
||||||
displayName: attr('string'),
|
displayName: attr('string'),
|
||||||
numberOfTraps: attr('number'),
|
numberOfTraps: attr('number'),
|
||||||
collectionStartDate: attr('string-null-to-empty'),
|
collectionStartDate: attr('ccdb-date'),
|
||||||
collectionStartTime: attr('string-null-to-empty'),
|
collectionStartTime: attr('string-null-to-empty'),
|
||||||
collectionEndDate: attr('string-null-to-empty'),
|
collectionEndDate: attr('ccdb-date'),
|
||||||
collectionEndTime: attr('string-null-to-empty'),
|
collectionEndTime: attr('string-null-to-empty'),
|
||||||
notes: attr('string'),
|
notes: attr('string', { defaultValue: '' }),
|
||||||
|
|
||||||
project: belongsTo('project'),
|
project: belongsTo('project'),
|
||||||
studyLocation: belongsTo('study-location'),
|
studyLocation: belongsTo('study-location'),
|
||||||
|
|
|
@ -43,27 +43,38 @@ export default Route.extend({
|
||||||
|
|
||||||
const store = this.get('store');
|
const store = this.get('store');
|
||||||
|
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
let project = controller.get('project');
|
let project = controller.get('project');
|
||||||
|
console.log('project', project);
|
||||||
project = project.map(id => store.peekRecord('project', id));
|
project = project.map(id => store.peekRecord('project', id));
|
||||||
|
|
||||||
let region = controller.get('region');
|
let region = controller.get('region');
|
||||||
|
console.log('region', region);
|
||||||
region = region.map(id => store.peekRecord('region', id));
|
region = region.map(id => store.peekRecord('region', id));
|
||||||
|
|
||||||
let site = controller.get('site');
|
let site = controller.get('site');
|
||||||
|
console.log('site', site);
|
||||||
site = site.map(id => store.peekRecord('site', id));
|
site = site.map(id => store.peekRecord('site', id));
|
||||||
|
|
||||||
let studyLocation = controller.get('study_location');
|
let studyLocation = controller.get('study_location');
|
||||||
|
console.log('studyLocation', studyLocation);
|
||||||
studyLocation = studyLocation.map(id => store.peekRecord('study-location', id));
|
studyLocation = studyLocation.map(id => store.peekRecord('study-location', id));
|
||||||
|
|
||||||
let collectionMethod = controller.get('collection_method');
|
let collectionMethod = controller.get('collection_method');
|
||||||
|
console.log('collectionMethod', collectionMethod);
|
||||||
collectionMethod = collectionMethod.map(id => store.peekRecord('collection-method', id));
|
collectionMethod = collectionMethod.map(id => store.peekRecord('collection-method', id));
|
||||||
|
|
||||||
let adfgPermit = controller.get('adfg_permit');
|
let adfgPermit = controller.get('adfg_permit');
|
||||||
|
console.log('adfgPermit', adfgPermit);
|
||||||
adfgPermit = adfgPermit.map(id => store.peekRecord('adfg-permit', id));
|
adfgPermit = adfgPermit.map(id => store.peekRecord('adfg-permit', id));
|
||||||
|
|
||||||
let species = controller.get('species');
|
let species = controller.get('species');
|
||||||
|
console.log('species', species);
|
||||||
species = species.map(id => store.peekRecord('species', id));
|
species = species.map(id => store.peekRecord('species', id));
|
||||||
|
|
||||||
|
/* eslint-enable no-console */
|
||||||
|
|
||||||
const numberOfTraps = controller.get('number_of_traps');
|
const numberOfTraps = controller.get('number_of_traps');
|
||||||
const collectionStartDate = controller.get('collection_start_date');
|
const collectionStartDate = controller.get('collection_start_date');
|
||||||
const collectionEndDate = controller.get('collection_end_date');
|
const collectionEndDate = controller.get('collection_end_date');
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
validations=(hash
|
validations=(hash
|
||||||
collection=CollectionValidations
|
collection=CollectionValidations
|
||||||
collectionSpecies=CollectionSpeciesValidations
|
collectionSpecies=CollectionSpeciesValidations
|
||||||
|
envMeasurements=CollectionMeasurementValidations
|
||||||
datasheet=DatasheetValidations)
|
datasheet=DatasheetValidations)
|
||||||
options=options
|
options=options
|
||||||
hasMany=hasMany
|
hasMany=hasMany
|
||||||
|
|
|
@ -79,19 +79,35 @@
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionStartDate' label='Collection start date' changeset=changeset}}
|
{{#validated-field property='collectionStartDate' label='Collection start date' changeset=changeset}}
|
||||||
{{input value=changeset.collectionStartDate type='date' class='form-control'}}
|
{{
|
||||||
|
pikaday-input
|
||||||
|
onSelection=(action (mut changeset.collectionStartDate))
|
||||||
|
value=changeset.collectionStartDate
|
||||||
|
useUTC=true
|
||||||
|
placeholder='MM/DD/YYYY'
|
||||||
|
format='MM/DD/YYYY'
|
||||||
|
class='form-control'
|
||||||
|
}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionStartTime' label='Collection start time' changeset=changeset}}
|
{{#validated-field property='collectionStartTime' label='Collection start time' changeset=changeset}}
|
||||||
{{input value=changeset.collectionStartTime type='time' class='form-control'}}
|
{{input value=changeset.collectionStartTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
|
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
|
||||||
{{input value=changeset.collectionEndDate type='date' class='form-control'}}
|
{{
|
||||||
|
pikaday-input
|
||||||
|
onSelection=(action (mut changeset.collectionEndDate))
|
||||||
|
value=changeset.collectionEndDate
|
||||||
|
useUTC=true
|
||||||
|
placeholder='MM/DD/YYYY'
|
||||||
|
format='MM/DD/YYYY'
|
||||||
|
class='form-control'
|
||||||
|
}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
|
|
||||||
{{#validated-field property='collectionEndTime' label='Collection end time' changeset=changeset}}
|
{{#validated-field property='collectionEndTime' label='Collection end time' changeset=changeset}}
|
||||||
{{input value=changeset.collectionEndTime type='time' class='form-control'}}
|
{{input value=changeset.collectionEndTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
{{/with}}
|
{{/with}}
|
||||||
{{/f.content}}
|
{{/f.content}}
|
||||||
|
@ -190,7 +206,15 @@
|
||||||
<tr class="form">
|
<tr class="form">
|
||||||
<td class="col-md-3">
|
<td class="col-md-3">
|
||||||
{{#validated-field property='dateMeasured' changeset=cm.changeset}}
|
{{#validated-field property='dateMeasured' changeset=cm.changeset}}
|
||||||
{{input value=cm.changeset.dateMeasured type='date' class='form-control'}}
|
{{
|
||||||
|
pikaday-input
|
||||||
|
onSelection=(action (mut cm.changeset.dateMeasured))
|
||||||
|
value=cm.changeset.dateMeasured
|
||||||
|
useUTC=true
|
||||||
|
placeholder='MM/DD/YYYY'
|
||||||
|
format='MM/DD/YYYY'
|
||||||
|
class='form-control'
|
||||||
|
}}
|
||||||
{{/validated-field}}
|
{{/validated-field}}
|
||||||
</td>
|
</td>
|
||||||
<td class="col-md-3">
|
<td class="col-md-3">
|
||||||
|
|
19
app/transforms/ccdb-date.js
Normal file
19
app/transforms/ccdb-date.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import DS from 'ember-data';
|
||||||
|
|
||||||
|
export default DS.Transform.extend({
|
||||||
|
deserialize(serialized) {
|
||||||
|
return serialized || '';
|
||||||
|
},
|
||||||
|
|
||||||
|
serialize(date) {
|
||||||
|
if (date !== '') {
|
||||||
|
date = new Date(date);
|
||||||
|
const day = date.getUTCDate();
|
||||||
|
const month = date.getUTCMonth() + 1;
|
||||||
|
const year = date.getUTCFullYear();
|
||||||
|
return `${year}-${month}-${day}`;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -6,7 +6,7 @@ import {
|
||||||
export default {
|
export default {
|
||||||
dateMeasured: validatePresence(true),
|
dateMeasured: validatePresence(true),
|
||||||
timeMeasured: validatePresence(true),
|
timeMeasured: validatePresence(true),
|
||||||
waterTemp: validateNumber({ allowBlank: true, integer: false, positive: false }),
|
waterTempC: validateNumber({ allowBlank: true, integer: false, positive: false }),
|
||||||
airTemp: validateNumber({ allowBlank: true, integer: false, positive: false }),
|
airTempC: validateNumber({ allowBlank: true, integer: false, positive: false }),
|
||||||
collection: validatePresence(true),
|
collection: validatePresence(true),
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,23 @@ module.exports = function(environment) {
|
||||||
APP: {
|
APP: {
|
||||||
// Here you can pass flags/options to your application instance
|
// Here you can pass flags/options to your application instance
|
||||||
// when it is created
|
// when it is created
|
||||||
|
},
|
||||||
|
|
||||||
|
sentry: {
|
||||||
|
dsn: 'https://fd3c695fa9394de48a7c69b7a322960b@sentry.io/1186914',
|
||||||
|
globalErrorCatching: false,
|
||||||
|
},
|
||||||
|
|
||||||
|
contentSecurityPolicy: {
|
||||||
|
'script-src': "'self' 'unsafe-inline' 'unsafe-eval'",
|
||||||
|
'img-src': 'data: app.getsentry.com',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (environment === 'development') {
|
if (environment === 'development') {
|
||||||
ENV.APP.API_HOST = 'http://localhost:8000';
|
ENV.APP.API_HOST = 'http://localhost:8000';
|
||||||
ENV.APP.API_NAMESPACE = 'api/v1';
|
ENV.APP.API_NAMESPACE = 'api/v1';
|
||||||
|
ENV.sentry.development = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'test') {
|
if (environment === 'test') {
|
||||||
|
@ -40,7 +51,7 @@ module.exports = function(environment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment === 'production') {
|
if (environment === 'production') {
|
||||||
ENV.APP.API_HOST = 'https://obscure-caverns-99102.herokuapp.com';
|
ENV.APP.API_HOST = 'https://ccdb-api.thermokar.st';
|
||||||
ENV.APP.API_NAMESPACE = 'api/v1';
|
ENV.APP.API_NAMESPACE = 'api/v1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13601
package-lock.json
generated
13601
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -17,9 +17,9 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"broccoli-asset-rev": "^2.4.5",
|
"broccoli-asset-rev": "^2.4.5",
|
||||||
"ember-ajax": "^3.0.0",
|
"ember-ajax": "^3.0.0",
|
||||||
"ember-changeset": "1.3.0",
|
"ember-changeset": "^1.3.0",
|
||||||
"ember-changeset-validations": "1.2.8",
|
"ember-changeset-validations": "^1.2.8",
|
||||||
"ember-cli": "^2.16.2",
|
"ember-cli": "^3.24.0",
|
||||||
"ember-cli-app-version": "^3.0.0",
|
"ember-cli-app-version": "^3.0.0",
|
||||||
"ember-cli-babel": "^6.6.0",
|
"ember-cli-babel": "^6.6.0",
|
||||||
"ember-cli-code-coverage": "^0.4.1",
|
"ember-cli-code-coverage": "^0.4.1",
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
"ember-cli-inject-live-reload": "^1.4.1",
|
"ember-cli-inject-live-reload": "^1.4.1",
|
||||||
"ember-cli-moment-shim": "^3.5.0",
|
"ember-cli-moment-shim": "^3.5.0",
|
||||||
"ember-cli-qunit": "^4.0.0",
|
"ember-cli-qunit": "^4.0.0",
|
||||||
|
"ember-cli-sentry": "^3.0.0",
|
||||||
"ember-cli-shims": "^1.1.0",
|
"ember-cli-shims": "^1.1.0",
|
||||||
"ember-cli-sri": "^2.1.0",
|
"ember-cli-sri": "^2.1.0",
|
||||||
"ember-cli-uglify": "^2.0.0",
|
"ember-cli-uglify": "^2.0.0",
|
||||||
|
|
Loading…
Add table
Reference in a new issue