Housekeeping

This commit is contained in:
Matthew Dillon 2015-06-14 20:48:58 -08:00
parent d80ce9286b
commit 0d840b4586
15 changed files with 91 additions and 141 deletions

View file

@ -2,7 +2,7 @@ import Ember from 'ember';
import config from '../config/environment'; import config from '../config/environment';
var globals = Ember.Object.extend({ var globals = Ember.Object.extend({
genus: config.genus, genus: config.APP.genus,
apiURL: config.apiURL, apiURL: config.apiURL,
}); });

View file

@ -3,12 +3,12 @@ import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
characteristicName: DS.attr('string'), characteristicName: DS.attr('string'),
characteristicType: DS.attr('string'), characteristicType: DS.attr('string'),
strains: DS.hasMany('strain', { async: true }), strains : DS.hasMany('strain', { async: true }),
measurements: DS.hasMany('measurements', { async: true }), measurements : DS.hasMany('measurements', { async: true }),
createdAt: DS.attr('date'), createdAt : DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt : DS.attr('date'),
deletedAt: DS.attr('date'), deletedAt : DS.attr('date'),
createdBy: DS.attr('number'), createdBy : DS.attr('number'),
updatedBy: DS.attr('number'), updatedBy : DS.attr('number'),
deletedBy: DS.attr('number') deletedBy : DS.attr('number')
}); });

View file

