Compare commits

..

1 commit

Author SHA1 Message Date
a1c835caed WIP: need to proxy the DT values 2018-03-05 06:13:51 -07:00
14 changed files with 5433 additions and 8568 deletions

View file

@ -19,7 +19,7 @@ export default Component.extend({
let changesets = {};
changesets['new'] = [];
changesets['delete'] = [];
changesets['hasMany'] = {};
changesets['hasMany'] = [];
changesets['model'] = new Changeset(model,
lookupValidator(validations['collection']),
validations['collection']);

View file

@ -2,6 +2,7 @@ import Mixin from '@ember/object/mixin';
import { get } from '@ember/object';
import RSVP from 'rsvp';
const { keys } = Object;
const { isArray } = Array;
export default Mixin.create({
validationSave(changesets, postSave) {
@ -54,14 +55,10 @@ export default Mixin.create({
for (const model of changesets[key]) {
model.destroyRecord();
}
} else if (key === 'hasMany') {
const hasMany = changesets[key];
for (const hasManyKey of keys(changesets[key])) {
const hasManyChangesets = hasMany[hasManyKey];
for (const changeset of hasManyChangesets) {
} else if (isArray(changesets[key])) { // hasMany
for (const { changeset } of changesets[key]) {
changeset.rollback();
}
}
} else { // single
const changeset = changesets[key];
changeset.rollback();

View file

@ -3,7 +3,7 @@ import DS from 'ember-data';
const { Model, attr, belongsTo } = DS;
export default Model.extend({
dateMeasured: attr('ccdb-date'),
dateMeasured: attr('string'),
timeMeasured: attr('string'),
waterTempC: attr('number'),
airTempC: attr('number'),

View file

@ -7,11 +7,11 @@ const { Model, attr, belongsTo, hasMany } = DS;
export default Model.extend({
displayName: attr('string'),
numberOfTraps: attr('number'),
collectionStartDate: attr('ccdb-date'),
collectionStartDate: attr('string-null-to-empty'),
collectionStartTime: attr('string-null-to-empty'),
collectionEndDate: attr('ccdb-date'),
collectionEndDate: attr('string-null-to-empty'),
collectionEndTime: attr('string-null-to-empty'),
notes: attr('string', { defaultValue: '' }),
notes: attr('string'),
project: belongsTo('project'),
studyLocation: belongsTo('study-location'),

View file

@ -43,38 +43,27 @@ export default Route.extend({
const store = this.get('store');
/* eslint-disable no-console */
let project = controller.get('project');
console.log('project', project);
project = project.map(id => store.peekRecord('project', id));
let region = controller.get('region');
console.log('region', region);
region = region.map(id => store.peekRecord('region', id));
let site = controller.get('site');
console.log('site', site);
site = site.map(id => store.peekRecord('site', id));
let studyLocation = controller.get('study_location');
console.log('studyLocation', studyLocation);
studyLocation = studyLocation.map(id => store.peekRecord('study-location', id));
let collectionMethod = controller.get('collection_method');
console.log('collectionMethod', collectionMethod);
collectionMethod = collectionMethod.map(id => store.peekRecord('collection-method', id));
let adfgPermit = controller.get('adfg_permit');
console.log('adfgPermit', adfgPermit);
adfgPermit = adfgPermit.map(id => store.peekRecord('adfg-permit', id));
let species = controller.get('species');
console.log('species', species);
species = species.map(id => store.peekRecord('species', id));
/* eslint-enable no-console */
const numberOfTraps = controller.get('number_of_traps');
const collectionStartDate = controller.get('collection_start_date');
const collectionEndDate = controller.get('collection_end_date');

View file

@ -4,7 +4,6 @@
validations=(hash
collection=CollectionValidations
collectionSpecies=CollectionSpeciesValidations
envMeasurements=CollectionMeasurementValidations
datasheet=DatasheetValidations)
options=options
hasMany=hasMany

View file

@ -79,35 +79,30 @@
{{/validated-field}}
{{#validated-field property='collectionStartDate' label='Collection start date' changeset=changeset}}
{{
pikaday-input
onSelection=(action (mut changeset.collectionStartDate))
value=changeset.collectionStartDate
useUTC=true
placeholder='MM/DD/YYYY'
format='MM/DD/YYYY'
class='form-control'
}}
{{input value=changeset.collectionStartDate type='date' class='form-control'}}
{{/validated-field}}
{{#validated-field property='collectionStartTime' label='Collection start time' changeset=changeset}}
{{input value=changeset.collectionStartTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
{{/validated-field}}
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
{{
pikaday-input
onSelection=(action (mut changeset.collectionEndDate))
value=changeset.collectionEndDate
useUTC=true
placeholder='MM/DD/YYYY'
format='MM/DD/YYYY'
{{bs-datetimepicker
date=changeset.collectionStartTime
updateDate=(action (mut changeset.collectionStartTime))
placeholder='HH:mm a'
format='HH:mm a'
class='form-control'
}}
{{/validated-field}}
{{#validated-field property='collectionEndDate' label='Collection end date' changeset=changeset}}
{{input value=changeset.collectionEndDate type='date' class='form-control'}}
{{/validated-field}}
{{#validated-field property='collectionEndTime' label='Collection end time' changeset=changeset}}
{{input value=changeset.collectionEndTime type='time' class='form-control' placeholder='HH:MM:SS (24 hour)'}}
{{bs-datetimepicker
date=changeset.collectionEndTime
updateDate=(action (mut changeset.collectionEndTime))
format='LT'
class='form-control'
}}
{{/validated-field}}
{{/with}}
{{/f.content}}
@ -206,15 +201,7 @@
<tr class="form">
<td class="col-md-3">
{{#validated-field property='dateMeasured' changeset=cm.changeset}}
{{
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'
}}
{{input value=cm.changeset.dateMeasured type='date' class='form-control'}}
{{/validated-field}}
</td>
<td class="col-md-3">

View file

@ -1,19 +0,0 @@
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;
}
}
});

View file

@ -6,7 +6,7 @@ import {
export default {
dateMeasured: validatePresence(true),
timeMeasured: validatePresence(true),
waterTempC: validateNumber({ allowBlank: true, integer: false, positive: false }),
airTempC: validateNumber({ allowBlank: true, integer: false, positive: false }),
waterTemp: validateNumber({ allowBlank: true, integer: false, positive: false }),
airTemp: validateNumber({ allowBlank: true, integer: false, positive: false }),
collection: validatePresence(true),
}

View file

@ -1,9 +0,0 @@
{
"name": "ccdb-web",
"dependencies": {
"bootstrap": "^3.3.7"
},
"devDependencies": {
"bootstrap": "^3.3.7"
}
}

View file

@ -20,23 +20,12 @@ module.exports = function(environment) {
APP: {
// Here you can pass flags/options to your application instance
// 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') {
ENV.APP.API_HOST = 'http://localhost:8000';
ENV.APP.API_NAMESPACE = 'api/v1';
ENV.sentry.development = true;
}
if (environment === 'test') {
@ -51,7 +40,7 @@ module.exports = function(environment) {
}
if (environment === 'production') {
ENV.APP.API_HOST = 'https://ccdb-api.thermokar.st';
ENV.APP.API_HOST = 'https://obscure-caverns-99102.herokuapp.com';
ENV.APP.API_NAMESPACE = 'api/v1';
}

View file

@ -8,10 +8,12 @@ module.exports = function(defaults) {
'ember-cli-babel': {
includePolyfill: (EmberApp.env() === 'test'),
},
'ember-bootstrap-datetimepicker': {
'importBootstrapCSS': true,
'importBootstrapJS': true,
'importBootstrapTheme': true
},
});
app.import('bower_components/bootstrap/dist/css/bootstrap.min.css');
app.import('bower_components/bootstrap/dist/css/bootstrap-theme.min.css');
return app.toTree();
};

13843
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,9 +17,10 @@
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "^3.0.0",
"ember-changeset": "^1.3.0",
"ember-changeset-validations": "^1.2.8",
"ember-cli": "^3.24.0",
"ember-bootstrap-datetimepicker": "^1.1.0",
"ember-changeset": "1.3.0",
"ember-changeset-validations": "1.2.8",
"ember-cli": "^2.16.2",
"ember-cli-app-version": "^3.0.0",
"ember-cli-babel": "^6.6.0",
"ember-cli-code-coverage": "^0.4.1",
@ -31,7 +32,6 @@
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-moment-shim": "^3.5.0",
"ember-cli-qunit": "^4.0.0",
"ember-cli-sentry": "^3.0.0",
"ember-cli-shims": "^1.1.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^2.0.0",
@ -50,6 +50,7 @@
"ember-simple-auth": "1.4.0",
"ember-sinon": "^1.0.0",
"ember-source": "~2.16.0",
"eonasdan-bootstrap-datetimepicker": "^4.17.47",
"loader.js": "^4.2.3"
},
"engines": {