Load tools with collection type source attributes into the workflow editor.

Should allow using filter failed and merge collection tools within workflows.
This commit is contained in:
John Chilton
2017-08-29 15:28:39 -04:00
parent d56fcf6777
commit b75f793ea4
4 changed files with 24 additions and 20 deletions
@@ -476,11 +476,29 @@ define(['mvc/workflow/workflow-globals'], function( Globals ) {
initialize: function( attr ) {
Terminal.prototype.initialize.call( this, attr );
this.datatypes = attr.datatypes;
this.collectionType = new CollectionTypeDescription( attr.collection_type );
this.isCollection = true;
if( attr.collection_type ) {
this.collectionType = new CollectionTypeDescription( attr.collection_type );
} else {
var collectionTypeSource = attr.collection_type_source;
if(! collectionTypeSource) {
console.log("Warning: No collection type or collection type source defined.");
}
this.collectionType = ANY_COLLECTION_TYPE_DESCRIPTION;
}
this.isCollection = true;
},
update: function( output ) {
var newCollectionType = new CollectionTypeDescription( output.collection_type );
var newCollectionType;
if( output.collection_type ) {
newCollectionType = new CollectionTypeDescription( output.collection_type );
} else {
var collectionTypeSource = output.collection_type_source;
if(! collectionTypeSource) {
console.log("Warning: No collection type or collection type source defined.");
}
newCollectionType = ANY_COLLECTION_TYPE_DESCRIPTION;
}
if( newCollectionType.collectionType != this.collectionType.collectionType ) {
_.each( this.connectors, function( connector ) {
// TODO: consider checking if connection valid before removing...
@@ -224,7 +224,8 @@ define(['mvc/workflow/workflow-globals', 'mvc/workflow/workflow-terminals',
terminalMappingViewClass: TerminalMappingView,
terminalForOutput: function( output ) {
var collection_type = output.collection_type;
var terminal = new Terminals.OutputCollectionTerminal( { element: this.el, collection_type: collection_type, datatypes: output.extensions } );
var collection_type_source = output.collection_type_source;
var terminal = new Terminals.OutputCollectionTerminal( { element: this.el, collection_type: collection_type, collection_type_source: collection_type_source, datatypes: output.extensions } );
return terminal;
}
});
-16
View File
@@ -472,18 +472,6 @@ class Tool(object, Dictifiable):
installed_changeset_revision=self.installed_changeset_revision)
return None
@property
def produces_collections_of_unknown_type(self):
def output_is_dynamic_collection(output):
if not output.collection:
return False
if output.structure.collection_type:
return False
return True
return any(map(output_is_dynamic_collection, self.outputs.values()))
@property
def produces_collections_with_unknown_structure(self):
@@ -1192,10 +1180,6 @@ class Tool(object, Dictifiable):
if self.tool_type.startswith('data_source'):
return False
if self.produces_collections_of_unknown_type:
# Getting there...
return False
if hasattr(tool_source, "root"):
root = tool_source.root
if not string_as_bool(root.get("workflow_compatible", "True")):
+1
View File
@@ -686,6 +686,7 @@ class ToolModule(WorkflowModule):
if tool_output.collection:
extra_kwds["collection"] = True
extra_kwds["collection_type"] = tool_output.structure.collection_type
extra_kwds["collection_type_source"] = tool_output.structure.collection_type_source
formats = ['input'] # TODO: fix
elif tool_output.format_source is not None:
formats = ['input'] # default to special name "input" which remove restrictions on connections