@ -1,31 +1,20 @@
import DS from 'ember-data'; import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
strain: DS.belongsTo('strain', { async: true }), strain : DS.belongsTo('strain', { async: true }),
characteristic: DS.belongsTo('characteristic', { async: true }), characteristic : DS.belongsTo('characteristic', { async: true }),
textMeasurementType: DS.attr('string'), textMeasurementType: DS.attr('string'),
txtValue: DS.attr('string'), txtValue : DS.attr('string'),
numValue: DS.attr('number'), numValue : DS.attr('number'),
confidenceInterval: DS.attr('number'), confidenceInterval : DS.attr('number'),
unitType: DS.attr('string'), unitType : DS.attr('string'),
notes: DS.attr('string'), notes : DS.attr('string'),
testMethod: DS.attr('string'), testMethod : DS.attr('string'),
createdAt: DS.attr('date'), createdAt : DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt : DS.attr('date'),
createdBy: DS.attr('number'), createdBy : DS.attr('number'),
updatedBy: DS.attr('number'), updatedBy : DS.attr('number'),
// computedType: Ember.computed('textMeasurementType', 'txtValue', 'numValue', function() {
// if (this.get('textMeasurementType')) {
// return 'Fixed-text';
// }
// if (this.get('txtValue')) {
// return 'Free-text';
// }
// if (this.get('numValue')) {
// return 'Numerical';
// }
// return "error";
// }),
value: function() { value: function() {
if (this.get('textMeasurementType')) { if (this.get('textMeasurementType')) {
return this.get('textMeasurementType'); return this.get('textMeasurementType');

View file

@ -2,16 +2,16 @@ import DS from 'ember-data';
import config from '../config/environment'; import config from '../config/environment';
export default DS.Model.extend({ export default DS.Model.extend({
speciesName: DS.attr('string'), speciesName : DS.attr('string'),
typeSpecies: DS.attr('boolean'), typeSpecies : DS.attr('boolean'),
etymology: DS.attr('string'), etymology : DS.attr('string'),
genusName: DS.attr('string', { defaultValue: config.genus }), genusName : DS.attr('string', { defaultValue: config.APP.genus }),
strains: DS.hasMany('strain', { async: true }), strains : DS.hasMany('strain', { async: true }),
totalStrains: DS.attr('number'), totalStrains: DS.attr('number'),
createdAt: DS.attr('date'), createdAt : DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt : DS.attr('date'),
deletedAt: DS.attr('date'), deletedAt : DS.attr('date'),
createdBy: DS.attr('number'), createdBy : DS.attr('number'),
updatedBy: DS.attr('number'), updatedBy : DS.attr('number'),
deletedBy: DS.attr('number'), deletedBy : DS.attr('number'),
}); });

View file

@ -1,28 +1,31 @@
import DS from 'ember-data'; import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
measurements: DS.hasMany('measurements', { async: true }), measurements : DS.hasMany('measurements', { async: true }),
species: DS.belongsTo('species', { async: true }), species : DS.belongsTo('species', { async: true }),
strainName: DS.attr('string'), strainName : DS.attr('string'),
typeStrain: DS.attr('boolean'), typeStrain : DS.attr('boolean'),
accessionNumbers: DS.attr('string'), accessionNumbers : DS.attr('string'),
genbank: DS.attr('string'), genbank : DS.attr('string'),
isolatedFrom: DS.attr('string'), isolatedFrom : DS.attr('string'),
notes: DS.attr('string'), notes : DS.attr('string'),
createdAt: DS.attr('date'), createdAt : DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt : DS.attr('date'),
deletedAt: DS.attr('date'), deletedAt : DS.attr('date'),
createdBy: DS.attr('number'), createdBy : DS.attr('number'),
updatedBy: DS.attr('number'), updatedBy : DS.attr('number'),
deletedBy: DS.attr('number'), deletedBy : DS.attr('number'),
totalMeasurements: DS.attr('number'), totalMeasurements: DS.attr('number'),
strainNameMU: function() { strainNameMU: function() {
let type = this.get('typeStrain') ? '<sup>T</sup>' : ''; let type = this.get('typeStrain') ? '<sup>T</sup>' : '';
return `${this.get('strainName')}${type}`; return `${this.get('strainName')}${type}`;
}.property('strainName', 'typeStrain').readOnly(), }.property('strainName', 'typeStrain').readOnly(),
fullName: function() { fullName: function() {
return `${this.get('species.speciesName')} (strain ${this.get('strainName')})`; return `${this.get('species.speciesName')} (strain ${this.get('strainName')})`;
}.property('species', 'strainName').readOnly(), }.property('species', 'strainName').readOnly(),
fullNameMU: function() { fullNameMU: function() {
return `<em>${this.get('species.speciesName')}</em> ${this.get('strainNameMU')}`; return `<em>${this.get('species.speciesName')}</em> ${this.get('strainNameMU')}`;
}.property('species', 'strainNameMU').readOnly(), }.property('species', 'strainNameMU').readOnly(),

View file

@ -1,9 +1,9 @@
import DS from 'ember-data'; import DS from 'ember-data';
export default DS.Model.extend({ export default DS.Model.extend({
email: DS.attr('string'), email : DS.attr('string'),
name: DS.attr('string'), name : DS.attr('string'),
role: DS.attr('string'), role : DS.attr('string'),
createdAt: DS.attr('date'), createdAt: DS.attr('date'),
updatedAt: DS.attr('date'), updatedAt: DS.attr('date'),
deletedAt: DS.attr('date') deletedAt: DS.attr('date')

View file

@ -6,8 +6,5 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
invalidateSession: function() { invalidateSession: function() {
this.get('session').invalidate(); this.get('session').invalidate();
}, },
loading: function() {
return true;
},
} }
}); });

View file

@ -1,28 +1,28 @@
<div class="flakes-navigation"> <div class="flakes-navigation">
{{#link-to 'index' class='logo'}} {{#link-to 'index' class='logo'}}
{{site-name}} {{globals.genus}}.info
{{/link-to}} {{/link-to}}
{{#if session.isAuthenticated}} {{#if session.isAuthenticated}}
<ul> <ul>
{{#link-to 'species' tagName='li' href=false}} {{#link-to 'species' tagName='li' href=false}}
{{#link-to 'species'}}Species{{/link-to}} {{link-to 'Species' 'species'}}
{{/link-to}} {{/link-to}}
{{#link-to 'strains' tagName='li' href=false}} {{#link-to 'strains' tagName='li' href=false}}
{{#link-to 'strains'}}Strains{{/link-to}} {{link-to 'Strains' 'strains'}}
{{/link-to}} {{/link-to}}
{{#link-to 'characteristics' tagName='li' href=false}} {{#link-to 'characteristics' tagName='li' href=false}}
{{#link-to 'characteristics'}}Characteristics{{/link-to}} {{link-to 'Characteristics' 'characteristics'}}
{{/link-to}} {{/link-to}}
{{#link-to 'measurements' tagName='li' href=false}} {{#link-to 'measurements' tagName='li' href=false}}
{{#link-to 'measurements'}}Measurements{{/link-to}} {{link-to 'Measurements' 'measurements'}}
{{/link-to}} {{/link-to}}
{{#link-to 'about' tagName='li' href=false}} {{#link-to 'about' tagName='li' href=false}}
{{#link-to 'about'}}About{{/link-to}} {{link-to 'About' 'about'}}
{{/link-to}} {{/link-to}}
</ul> </ul>
<p class="foot"> <p class="foot">
{{session.currentUser.name}}<br> {{session.currentUser.name}}<br>
<a {{ action 'invalidateSession' }}>Logout</a> <a {{action 'invalidateSession'}}>Logout</a>
</p> </p>
{{else}} {{else}}
<p class="foot"> <p class="foot">
@ -36,7 +36,7 @@
<div class="flakes-content"> <div class="flakes-content">
<div class="flakes-mobile-top-bar"> <div class="flakes-mobile-top-bar">
<a href="" class="logo-wrap"> <a href="" class="logo-wrap">
{{site-name}} {{globals.genus}}.info
</a> </a>
<a href="" class="navigation-expand-target"> <a href="" class="navigation-expand-target">
<img src="img/navigation-expand-target.png" height="26px"> <img src="img/navigation-expand-target.png" height="26px">

View file

@ -1 +0,0 @@
{{globals.genus}}.info

View file

@ -23,7 +23,7 @@
content=characteristics content=characteristics
value=selectedCharacteristics value=selectedCharacteristics
optionValuePath="id" optionValuePath="id"
placeholder="Choose a characteristic" placeholder="All characteristics"
}} }}
</li> </li>
<li> <li>

View file

@ -1,6 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend({ export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function() { model: function() {
return this.store.createRecord('species'); return this.store.createRecord('species');
}, },

View file

@ -1,4 +1,4 @@
import Ember from 'ember'; import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend({ export default Ember.Route.extend(AuthenticatedRouteMixin, {});
});

View file

@ -1,6 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend({ export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function() { model: function() {
return Ember.RSVP.hash({ return Ember.RSVP.hash({
strain: this.store.createRecord('strain'), strain: this.store.createRecord('strain'),

View file

@ -1,6 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend({ export default Ember.Route.extend(AuthenticatedRouteMixin, {
model: function(params) { model: function(params) {
return Ember.RSVP.hash({ return Ember.RSVP.hash({
strain: this.store.find('strain', params.strain_id), strain: this.store.find('strain', params.strain_id),

View file

@ -8,68 +8,46 @@ module.exports = function(environment) {
locationType: 'auto', locationType: 'auto',
EmberENV: { EmberENV: {
FEATURES: { FEATURES: {
// Here you can enable experimental features on an ember canary build // enable experimental features on an ember canary build
// e.g. 'with-controller': true
} }
}, },
APP: { APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
genus: 'hymenobacter', genus: 'hymenobacter',
},
podModulePrefix: 'hymenobacterdotinfo/pods', podModulePrefix: 'hymenobacterdotinfo/pods',
}; 'simple-auth': {
if (environment === 'development') {
ENV['simple-auth'] = {
session: 'session:custom', session: 'session:custom',
authorizer: 'simple-auth-authorizer:token', authorizer: 'simple-auth-authorizer:token',
crossOriginWhitelist: ['http://127.0.0.1:4200'] },
} 'simple-auth-token': {
ENV['simple-auth-token'] = {
serverTokenEndpoint: '/api/authenticate',
identificationField: 'email', identificationField: 'email',
passwordField: 'password', passwordField: 'password',
tokenPropertyName: 'token', tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ', authorizationPrefix: 'Bearer ',
authorizationHeaderName: 'Authorization', authorizationHeaderName: 'Authorization',
} },
ENV.apiURL = 'http://127.0.0.1:4200'; contentSecurityPolicy: {
ENV.contentSecurityPolicy = {
'default-src': "'none'", 'default-src': "'none'",
'script-src': "'self'", 'script-src': "'self'",
'font-src': "'self'", 'font-src': "'self'",
'connect-src': "'self' http://127.0.0.1:4200",
'img-src': "'self'", 'img-src': "'self'",
'style-src': "'self' 'unsafe-inline'", 'style-src': "'self' 'unsafe-inline'",
'media-src': "'self'" 'media-src': "'self'"
} },
};
if (environment === 'development') {
ENV['simple-auth']['crossOriginWhitelist'] = ['http://127.0.0.1:4200'];
ENV['simple-auth-token']['serverTokenEndpoint'] = '/api/authenticate';
ENV.apiURL = 'http://127.0.0.1:4200';
ENV.contentSecurityPolicy['connect-src'] = "'self' http://127.0.0.1:4200";
} }
if (environment === 'test') { if (environment === 'test') {
ENV['simple-auth'] = { ENV['simple-auth']['crossOriginWhitelist'] = ['https://bactdb-test.herokuapp.com'];
session: 'session:custom', ENV['simple-auth-token']['serverTokenEndpoint'] = 'https://bactdb-test.herokuapp.com/api/authenticate';
authorizer: 'simple-auth-authorizer:token',
crossOriginWhitelist: ['https://bactdb-test.herokuapp.com']
}
ENV['simple-auth-token'] = {
serverTokenEndpoint: 'https://bactdb-test.herokuapp.com/api/authenticate',
identificationField: 'email',
passwordField: 'password',
tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ',
authorizationHeaderName: 'Authorization',
}
ENV.apiURL = 'https://bactdb-test.herokuapp.com'; ENV.apiURL = 'https://bactdb-test.herokuapp.com';
ENV.contentSecurityPolicy = { ENV.contentSecurityPolicy['connect-src'] = "'self' https://bactdb-test.herokuapp.com";
'default-src': "'none'",
'script-src': "'self'",
'font-src': "'self'",
'connect-src': "'self' https://bactdb-test.herokuapp.com",
'img-src': "'self'",
'style-src': "'self'",
'media-src': "'self'"
}
// keep test console output quieter // keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false; ENV.APP.LOG_ACTIVE_GENERATION = false;
@ -77,29 +55,10 @@ module.exports = function(environment) {
} }
if (environment === 'production') { if (environment === 'production') {
ENV['simple-auth'] = { ENV['simple-auth']['crossOriginWhitelist'] = ['https://bactdb.herokuapp.com'];
session: 'session:custom', ENV['simple-auth-token']['serverTokenEndpoint'] = 'https://bactdb.herokuapp.com/api/authenticate';
authorizer: 'simple-auth-authorizer:token',
crossOriginWhitelist: ['https://bactdb.herokuapp.com']
}
ENV['simple-auth-token'] = {
serverTokenEndpoint: 'https://bactdb.herokuapp.com/api/authenticate',
identificationField: 'email',
passwordField: 'password',
tokenPropertyName: 'token',
authorizationPrefix: 'Bearer ',
authorizationHeaderName: 'Authorization',
}
ENV.apiURL = 'https://bactdb.herokuapp.com'; ENV.apiURL = 'https://bactdb.herokuapp.com';
ENV.contentSecurityPolicy = { ENV.contentSecurityPolicy['connect-src'] = "'self' https://bactdb.herokuapp.com";
'default-src': "'none'",
'script-src': "'self'",
'font-src': "'self'",
'connect-src': "'self' https://bactdb.herokuapp.com",
'img-src': "'self'",
'style-src': "'self'",
'media-src': "'self'"
}
} }
return ENV; return ENV;