mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-28 02:58:18 +08:00
ToolForm: Fix empty collection
This commit is contained in:
@@ -86,16 +86,26 @@ define(['utils/utils'], function(Utils){
|
||||
/** Get details of a content by id.
|
||||
*/
|
||||
getDetails: function(options) {
|
||||
// check id
|
||||
if (!options.id || options.id === 'null') {
|
||||
options.success && options.success();
|
||||
return;
|
||||
}
|
||||
|
||||
// create url
|
||||
var api_url = this.base_url + '/datasets/' + options.id;
|
||||
if (options.src == 'hdca') {
|
||||
api_url = this.base_url + '/dataset_collections/' + options.id;
|
||||
}
|
||||
|
||||
// request details
|
||||
Utils.get({
|
||||
url : api_url,
|
||||
success : function(response) {
|
||||
options.success && options.success(response);
|
||||
},
|
||||
error : function(response) {
|
||||
options.success && options.success();
|
||||
console.debug('tools-content::getDetails() - Ajax request for content failed.');
|
||||
console.debug(response);
|
||||
}
|
||||
|
||||
@@ -447,11 +447,6 @@ define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/tools/tools-rep
|
||||
id : content_id,
|
||||
src : content_src,
|
||||
success : function(content) {
|
||||
// select the first dataset to represent collections
|
||||
if (content_src == 'hdca' && content.elements && content.elements.length > 0) {
|
||||
content = content.elements[0].object;
|
||||
}
|
||||
|
||||
// meta data
|
||||
var meta = null;
|
||||
|
||||
@@ -460,6 +455,11 @@ define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/tools/tools-rep
|
||||
// log selection
|
||||
console.debug('tool-form::field_data() - Selected content ' + content_id + '.');
|
||||
|
||||
// select the first dataset to represent collections
|
||||
if (content_src == 'hdca' && content.elements && content.elements.length > 0) {
|
||||
content = content.elements[0].object;
|
||||
}
|
||||
|
||||
// get meta data
|
||||
meta = content.metadata_column_types;
|
||||
|
||||
|
||||
@@ -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},getDetails:function(b){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){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}})});
|
||||
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},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}})});
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user