diff --git a/app/models/characteristic-type.js b/app/models/characteristic-type.js index 31f793a..284486e 100644 --- a/app/models/characteristic-type.js +++ b/app/models/characteristic-type.js @@ -8,5 +8,6 @@ export default DS.Model.extend({ deletedAt: DS.attr('date'), createdBy: DS.attr('number'), updatedBy: DS.attr('number'), - deletedBy: DS.attr('number') + deletedBy: DS.attr('number'), + sortOrder: DS.attr('number'), }); diff --git a/app/models/characteristic.js b/app/models/characteristic.js index eeeafe4..9f33d7b 100644 --- a/app/models/characteristic.js +++ b/app/models/characteristic.js @@ -10,5 +10,6 @@ export default DS.Model.extend({ deletedAt : DS.attr('date'), createdBy : DS.attr('number'), updatedBy : DS.attr('number'), - deletedBy : DS.attr('number') + deletedBy : DS.attr('number'), + sortOrder : DS.attr('number'), }); diff --git a/app/models/species.js b/app/models/species.js index 8c679ee..fee135a 100644 --- a/app/models/species.js +++ b/app/models/species.js @@ -15,6 +15,7 @@ export default DS.Model.extend({ createdBy : DS.attr('number'), updatedBy : DS.attr('number'), deletedBy : DS.attr('number'), + sortOrder : DS.attr('number'), speciesNameMU: function() { return Ember.String.htmlSafe(`${this.get('speciesName')}`); diff --git a/app/models/strain.js b/app/models/strain.js index 09983a5..a3621e9 100644 --- a/app/models/strain.js +++ b/app/models/strain.js @@ -17,6 +17,7 @@ export default DS.Model.extend({ updatedBy : DS.attr('number'), deletedBy : DS.attr('number'), totalMeasurements: DS.attr('number'), + sortOrder : DS.attr('number'), strainNameMU: function() { let type = this.get('typeStrain') ? 'T' : ''; diff --git a/app/pods/characteristics/route.js b/app/pods/characteristics/route.js index bde4ffa..5ac902c 100644 --- a/app/pods/characteristics/route.js +++ b/app/pods/characteristics/route.js @@ -16,6 +16,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { controller.set('model', models.characteristics); controller.set('tableAttrs', tableAttrs); controller.set('row', 'characteristic-index-row'); - controller.set('sort', ['characteristicName']); + controller.set('sort', ['characteristicType.characteristicTypeName', 'sortOrder']); }, }); diff --git a/app/pods/components/measurement-search-panel/component.js b/app/pods/components/measurement-search-panel/component.js index e56e6e9..b9e9749 100644 --- a/app/pods/components/measurement-search-panel/component.js +++ b/app/pods/components/measurement-search-panel/component.js @@ -23,10 +23,10 @@ export default Ember.Component.extend({ models[item.model] = models[item.model].filter((i) => { if (!Ember.isEmpty(i.get(item.children))) { return true; } }); - models[item.model] = models[item.model].sortBy(item.text); + models[item.model] = models[item.model].sortBy('sortOrder'); let temp = models[item.model].map((data) => { let temp_children = []; - let sorted_children = data.get(item.children).sortBy(item.ctext); + let sorted_children = data.get(item.children).sortBy('sortOrder'); sorted_children.forEach((child) => { temp_children.push({id: child.get(item.cid), text: child.get(item.ctext)}); }); diff --git a/app/pods/species/index/route.js b/app/pods/species/index/route.js index 6ef9dd3..9d02d32 100644 --- a/app/pods/species/index/route.js +++ b/app/pods/species/index/route.js @@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { controller.set('model', model); controller.set('tableAttrs', tableAttrs); controller.set('row', 'species-index-row'); - controller.set('sort', ['speciesName']); + controller.set('sort', ['sortOrder']); }, }); diff --git a/app/pods/strains/index/route.js b/app/pods/strains/index/route.js index 81bcc2b..7185ff2 100644 --- a/app/pods/strains/index/route.js +++ b/app/pods/strains/index/route.js @@ -13,6 +13,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, { controller.set('model', model); controller.set('tableAttrs', tableAttrs); controller.set('row', 'strain-index-row'); - controller.set('sort', ['fullNameMU']); + controller.set('sort', ['sortOrder']); }, }); diff --git a/server/mocks/characteristic-types.js b/server/mocks/characteristic-types.js index 906a454..9eb84bc 100644 --- a/server/mocks/characteristic-types.js +++ b/server/mocks/characteristic-types.js @@ -12,7 +12,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 1, }, { id: 2, @@ -23,7 +24,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 2, }, { id: 3, @@ -34,7 +36,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 3, }, ] diff --git a/server/mocks/characteristics.js b/server/mocks/characteristics.js index 3be513c..09c4d44 100644 --- a/server/mocks/characteristics.js +++ b/server/mocks/characteristics.js @@ -14,7 +14,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 1, }, { id: 2, @@ -27,7 +28,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 2, }, { id: 3, @@ -40,7 +42,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 3, }, { id: 4, @@ -53,7 +56,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 4, }, { id: 5, @@ -66,7 +70,8 @@ module.exports = function(app) { deletedAt: null, createdBy: 1, updatedBy: 1, - deletedBy: null + deletedBy: null, + sortOrder: 5, } ] diff --git a/server/mocks/species.js b/server/mocks/species.js index f3b0430..c7b66a4 100644 --- a/server/mocks/species.js +++ b/server/mocks/species.js @@ -17,6 +17,7 @@ module.exports = function(app) { createdBy: 1, updatedBy: 1, deletedBy: null, + sortOrder: 1, }, { id: 2, @@ -32,6 +33,7 @@ module.exports = function(app) { createdBy: 1, updatedBy: 1, deletedBy: null, + sortOrder: 2, }, { id: 3, @@ -47,6 +49,7 @@ module.exports = function(app) { createdBy: 1, updatedBy: 1, deletedBy: null, + sortOrder: 3, }, { id: 4, @@ -62,6 +65,7 @@ module.exports = function(app) { createdBy: 1, updatedBy: 1, deletedBy: null, + sortOrder: 4, } ]; diff --git a/server/mocks/strains.js b/server/mocks/strains.js index d6bfccf..2a39419 100644 --- a/server/mocks/strains.js +++ b/server/mocks/strains.js @@ -20,6 +20,7 @@ module.exports = function(app) { deletedBy: null, totalMeasurements: 5, notes: "Test notes", + sortOrder: 1, }, { id: 2, @@ -38,6 +39,7 @@ module.exports = function(app) { deletedBy: null, totalMeasurements: 5, notes: "Test notes", + sortOrder: 2, }, { id: 3, @@ -56,6 +58,7 @@ module.exports = function(app) { deletedBy: null, totalMeasurements: 0, notes: "Test notes", + sortOrder: 3, }, { id: 4, @@ -74,6 +77,7 @@ module.exports = function(app) { deletedBy: null, totalMeasurements: 0, notes: "Test notes", + sortOrder: 4. } ];