commit/galaxy-central: guerler: ToolForm: Fix sorting of content labels
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6e605c5d9fef/ Changeset: 6e605c5d9fef User: guerler Date: 2014-10-15 22:38:07+00:00 Summary: ToolForm: Fix sorting of content labels Affected #: 3 files diff -r a100c09d3e3ad5d8df2747384d3d6b22c3658cb9 -r 6e605c5d9feff984bfb5e67f2c36a400abdcae85 client/galaxy/scripts/mvc/tools/tools-content.js --- a/client/galaxy/scripts/mvc/tools/tools-content.js +++ b/client/galaxy/scripts/mvc/tools/tools-content.js @@ -27,6 +27,11 @@ // backup summary self.summary = response; + // sort by id + self.summary.sort(function(a, b) { + return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0); + }); + // log console.debug('tools-content::initialize() - Completed.'); diff -r a100c09d3e3ad5d8df2747384d3d6b22c3658cb9 -r 6e605c5d9feff984bfb5e67f2c36a400abdcae85 static/scripts/mvc/tools/tools-content.js --- a/static/scripts/mvc/tools/tools-content.js +++ b/static/scripts/mvc/tools/tools-content.js @@ -27,6 +27,11 @@ // backup summary self.summary = response; + // sort by id + self.summary.sort(function(a, b) { + return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0); + }); + // log console.debug('tools-content::initialize() - Completed.'); diff -r a100c09d3e3ad5d8df2747384d3d6b22c3658cb9 -r 6e605c5d9feff984bfb5e67f2c36a400abdcae85 static/scripts/packed/mvc/tools/tools-content.js --- a/static/scripts/packed/mvc/tools/tools-content.js +++ b/static/scripts/packed/mvc/tools/tools-content.js @@ -1,1 +1,1 @@ -define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";this.datatypes={};this.summary={};var b=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(d){b.datatypes=d;a.get({url:b.base_url+"?deleted=false",success:function(e){b.summary=e;console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.");return true}var e=this.datatypes.class_to_classes[d];if(e[c]){return true}return false}})}); \ No newline at end of file +define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";this.datatypes={};this.summary={};var b=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(d){b.datatypes=d;a.get({url:b.base_url+"?deleted=false",success:function(e){b.summary=e;b.summary.sort(function(g,f){return g.hid>f.hid?-1:(g.hid<f.hid?1:0)});console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.");return true}var e=this.datatypes.class_to_classes[d];if(e[c]){return true}return false}})}); \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org