Merge branch 'dev' into ui_pref_routing

This commit is contained in:
guerler
2017-03-01 12:59:48 -05:00
25 changed files with 135 additions and 200 deletions
+4 -7
View File
@@ -46,22 +46,19 @@ define([], function() {
});
},
/** Set backdrop for input element
*/
/** Set backdrop for input element */
backdrop: function() {
this.model.set( 'backdrop', true );
},
/** Set error text
*/
/** Set error text */
error: function( text ) {
this.model.set( 'error_text', text );
},
/** Reset this view
*/
/** Reset this view */
reset: function() {
this.model.set( 'error_text', null );
!this.model.get( 'fixed' ) && this.model.set( 'error_text', null );
},
render: function() {
@@ -156,6 +156,7 @@ function( Utils, Ui, Portlet, Repeat, InputElement, Parameters ) {
style : input_def.style,
backdrop : input_def.backdrop,
hidden : input_def.hidden,
fixed : input_def.fixed,
field : field
});
this.app.element_list[ id ] = input_element;
@@ -306,7 +306,7 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
var is_simple_input = ([ 'data_input', 'data_collection_input' ]).indexOf( step.step_type ) != -1;
_.each( step.inputs, function( input ) { input.flavor = 'module'; input.hide_label = is_simple_input; } );
form = new Form( Utils.merge({
title : '<b>' + step.name + '</b>' + step.description,
title : step.title,
onchange : function() { _.each( self.links[ step.index ], function( link ) { self._refreshStep( link ) } ) },
inputs : step.inputs && step.inputs.length > 0 ? step.inputs : [ { type: 'hidden', name: 'No options available.', ignore: null } ]
}, step ) );
@@ -1,12 +1,18 @@
/** This is the workflow tool form. */
define( [ 'utils/utils', 'mvc/tool/tool-form-base' ],
function( Utils, ToolFormBase ) {
var View = Backbone.View.extend({
define( [ 'utils/utils', 'mvc/form/form-view', 'mvc/tool/tool-form-base' ], function( Utils, Form, ToolFormBase ) {
/** Default form wrapper for non-tool modules in the workflow editor. */
var Default = Backbone.View.extend({
initialize: function( options ) {
this.form = new Form( options );
}
});
/** Tool form wrapper for the workflow editor. */
var Tool = Backbone.View.extend({
initialize: function( options ) {
var self = this;
this.workflow = options.workflow;
this.node = options.node;
this.setElement( '<div/>' );
if ( this.node ) {
this.post_job_actions = this.node.post_job_actions || {};
Utils.deepeach( options.inputs, function( input ) {
@@ -15,7 +21,7 @@ define( [ 'utils/utils', 'mvc/tool/tool-form-base' ],
input.type = 'hidden';
input.info = 'Data input \'' + input.name + '\' (' + Utils.textify( input.extensions ) + ')';
input.value = { '__class__': 'RuntimeValue' };
} else {
} else if ( !input.fixed ) {
input.collapsible_value = { '__class__': 'RuntimeValue' };
input.is_workflow = ( input.options && input.options.length == 0 ) ||
( [ 'integer', 'float' ].indexOf( input.type ) != -1 );
@@ -64,7 +70,6 @@ define( [ 'utils/utils', 'mvc/tool/tool-form-base' ],
});
},
}));
this.$el.append( this.form.$el );
} else {
Galaxy.emit.debug('tool-form-workflow::initialize()', 'Node not found in workflow.');
}
@@ -74,14 +79,6 @@ define( [ 'utils/utils', 'mvc/tool/tool-form-base' ],
_makeSections: function( options ){
var inputs = options.inputs;
var datatypes = options.datatypes;
inputs.push({
label : 'Annotation / Notes',
name : '__annotation',
type : 'text',
area : true,
help : 'Add an annotation or note for this step. It will be shown with the workflow.',
value : this.node.annotation
});
var output_id = this.node.output_terminals && Object.keys( this.node.output_terminals )[ 0 ];
if ( output_id ) {
inputs.push({
@@ -256,6 +253,7 @@ define( [ 'utils/utils', 'mvc/tool/tool-form-base' ],
});
return {
View: View
Default: Default,
Tool: Tool
};
});
@@ -6,13 +6,12 @@ define([
'mvc/workflow/workflow-canvas',
'mvc/workflow/workflow-node',
'mvc/workflow/workflow-icons',
'mvc/tool/tool-form-workflow',
'mvc/form/form-view',
'mvc/workflow/workflow-forms',
'mvc/ui/ui-misc',
'utils/async-save-text',
'libs/toastr',
'ui/editable-text'
], function( Utils, Globals, Workflow, WorkflowCanvas, Node, WorkflowIcons, ToolForm, Form, Ui, async_save_text, Toastr ){
], function( Utils, Globals, Workflow, WorkflowCanvas, Node, WorkflowIcons, FormWrappers, Ui, async_save_text, Toastr ){
// Reset tool search to start state.
function reset_tool_search( initValue ) {
@@ -661,62 +660,64 @@ define([
var $container = $( '#' + cls );
if ( content && $container.find( '#' + id ).length == 0 ) {
var $el = $( '<div id="' + id + '" class="' + cls + '"/>' );
var form = null;
var form_wrapper = null;
content.node = node;
content.workflow = this.workflow;
content.datatypes = this.datatypes;
content.icon = WorkflowIcons[ node.type ];
content.cls = 'ui-portlet-narrow';
if ( node.type == 'tool' ) {
content.node = node;
content.workflow = this.workflow;
content.datatypes = this.datatypes;
form = new ToolForm.View( content );
} else {
content.inputs.unshift({
type : 'text',
name : '__label',
label : 'Label',
value : node.label,
help : 'Add a step label.',
onchange: function( new_label ) {
var duplicate = false;
for ( var i in self.workflow.nodes ) {
var n = self.workflow.nodes[ i ];
if ( n.label && n.label == new_label && n.id != node.id ) {
duplicate = true;
break;
}
content.inputs.unshift({
type : 'text',
name : '__annotation',
label : 'Annotation',
fixed : true,
value : node.annotation,
area : true,
help : 'Add an annotation or notes to this step. Annotations are available when a workflow is viewed.'
});
content.inputs.unshift({
type : 'text',
name : '__label',
label : 'Label',
value : node.label,
help : 'Add a step label.',
fixed : true,
onchange: function( new_label ) {
var duplicate = false;
for ( var i in self.workflow.nodes ) {
var n = self.workflow.nodes[ i ];
if ( n.label && n.label == new_label && n.id != node.id ) {
duplicate = true;
break;
}
var input_id = form.data.match( '__label' );
var input_element = form.element_list[ input_id ];
input_element.model.set( 'error_text', duplicate && 'Duplicate label. Please fix this before saving the workflow.' );
form.trigger( 'change' );
}
var input_id = form_wrapper.form.data.match( '__label' );
var input_element = form_wrapper.form.element_list[ input_id ];
input_element.model.set( 'error_text', duplicate && 'Duplicate label. Please fix this before saving the workflow.' );
form_wrapper.form.trigger( 'change' );
}
});
content.onchange = function() {
Utils.request({
type : 'POST',
url : Galaxy.root + 'api/workflows/build_module',
data : {
id : node.id,
type : node.type,
content_id : node.content_id,
inputs : form_wrapper.form.data.create()
},
success : function( data ) {
node.update_field_data( data );
}
});
content.inputs.push({
type : 'text',
name : '__annotation',
label : 'Annotation',
value : node.annotation,
area : true,
help : 'Add an annotation or notes to this step. Annotations are available when a workflow is viewed.'
});
content.onchange = function() {
Utils.request({
type : 'POST',
url : Galaxy.root + 'api/workflows/build_module',
data : {
id : node.id,
type : node.type,
content_id : node.content_id,
inputs : form.data.create()
},
success : function( data ) {
node.update_field_data( data );
}
});
};
form = new Form( content );
};
if ( node.type == 'tool' ) {
form_wrapper = new FormWrappers.Tool( content );
} else {
form_wrapper = new FormWrappers.Default( content );
}
$el.append( form.$el );
$el.append( form_wrapper.form.$el );
$container.append( $el );
}
$( '.' + cls ).hide();
+12 -2
View File
@@ -412,8 +412,6 @@ class WorkflowContentsManager(UsesAnnotations):
}
def _workflow_to_dict_editor(self, trans, stored):
"""
"""
workflow = stored.latest_workflow
# Pack workflow data into a dictionary and return
data = {}
@@ -426,6 +424,8 @@ class WorkflowContentsManager(UsesAnnotations):
module = module_factory.from_workflow_step( trans, step )
if not module:
raise exceptions.MessageException( 'Unrecognized step type: %s' % step.type )
# Load label from state of data input modules, necessary for backward compatibility
self.__set_default_label( module, step.tool_inputs )
# Fix any missing parameters
upgrade_message = module.check_and_update_state()
if upgrade_message:
@@ -835,6 +835,7 @@ class WorkflowContentsManager(UsesAnnotations):
step_dict["subworkflow"] = subworkflow
module = module_factory.from_dict( trans, step_dict, **kwds )
self.__set_default_label( module, step_dict.get( 'tool_state' ) )
module.save_to_step( step )
annotation = step_dict[ 'annotation' ]
@@ -924,6 +925,15 @@ class WorkflowContentsManager(UsesAnnotations):
del step.temp_input_connections
def __set_default_label( self, module, state ):
""" Previously data input modules had a `name` attribute to rename individual steps. Here, this value is transferred
to the actual `label` attribute which is available for all module types, unique, and mapped to its own database column.
"""
if not module.label and module.type in [ 'data_input', 'data_collection_input' ] and isinstance( state, dict ):
default_label = state.get( 'name' )
if str( default_label ).lower() not in [ 'input dataset', 'input dataset collection' ]:
module.label = default_label
class MissingToolsException(exceptions.MessageException):
@@ -369,6 +369,7 @@ class WorkflowsAPIController(BaseAPIController, UsesStoredWorkflowMixin, UsesAnn
return {
'label' : inputs.get( '__label', '' ),
'annotation' : inputs.get( '__annotation', '' ),
'name' : module.get_name(),
'tool_state' : module.get_state(),
'data_inputs' : module.get_data_inputs(),
'data_outputs' : module.get_data_outputs(),
+7 -21
View File
@@ -236,7 +236,7 @@ class SubWorkflowModule( WorkflowModule ):
@classmethod
def from_dict( Class, trans, d, **kwds ):
module = Class( trans )
module = super( SubWorkflowModule, Class ).from_dict( trans, d, **kwds )
if "subworkflow" in d:
module.subworkflow = d[ "subworkflow" ]
elif "content_id" in d:
@@ -244,14 +244,12 @@ class SubWorkflowModule( WorkflowModule ):
module.subworkflow = WorkflowsManager( trans.app ).get_owned_workflow( trans, d[ "content_id" ] )
else:
raise Exception( "Step associated subworkflow could not be found." )
module.label = d.get( "label" )
return module
@classmethod
def from_workflow_step( Class, trans, step, **kwds ):
module = Class( trans )
module = super( SubWorkflowModule, Class ).from_workflow_step( trans, step, **kwds )
module.subworkflow = step.subworkflow
module.label = step.label
return module
def save_to_step( self, step ):
@@ -274,11 +272,9 @@ class SubWorkflowModule( WorkflowModule ):
if hasattr( self.subworkflow, 'input_steps' ):
for step in self.subworkflow.input_steps:
name = step.label
if name is None:
step_module = module_factory.from_workflow_step( self.trans, step )
name = step_module.state.inputs.get( "name" )
if not name:
raise Exception( "Failed to find name for workflow module." )
step_module = module_factory.from_workflow_step( self.trans, step )
name = step_module.get_name()
step_type = step.type
assert step_type in step_to_input_type
input = dict(
@@ -379,11 +375,6 @@ class InputModule( WorkflowModule ):
class InputDataModule( InputModule ):
type = "data_input"
name = "Input dataset"
default_name = "Input Dataset"
def get_inputs( self ):
name = self.state.inputs.get( 'name', self.default_name )
return dict( name=TextToolParameter( None, Element( "param", name="name", label="Name", type="text", value=name ) ) )
def get_data_outputs( self ):
return [ dict( name='output', extensions=['input'] ) ]
@@ -400,21 +391,17 @@ class InputDataModule( InputModule ):
return ', '.join( filter_set )
def get_runtime_inputs( self, connections=None ):
label = self.state.inputs.get( "name", "Input Dataset" )
return dict( input=DataToolParameter( None, Element( "param", name="input", label=label, multiple=False, type="data", format=self.get_filter_set( connections ) ), self.trans ) )
return dict( input=DataToolParameter( None, Element( "param", name="input", label=self.label, multiple=False, type="data", format=self.get_filter_set( connections ) ), self.trans ) )
class InputDataCollectionModule( InputModule ):
type = "data_collection_input"
name = "Input dataset collection"
default_name = "Input Dataset Collection"
default_collection_type = "list"
collection_type = default_collection_type
def get_inputs( self ):
name = self.state.inputs.get( "name", self.default_name )
collection_type = self.state.inputs.get( "collection_type", self.default_collection_type )
input_name = TextToolParameter( None, Element( "param", name="name", label="Name", type="text", value=name ) )
input_collection_type = TextToolParameter( None, XML(
'''
<param name="collection_type" label="Collection type" type="text" value="%s">
@@ -423,12 +410,11 @@ class InputDataCollectionModule( InputModule ):
<option value="list:paired">List of Dataset Pairs</option>
</param>
''' % collection_type ) )
return odict( [ ( "name", input_name ), ( "collection_type", input_collection_type ) ] )
return dict( collection_type=input_collection_type )
def get_runtime_inputs( self, **kwds ):
label = self.state.inputs.get( "name", self.default_name )
collection_type = self.state.inputs.get( "collection_type", self.default_collection_type )
input_element = Element( "param", name="input", label=label, type="data_collection", collection_type=collection_type )
input_element = Element( "param", name="input", label=self.label, type="data_collection", collection_type=collection_type )
return dict( input=DataCollectionToolParameter( None, input_element, self.trans ) )
def get_data_outputs( self ):
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"form-input.js","sources":["../../../src/mvc/form/form-input.js"],"names":["define","Backbone","View","extend","initialize","app","options","this","app_options","model","attributes","field","Model","text_enable","text_disable","cls_enable","cls_disable","set","setElement","_template","$field","$","$info","$preview","$collapsible","$collapsible_text","$collapsible_icon","$title","$title_text","$error_text","$error","$backdrop","prepend","$el","collapsible_value","get","collapsed","undefined","JSON","stringify","listenTo","render","self","on","trigger","backdrop","error","text","reset","hide","help_text","help_argument","indexOf","html","_","escape","error_text","show","color","style","collapsible_state","removeClass","addClass","attr","tooltip","placement","append"],"mappings":"AAGAA,UAAW,WACP,MAAOC,UAASC,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YAAY6B,OAAOV,KAAMxC,KAAKE,MAAM0B,IAAK,UAC9C5B,KAAKiB,aAAayB,WAXsE,CACxF,GAAIW,GAAoBrD,KAAKI,MAAMyB,UAAY,SAAW,SAC1D7B,MAAKqB,YAAYqB,OACjB1C,KAAKiB,aAAaiC,OAClBlD,KAAKkB,kBAAkBsB,KAAMxC,KAAKE,MAAM0B,IAAK,UAC7C5B,KAAKmB,kBAAkBmC,cAAcC,SAAU,QACxBA,SAAUvD,KAAKE,MAAM0B,IAAK,OAAUyB,IACpCG,KAAM,sBAAuBxD,KAAKE,MAAM0B,IAAK,QAAUyB,IACvDI,SAAWC,UAAW,aAOrD9C,UAAW,WACP,MAAQE,GAAG,UAAWyC,SAAU,mBACVI,OAAQ7C,EAAG,UAAWyC,SAAU,0BAC7BI,OAAQ7C,EAAG,WAAYyC,SAAU,qBACjCI,OAAQ7C,EAAG,WAAYyC,SAAU,wBAEpCI,OAAQ7C,EAAG,UAAWyC,SAAU,iBAC7BI,OAAQ7C,EAAG,UAAWyC,SAAU,uBAC5BI,OAAQ7C,EAAG,QAASyC,SAAU,6BAC9BI,OAAQ7C,EAAG,WAAYyC,SAAU,8BAErCI,OAAQ7C,EAAG,WAAYyC,SAAU,wBAEpCI,OAAQ7C,EAAG,UAAWyC,SAAU,iBAC7BI,OAAQ7C,EAAG,WAAYyC,SAAU,iBACjCI,OAAQ7C,EAAG,UAAWyC,SAAU,sBAEnCI,OAAQ7C,EAAG,UAAWyC,SAAU"}
{"version":3,"file":"form-input.js","sources":["../../../src/mvc/form/form-input.js"],"names":["define","Backbone","View","extend","initialize","app","options","this","app_options","model","attributes","field","Model","text_enable","text_disable","cls_enable","cls_disable","set","setElement","_template","$field","$","$info","$preview","$collapsible","$collapsible_text","$collapsible_icon","$title","$title_text","$error_text","$error","$backdrop","prepend","$el","collapsible_value","get","collapsed","undefined","JSON","stringify","listenTo","render","self","on","trigger","backdrop","error","text","reset","hide","help_text","help_argument","indexOf","html","_","escape","error_text","show","color","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E,MAAM0B,IAAK,WAEnG5B,KAAKE,MAAM0B,IAAK,aAA0DE,SAA1C9B,KAAKE,MAAM0B,IAAK,qBAUlD5B,KAAKqB,YAAY6B,OAAOV,KAAMxC,KAAKE,MAAM0B,IAAK,UAC9C5B,KAAKiB,aAAayB,WAXsE,CACxF,GAAIW,GAAoBrD,KAAKI,MAAMyB,UAAY,SAAW,SAC1D7B,MAAKqB,YAAYqB,OACjB1C,KAAKiB,aAAaiC,OAClBlD,KAAKkB,kBAAkBsB,KAAMxC,KAAKE,MAAM0B,IAAK,UAC7C5B,KAAKmB,kBAAkBmC,cAAcC,SAAU,QACxBA,SAAUvD,KAAKE,MAAM0B,IAAK,OAAUyB,IACpCG,KAAM,sBAAuBxD,KAAKE,MAAM0B,IAAK,QAAUyB,IACvDI,SAAWC,UAAW,aAOrD9C,UAAW,WACP,MAAQE,GAAG,UAAWyC,SAAU,mBACVI,OAAQ7C,EAAG,UAAWyC,SAAU,0BAC7BI,OAAQ7C,EAAG,WAAYyC,SAAU,qBACjCI,OAAQ7C,EAAG,WAAYyC,SAAU,wBAEpCI,OAAQ7C,EAAG,UAAWyC,SAAU,iBAC7BI,OAAQ7C,EAAG,UAAWyC,SAAU,uBAC5BI,OAAQ7C,EAAG,QAASyC,SAAU,6BAC9BI,OAAQ7C,EAAG,WAAYyC,SAAU,8BAErCI,OAAQ7C,EAAG,WAAYyC,SAAU,wBAEpCI,OAAQ7C,EAAG,UAAWyC,SAAU,iBAC7BI,OAAQ7C,EAAG,WAAYyC,SAAU,iBACjCI,OAAQ7C,EAAG,UAAWyC,SAAU,sBAEnCI,OAAQ7C,EAAG,UAAWyC,SAAU"}
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"form-section.js","sources":["../../../src/mvc/form/form-section.js"],"names":["define","Utils","Ui","Portlet","Repeat","InputElement","Parameters","View","Backbone","extend","initialize","app","options","this","inputs","parameters","setElement","$","render","self","$el","empty","_","each","input","add","input_def","jQuery","id","uid","input_list","type","_addConditional","_addRepeat","_addSection","_addRow","test_param","model","get","disabled","field","set","value","selectedCase","data","matchCase","i","cases","case_def","section_row","nonhidden","j","hidden","fadeIn","hide","trigger","sub_section","_append","addClass","create","sub_section_id","block_index","repeat","ondel","del","title","min","max","onnew","n_cache","size","cache","Math","default","hideOptions","input_element","label","name","help","portlet","cls","collapsible","collapsible_button","collapsed","expanded","append","html","on","input_id","length","expand","onchange","field_list","hide_label","text_value","collapsible_value","collapsible_preview","argument","color","style","backdrop","element_list","attr"],"mappings":"AAGAA,QAAS,cAAe,iBAAkB,oBAAqB,uBAAwB,sBAAuB,4BAC9G,SAAUC,EAAOC,EAAIC,EAASC,EAAQC,EAAcC,GAChD,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,EAAKC,GACvBC,KAAKF,IAAMA,EACXE,KAAKC,OAASF,EAAQE,OACtBD,KAAKE,WAAa,GAAIT,GACtBO,KAAKG,WAAYC,EAAG,WACpBJ,KAAKK,UAITA,OAAQ,WACJ,GAAIC,GAAON,IACXA,MAAKO,IAAIC,QACTC,EAAEC,KAAMV,KAAKC,OAAQ,SAAUU,GAAUL,EAAKM,IAAKD,MAIvDC,IAAK,SAAUD,GACX,GAAIE,GAAYC,OAAOlB,QAAQ,KAAUe,EAGzC,QAFAE,EAAUE,GAAKJ,EAAMI,GAAK3B,EAAM4B,MAChChB,KAAKF,IAAImB,WAAYJ,EAAUE,IAAOF,EAC9BA,EAAUK,MACd,IAAK,cACDlB,KAAKmB,gBAAiBN,EACtB,MACJ,KAAK,SACDb,KAAKoB,WAAYP,EACjB,MACJ,KAAK,UACDb,KAAKqB,YAAaR,EAClB,MACJ,SACIb,KAAKsB,QAAST,KAK1BM,gBAAiB,SAAUN,GACvB,GAAIP,GAAON,IACXa,GAAUU,WAAWR,GAAKF,EAAUE,GACpCf,KAAKF,IAAI0B,MAAMC,IAAK,0BAA8BZ,EAAUU,WAAWG,UAAW,EAClF,IAAIC,GAAQ3B,KAAKsB,QAAST,EAAU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B,EAAUgB,MAChCoD,WAAsBpE,EAAUoE,WAChCC,kBAAsBrE,EAAUqE,kBAChCC,oBAAsBtE,EAAUsE,oBAChClB,KAAsBpD,EAAUoD,KAChCmB,SAAsBvE,EAAUuE,SAChC1D,SAAsBb,EAAUa,SAChC2D,MAAsBxE,EAAUwE,MAChCC,MAAsBzE,EAAUyE,MAChCC,SAAsB1E,EAAU0E,SAChChD,OAAsB1B,EAAU0B,OAChCZ,MAAsBA,GAI1B,OAFA3B,MAAKF,IAAI0F,aAAczE,GAAO+C,EAC9B9D,KAAK4C,QAASkB,EAAcvD,IAAKM,EAAUE,IACpCY,GAIXiB,QAAS,SAAUrC,EAAKQ,GACpBf,KAAKO,IAAIiE,OAAQjE,EAAIsC,SAAU,eAAgB4C,KAAM,KAAM1E,MAInE,QACIrB,KAAMA"}
{"version":3,"file":"form-section.js","sources":["../../../src/mvc/form/form-section.js"],"names":["define","Utils","Ui","Portlet","Repeat","InputElement","Parameters","View","Backbone","extend","initialize","app","options","this","inputs","parameters","setElement","$","render","self","$el","empty","_","each","input","add","input_def","jQuery","id","uid","input_list","type","_addConditional","_addRepeat","_addSection","_addRow","test_param","model","get","disabled","field","set","value","selectedCase","data","matchCase","i","cases","case_def","section_row","nonhidden","j","hidden","fadeIn","hide","trigger","sub_section","_append","addClass","create","sub_section_id","block_index","repeat","ondel","del","title","min","max","onnew","n_cache","size","cache","Math","default","hideOptions","input_element","label","name","help","portlet","cls","collapsible","collapsible_button","collapsed","expanded","append","html","on","input_id","length","expand","onchange","field_list","hide_label","text_value","collapsible_value","collapsible_preview","argument","color","style","backdrop","fixed","element_list","attr"],"mappings":"AAGAA,QAAS,cAAe,iBAAkB,oBAAqB,uBAAwB,sBAAuB,4BAC9G,SAAUC,EAAOC,EAAIC,EAASC,EAAQC,EAAcC,GAChD,GAAIC,GAAOC,SAASD,KAAKE,QACrBC,WAAY,SAAUC,EAAKC,GACvBC,KAAKF,IAAMA,EACXE,KAAKC,OAASF,EAAQE,OACt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AMA"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define([],function(){return Backbone.View.extend({initialize:function(a,b){this.app=a,this.app_options=a.model?a.model.attributes:{},this.field=b&&b.field||new Backbone.View,this.model=b&&b.model||new Backbone.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up"}).set(b),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var c=this.model.get("collapsible_value");this.field.collapsed=void 0!==c&&JSON.stringify(this.model.get("value"))==JSON.stringify(c),this.listenTo(this.model,"change",this.render,this),this.render();var d=this;this.$collapsible.on("click",function(){d.field.collapsed=!d.field.collapsed,a.trigger&&a.trigger("change"),d.render()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(a){this.model.set("error_text",a)},reset:function(){this.model.set("error_text",null)},render:function(){$(".tooltip").hide();var a=this.model.get("help",""),b=this.model.get("argument");b&&-1==a.indexOf("("+b+")")&&(a+=" ("+b+")"),this.$info.html(a),this.$el[this.model.get("hidden")?"hide":"show"](),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(_.escape(this.model.get("text_value")));var c=this.model.get("error_text");if(this.$error[c?"show":"hide"](),this.$el[c?"addClass":"removeClass"]("ui-error"),this.$error_text.html(c),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.show(),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var d=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+d)).attr("data-original-title",this.model.get("text_"+d)).tooltip({placement:"bottom"})}},_template:function(){return $("<div/>").addClass("ui-form-element").append($("<div/>").addClass("ui-form-error ui-error").append($("<span/>").addClass("fa fa-arrow-down")).append($("<span/>").addClass("ui-form-error-text"))).append($("<div/>").addClass("ui-form-title").append($("<div/>").addClass("ui-form-collapsible").append($("<i/>").addClass("ui-form-collapsible-icon")).append($("<span/>").addClass("ui-form-collapsible-text"))).append($("<span/>").addClass("ui-form-title-text"))).append($("<div/>").addClass("ui-form-field").append($("<span/>").addClass("ui-form-info")).append($("<div/>").addClass("ui-form-backdrop"))).append($("<div/>").addClass("ui-form-preview"))}})});
define([],function(){return Backbone.View.extend({initialize:function(a,b){this.app=a,this.app_options=a.model?a.model.attributes:{},this.field=b&&b.field||new Backbone.View,this.model=b&&b.model||new Backbone.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up"}).set(b),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var c=this.model.get("collapsible_value");this.field.collapsed=void 0!==c&&JSON.stringify(this.model.get("value"))==JSON.stringify(c),this.listenTo(this.model,"change",this.render,this),this.render();var d=this;this.$collapsible.on("click",function(){d.field.collapsed=!d.field.collapsed,a.trigger&&a.trigger("change"),d.render()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(a){this.model.set("error_text",a)},reset:function(){!this.model.get("fixed")&&this.model.set("error_text",null)},render:function(){$(".tooltip").hide();var a=this.model.get("help",""),b=this.model.get("argument");b&&-1==a.indexOf("("+b+")")&&(a+=" ("+b+")"),this.$info.html(a),this.$el[this.model.get("hidden")?"hide":"show"](),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(_.escape(this.model.get("text_value")));var c=this.model.get("error_text");if(this.$error[c?"show":"hide"](),this.$el[c?"addClass":"removeClass"]("ui-error"),this.$error_text.html(c),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.show(),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var d=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+d)).attr("data-original-title",this.model.get("text_"+d)).tooltip({placement:"bottom"})}},_template:function(){return $("<div/>").addClass("ui-form-element").append($("<div/>").addClass("ui-form-error ui-error").append($("<span/>").addClass("fa fa-arrow-down")).append($("<span/>").addClass("ui-form-error-text"))).append($("<div/>").addClass("ui-form-title").append($("<div/>").addClass("ui-form-collapsible").append($("<i/>").addClass("ui-form-collapsible-icon")).append($("<span/>").addClass("ui-form-collapsible-text"))).append($("<span/>").addClass("ui-form-title-text"))).append($("<div/>").addClass("ui-form-field").append($("<span/>").addClass("ui-form-info")).append($("<div/>").addClass("ui-form-backdrop"))).append($("<div/>").addClass("ui-form-preview"))}})});
//# sourceMappingURL=../../../maps/mvc/form/form-input.js.map
+1 -1
View File
@@ -1,2 +1,2 @@
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/form/form-repeat","mvc/form/form-input","mvc/form/form-parameters"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(a,b){this.app=a,this.inputs=b.inputs,this.parameters=new f,this.setElement($("<div/>")),this.render()},render:function(){var a=this;this.$el.empty(),_.each(this.inputs,function(b){a.add(b)})},add:function(b){var c=jQuery.extend(!0,{},b);switch(c.id=b.id=a.uid(),this.app.input_list[c.id]=c,c.type){case"conditional":this._addConditional(c);break;case"repeat":this._addRepeat(c);break;case"section":this._addSection(c);break;default:this._addRow(c)}},_addConditional:function(a){var b=this;a.test_param.id=a.id,this.app.model.get("sustain_conditionals")&&(a.test_param.disabled=!0);var c=this._addRow(a.test_param);c.model&&c.model.set("onchange",function(c){var d=b.app.data.matchCase(a,c);for(var e in a.cases){var f=a.cases[e],g=b.$("#"+a.id+"-section-"+e),h=!1;for(var i in f.inputs)if(!f.inputs[i].hidden){h=!0;break}e==d&&h?g.fadeIn("fast"):g.hide()}b.app.trigger("change")});for(var d in a.cases){var e=new g(this.app,{inputs:a.cases[d].inputs});this._append(e.$el.addClass("ui-form-section"),a.id+"-section-"+d)}c.trigger("change")},_addRepeat:function(a){function b(b){var d=a.id+"-section-"+f++,e=new g(c.app,{inputs:b});h.add({id:d,$el:e.$el,ondel:function(){h.del(d),c.app.trigger("change")}})}for(var c=this,f=0,h=new d.View({title:a.title||"Repeat",min:a.min,max:a.max,onnew:function(){b(a.inputs),c.app.trigger("change")}}),i=_.size(a.cache),j=0;j<Math.max(Math.max(i,a.min||0),a.default||0);j++)b(i>j?a.cache[j]:a.inputs);this.app.model.get("sustain_repeats")&&h.hideOptions();var k=new e(this.app,{label:a.title||a.name,help:a.help,field:h});this._append(k.$el,a.id)},_addSection:function(a){var b=new c.View({title:a.title||a.name,cls:"ui-portlet-section",collapsible:!0,collapsible_button:!0,collapsed:!a.expanded});b.append(new g(this.app,{inputs:a.inputs}).$el),b.append($("<div/>").addClass("ui-form-info").html(a.help)),this.app.on("expand",function(a){b.$("#"+a).length>0&&b.expand()}),this._append(b.$el,a.id)},_addRow:function(a){var b=this,c=a.id;a.onchange=a.onchange||function(){b.app.trigger("change",c)};var d=this.parameters.create(a);this.app.field_list[c]=d;var f=new e(this.app,{name:a.name,label:a.hide_label?"":a.label||a.name,value:a.value,text_value:a.text_value,collapsible_value:a.collapsible_value,collapsible_preview:a.collapsible_preview,help:a.help,argument:a.argument,disabled:a.disabled,color:a.color,style:a.style,backdrop:a.backdrop,hidden:a.hidden,field:d});return this.app.element_list[c]=f,this._append(f.$el,a.id),d},_append:function(a,b){this.$el.append(a.addClass("section-row").attr("id",b))}});return{View:g}});
define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/form/form-repeat","mvc/form/form-input","mvc/form/form-parameters"],function(a,b,c,d,e,f){var g=Backbone.View.extend({initialize:function(a,b){this.app=a,this.inputs=b.inputs,this.parameters=new f,this.setElement($("<div/>")),this.render()},render:function(){var a=this;this.$el.empty(),_.each(this.inputs,function(b){a.add(b)})},add:function(b){var c=jQuery.extend(!0,{},b);switch(c.id=b.id=a.uid(),this.app.input_list[c.id]=c,c.type){case"conditional":this._addConditional(c);break;case"repeat":this._addRepeat(c);break;case"section":this._addSection(c);break;default:this._addRow(c)}},_addConditional:function(a){var b=this;a.test_param.id=a.id,this.app.model.get("sustain_conditionals")&&(a.test_param.disabled=!0);var c=this._addRow(a.test_param);c.model&&c.model.set("onchange",function(c){var d=b.app.data.matchCase(a,c);for(var e in a.cases){var f=a.cases[e],g=b.$("#"+a.id+"-section-"+e),h=!1;for(var i in f.inputs)if(!f.inputs[i].hidden){h=!0;break}e==d&&h?g.fadeIn("fast"):g.hide()}b.app.trigger("change")});for(var d in a.cases){var e=new g(this.app,{inputs:a.cases[d].inputs});this._append(e.$el.addClass("ui-form-section"),a.id+"-section-"+d)}c.trigger("change")},_addRepeat:function(a){function b(b){var d=a.id+"-section-"+f++,e=new g(c.app,{inputs:b});h.add({id:d,$el:e.$el,ondel:function(){h.del(d),c.app.trigger("change")}})}for(var c=this,f=0,h=new d.View({title:a.title||"Repeat",min:a.min,max:a.max,onnew:function(){b(a.inputs),c.app.trigger("change")}}),i=_.size(a.cache),j=0;j<Math.max(Math.max(i,a.min||0),a.default||0);j++)b(i>j?a.cache[j]:a.inputs);this.app.model.get("sustain_repeats")&&h.hideOptions();var k=new e(this.app,{label:a.title||a.name,help:a.help,field:h});this._append(k.$el,a.id)},_addSection:function(a){var b=new c.View({title:a.title||a.name,cls:"ui-portlet-section",collapsible:!0,collapsible_button:!0,collapsed:!a.expanded});b.append(new g(this.app,{inputs:a.inputs}).$el),b.append($("<div/>").addClass("ui-form-info").html(a.help)),this.app.on("expand",function(a){b.$("#"+a).length>0&&b.expand()}),this._append(b.$el,a.id)},_addRow:function(a){var b=this,c=a.id;a.onchange=a.onchange||function(){b.app.trigger("change",c)};var d=this.parameters.create(a);this.app.field_list[c]=d;var f=new e(this.app,{name:a.name,label:a.hide_label?"":a.label||a.name,value:a.value,text_value:a.text_value,collapsible_value:a.collapsible_value,collapsible_preview:a.collapsible_preview,help:a.help,argument:a.argument,disabled:a.disabled,color:a.color,style:a.style,backdrop:a.backdrop,hidden:a.hidden,fixed:a.fixed,field:d});return this.app.element_list[c]=f,this._append(f.$el,a.id),d},_append:function(a,b){this.$el.append(a.addClass("section-row").attr("id",b))}});return{View:g}});
//# sourceMappingURL=../../../maps/mvc/form/form-section.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
define(["utils/utils","mvc/form/form-view","mvc/tool/tool-form-base"],function(a,b,c){var d=Backbone.View.extend({initialize:function(a){this.form=new b(a)}}),e=Backbone.View.extend({initialize:function(b){var d=this;this.workflow=b.workflow,this.node=b.node,this.node?(this.post_job_actions=this.node.post_job_actions||{},a.deepeach(b.inputs,function(b){b.type&&(-1!=["data","data_collection"].indexOf(b.type)?(b.type="hidden",b.info="Data input '"+b.name+"' ("+a.textify(b.extensions)+")",b.value={__class__:"RuntimeValue"}):b.fixed||(b.collapsible_value={__class__:"RuntimeValue"},b.is_workflow=b.options&&0==b.options.length||-1!=["integer","float"].indexOf(b.type)))}),a.deepeach(b.inputs,function(a){"conditional"==a.type&&(a.test_param.collapsible_value=void 0)}),this._makeSections(b),this.form=new c(a.merge(b,{text_enable:"Set in Advance",text_disable:"Set at Runtime",narrow:!0,initial_errors:!0,sustain_version:!0,cls:"ui-portlet-narrow",postchange:function(b,c){var e=c.model.attributes,f={tool_id:e.id,tool_version:e.version,type:"tool",inputs:$.extend(!0,{},c.data.create())};Galaxy.emit.debug("tool-form-workflow::postchange()","Sending current state.",f),a.request({type:"POST",url:Galaxy.root+"api/workflows/build_module",data:f,success:function(a){c.update(a.config_form),c.errors(a.config_form),d.node.update_field_data(a),Galaxy.emit.debug("tool-form-workflow::postchange()","Received new model.",a),b.resolve()},error:function(a){Galaxy.emit.debug("tool-form-workflow::postchange()","Refresh request failed.",a),b.reject()}})}}))):Galaxy.emit.debug("tool-form-workflow::initialize()","Node not found in workflow.")},_makeSections:function(a){var b=a.inputs,c=a.datatypes,d=this.node.output_terminals&&Object.keys(this.node.output_terminals)[0];if(d){b.push({name:"pja__"+d+"__EmailAction",label:"Email notification",type:"boolean",value:String(Boolean(this.post_job_actions["EmailAction"+d])),ignore:"false",help:"An email notification will be sent when the job has completed.",payload:{host:window.location.host}}),b.push({name:"pja__"+d+"__DeleteIntermediatesAction",label:"Output cleanup",type:"boolean",value:String(Boolean(this.post_job_actions["DeleteIntermediatesAction"+d])),ignore:"false",help:"Upon completion of this step, delete non-starred outputs from completed workflow steps if they are no longer required as inputs."});for(var e in this.node.output_terminals)b.push(this._makeSection(e,c))}},_makeSection:function(a,b){function c(b,e){e=e||[],e.push(b);for(var f in b.inputs){var g=b.inputs[f],h=g.action;if(h){if(g.name="pja__"+a+"__"+g.action,g.pja_arg&&(g.name+="__"+g.pja_arg),g.payload)for(var i in g.payload){var j=g.payload[i];g.payload[g.name+"__"+i]=j,delete j}var k=d.post_job_actions[g.action+a];if(k){for(var l in e)e[l].expanded=!0;g.value=g.pja_arg?k.action_arguments&&k.action_arguments[g.pja_arg]||g.value:"true"}}g.inputs&&c(g,e.slice(0))}}var d=this,e=[],f=[];for(key in b)e.push({0:b[key],1:b[key]});for(key in this.node.input_terminals)f.push(this.node.input_terminals[key].name);e.sort(function(a,b){return a.label>b.label?1:a.label<b.label?-1:0}),e.unshift({0:"Sequences",1:"Sequences"}),e.unshift({0:"Roadmaps",1:"Roadmaps"}),e.unshift({0:"Leave unchanged",1:"__empty__"});var g={title:"Configure Output: '"+a+"'",type:"section",flat:!0,inputs:[{label:"Label",type:"text",value:(output=this.node.getWorkflowOutput(a))&&output.label||"",help:"This will provide a short name to describe the output - this must be unique across workflows.",onchange:function(b){d.workflow.attemptUpdateOutputLabel(d.node,a,b)}},{action:"RenameDatasetAction",pja_arg:"newname",label:"Rename dataset",type:"text",value:"",ignore:"",help:'This action will rename the output dataset. Click <a href="https://wiki.galaxyproject.org/Learn/AdvancedWorkflow/Variables">here</a> for more information. Valid inputs are: <strong>'+f.join(", ")+"</strong>."},{action:"ChangeDatatypeAction",pja_arg:"newtype",label:"Change datatype",type:"select",ignore:"__empty__",value:"__empty__",options:e,help:"This action will change the datatype of the output to the indicated value."},{action:"TagDatasetAction",pja_arg:"tags",label:"Tags",type:"text",value:"",ignore:"",help:"This action will set tags for the dataset."},{title:"Assign columns",type:"section",flat:!0,inputs:[{action:"ColumnSetAction",pja_arg:"chromCol",label:"Chrom column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"startCol",label:"Start column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"endCol",label:"End column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"strandCol",label:"Strand column",type:"integer",value:"",ignore:""},{action:"ColumnSetAction",pja_arg:"nameCol",label:"Name column",type:"integer",value:"",ignore:""}],help:"This action will set column assignments in the output dataset. Blank fields are ignored."}]};return c(g),g}});return{Default:d,Tool:e}});
//# sourceMappingURL=../../../maps/mvc/workflow/workflow-forms.js.map
File diff suppressed because one or more lines are too long
+25 -83
View File
@@ -25,99 +25,61 @@ def test_valid_new_tool_has_no_errors():
def test_data_input_default_state():
trans = MockTrans()
module = modules.module_factory.from_dict( trans, { "type": "data_input" } )
module = modules.module_factory.from_dict( trans, { "type": "data_input", "label": "Input Dataset" } )
__assert_has_runtime_input( module, label="Input Dataset" )
def test_data_input_modified_state():
module = __from_state( {
"type": "data_input",
"tool_state": json.dumps({ "name": "Cool Input" }),
} )
module = __from_state( { "type": "data_input", "label": "Cool Input" } )
__assert_has_runtime_input( module, label="Cool Input" )
def test_data_input_step_modified_state():
module = __from_step(
type="data_input",
tool_inputs={
"name": "Cool Input",
},
)
module = __from_step( type="data_input", label="Cool Input" )
__assert_has_runtime_input( module, label="Cool Input" )
def test_data_input_compute_runtime_state_default():
module = __from_step(
type="data_input",
)
module = __from_step( type="data_input" )
state, errors = module.compute_runtime_state( module.trans )
assert not errors
assert 'input' in state.inputs
assert state.inputs[ 'input' ] is None
assert "input" in state.inputs
assert state.inputs[ "input" ] is None
def test_data_input_compute_runtime_state_args():
module = __from_step(
type="data_input",
)
module = __from_step( type="data_input" )
tool_state = module.get_state()
hda = model.HistoryDatasetAssociation()
with mock.patch('galaxy.workflow.modules.check_param') as check_method:
with mock.patch("galaxy.workflow.modules.check_param") as check_method:
check_method.return_value = ( hda, None )
state, errors = module.compute_runtime_state( module.trans, { 'input': 4, 'tool_state': tool_state } )
state, errors = module.compute_runtime_state( module.trans, { "input": 4, "tool_state": tool_state } )
assert not errors
assert 'input' in state.inputs
assert state.inputs[ 'input' ] is hda
assert "input" in state.inputs
assert state.inputs[ "input" ] is hda
def test_data_input_connections():
module = __from_step(
type="data_input",
)
module = __from_step( type="data_input" )
assert len( module.get_data_inputs() ) == 0
outputs = module.get_data_outputs()
assert len( outputs ) == 1
output = outputs[ 0 ]
assert output[ 'name' ] == 'output'
assert output[ 'extensions' ] == [ 'input' ]
def test_data_input_update():
module = __from_step(
type="data_input",
tool_inputs={
"name": "Cool Input",
},
)
module.recover_state( dict( name="Awesome New Name" ) )
assert module.state.inputs[ 'name' ] == "Awesome New Name"
def test_data_input_get_form():
module = __from_step(
type="data_input",
tool_inputs={
"name": "Cool Input",
},
)
result = module.get_config_form()
assert result[ 'inputs' ][ 0 ][ 'value' ], 'Cool Input'
assert output[ "name" ] == "output"
assert output[ "extensions" ] == [ "input" ]
def test_data_collection_input_default_state():
trans = MockTrans()
module = modules.module_factory.from_dict( trans, { "type": "data_collection_input" } )
module = modules.module_factory.from_dict( trans, { "type": "data_collection_input", "label": "Input Dataset Collection" } )
__assert_has_runtime_input( module, label="Input Dataset Collection", collection_type="list" )
def test_data_input_collection_modified_state():
module = __from_state( {
"type": "data_collection_input",
"tool_state": json.dumps({ "name": "Cool Input Collection", "collection_type": "list:paired" }),
"label": "Cool Input Collection",
"tool_state": json.dumps({ "collection_type": "list:paired" }),
} )
__assert_has_runtime_input( module, label="Cool Input Collection", collection_type="list:paired" )
@@ -125,8 +87,8 @@ def test_data_input_collection_modified_state():
def test_data_input_collection_step_modified_state():
module = __from_step(
type="data_collection_input",
label="Cool Input Collection",
tool_inputs={
"name": "Cool Input Collection",
"collection_type": "list:paired",
},
)
@@ -137,42 +99,27 @@ def test_data_collection_input_connections():
module = __from_step(
type="data_collection_input",
tool_inputs={
'collection_type': 'list:paired'
"collection_type": "list:paired"
}
)
assert len( module.get_data_inputs() ) == 0
outputs = module.get_data_outputs()
assert len( outputs ) == 1
output = outputs[ 0 ]
assert output[ 'name' ] == 'output'
assert output[ 'extensions' ] == [ 'input_collection' ]
assert output[ 'collection_type' ] == 'list:paired'
def test_data_collection_input_update():
module = __from_step(
type="data_collection_input",
tool_inputs={
'name': 'Cool Collection',
'collection_type': 'list:paired',
}
)
module.recover_state( dict( name="New Collection", collection_type="list" ) )
assert module.state.inputs[ 'name' ] == "New Collection"
assert output[ "name" ] == "output"
assert output[ "extensions" ] == [ "input_collection" ]
assert output[ "collection_type" ] == "list:paired"
def test_data_collection_input_config_form():
module = __from_step(
type="data_collection_input",
tool_inputs={
'name': 'Cool Collection',
'collection_type': 'list:paired',
"collection_type": "list:paired",
}
)
result = module.get_config_form()
assert result[ 'inputs' ][ 0 ][ 'value' ], 'Cool Collection'
assert result[ 'inputs' ][ 1 ][ 'value' ], 'list:paired'
assert result[ "inputs" ][ 0 ][ "value" ], "list:paired"
def test_cannot_create_tool_modules_for_missing_tools():
@@ -216,9 +163,8 @@ TEST_WORKFLOW_YAML = """
steps:
- type: "data_input"
label: "input1"
tool_inputs: {"name": "input1"}
- type: "data_collection_input"
tool_inputs: {"name": "input2"}
label: "input2"
- type: "tool"
tool_id: "cat1"
input_connections:
@@ -252,7 +198,6 @@ def test_subworkflow_new_inputs():
input1, input2 = inputs
assert input1["input_type"] == "dataset"
assert input1["name"] == "input1"
assert input2["input_type"] == "dataset_collection"
assert input2["name"] == "input2", input2["name"]
@@ -265,7 +210,6 @@ def test_subworkflow_new_outputs():
assert output1["name"] == "out1"
assert output1["label"] == "out1"
assert output1["extensions"] == ["input"]
assert output2["name"] == "4:out_file1", output2["name"]
assert output2["label"] == "4:out_file1", output2["label"]
@@ -283,7 +227,6 @@ def __assert_has_runtime_input( module, label=None, collection_type=None ):
inputs = module.get_runtime_inputs()
assert len( inputs ) == 1
assert "input" in inputs
input_param = inputs[ "input" ]
if label is not None:
assert input_param.get_label() == label, input_param.get_label()
@@ -318,7 +261,6 @@ def __step( **kwds ):
step = model.WorkflowStep()
for key, value in kwds.items():
setattr( step, key, value )
return step