3 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/20dcff34ee3b/ Changeset: 20dcff34ee3b User: jmchilton Date: 2014-07-24 21:30:11 Summary: More collection-y state update tests. Affected #: 1 file diff -r 9d8967752787556b3d814e086fe2bd9eb1992170 -r 20dcff34ee3bb598969c51a7c5b53e9dd679c111 test/unit/tools/test_execution.py --- a/test/unit/tools/test_execution.py +++ b/test/unit/tools/test_execution.py @@ -16,13 +16,12 @@ eggs.require( "Paste" ) from paste import httpexceptions -# Tool with a repeat parameter, to test state update. -REPEAT_TOOL_CONTENTS = '''<tool id="test_tool" name="Test Tool"> +BASE_REPEAT_TOOL_CONTENTS = '''<tool id="test_tool" name="Test Tool"><command>echo "$param1" #for $r in $repeat# "$r.param2" #end for# < $out1</command><inputs><param type="text" name="param1" value="" /><repeat name="repeat1" label="Repeat 1"> - <param type="text" name="param2" value="" /> + %s </repeat></inputs><outputs> @@ -31,6 +30,10 @@ </tool> ''' +# Tool with a repeat parameter, to test state update. +REPEAT_TOOL_CONTENTS = BASE_REPEAT_TOOL_CONTENTS % '''<param type="text" name="param2" value="" />''' +REPEAT_COLLECTION_PARAM_CONTENTS = BASE_REPEAT_TOOL_CONTENTS % '''<param type="data_collection" name="param2" collection_type="paired" />''' + class ToolExecutionTestCase( TestCase, tools_support.UsesApp, tools_support.UsesTools ): @@ -287,13 +290,48 @@ } ) self.__assert_exeuted( template, template_vars ) - def __history_dataset_collection_for( self, hdas, id=1234 ): - collection = galaxy.model.DatasetCollection() + def test_subcollection_multirun_with_state_updates( self ): + self._init_tool( REPEAT_COLLECTION_PARAM_CONTENTS ) + hda1, hda2 = self.__add_dataset( 1 ), self.__add_dataset( 2 ) + collection = self.__history_dataset_collection_for( [ hda1, hda2 ], collection_type="list:paired" ) + collection_id = self.app.security.encode_id( collection.id ) + self.app.dataset_collections_service = Bunch( + match_collections=lambda collections: None + ) + template, template_vars = self.__handle_with_incoming( + repeat1_add="dummy", + ) + state = self.__assert_rerenders_tool_without_errors( template, template_vars ) + assert len( state.inputs[ "repeat1" ] ) == 1 + template, template_vars = self.__handle_with_incoming( state, **{ + "repeat1_0|param2|__collection_multirun__": "%s|paired" % collection_id, + "repeat1_add": "dummy", + } ) + state = self.__assert_rerenders_tool_without_errors( template, template_vars ) + assert state.inputs[ "repeat1" ][ 0 ][ "param2|__collection_multirun__" ] == "%s|paired" % collection_id + + def __history_dataset_collection_for( self, hdas, collection_type="list", id=1234 ): + collection = galaxy.model.DatasetCollection( + collection_type=collection_type, + ) to_element = lambda hda: galaxy.model.DatasetCollectionElement( collection=collection, element=hda, ) - collection.datasets = map(to_element, hdas) + elements = map(to_element, hdas) + if collection_type == "list:paired": + paired_collection = galaxy.model.DatasetCollection( + collection_type="paired", + ) + paired_collection.elements = elements + list_dce = galaxy.model.DatasetCollectionElement( + collection=collection, + element=paired_collection, + ) + elements = [ list_dce ] + + collection.elements = elements + history_dataset_collection_association = galaxy.model.HistoryDatasetCollectionAssociation( id=id, collection=collection, @@ -349,13 +387,13 @@ self.history.datasets.append( hda ) return hda - def __add_collection_dataset( self, id, *hdas ): + def __add_collection_dataset( self, id, collection_type="paired", *hdas ): hdca = galaxy.model.HistoryDatasetCollectionAssociation() hdca.id = id collection = galaxy.model.DatasetCollection() hdca.collection = collection collection.elements = [ galaxy.model.DatasetCollectionElement(element=self.__add_dataset( 1 )) ] - + collection.type = collection_type self.trans.sa_session.model_objects[ galaxy.model.HistoryDatasetCollectionAssociation ][ id ] = hdca self.history.dataset_collections.append( hdca ) return hdca https://bitbucket.org/galaxy/galaxy-central/commits/9c2cbf6c7f3d/ Changeset: 9c2cbf6c7f3d User: jmchilton Date: 2014-07-24 21:30:11 Summary: Fix multirun and collection multirun state updates in tool param GUI. 4139740 fixed backend and had tests so I guess I didn't even manually test, turns out tool parameter GUI generation needed to fixed for these changes though. Affected #: 1 file diff -r 20dcff34ee3bb598969c51a7c5b53e9dd679c111 -r 9c2cbf6c7f3db7cb59ebd53b9c2829404077993a lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1712,10 +1712,15 @@ if self.__display_multirun_option(): # Select multiple datasets, run multiple jobs. multirun_key = "%s|__multirun__" % self.name + collection_multirun_key = "%s|__collection_multirun__" % self.name if multirun_key in (other_values or {}): multirun_value = listify( other_values[ multirun_key ] ) if multirun_value and len( multirun_value ) > 1: default_field = "select_multiple" + elif collection_multirun_key in (other_values or {}): + multirun_value = listify( other_values[ collection_multirun_key ] ) + if multirun_value: + default_field = "select_collection" else: multirun_value = value multi_dataset_matcher = DatasetMatcher( trans, self, multirun_value, other_values ) @@ -2014,9 +2019,17 @@ default_field = "select_single_collection" fields = odict() + collection_multirun_key = "%s|__collection_multirun__" % self.name + if collection_multirun_key in (other_values or {}): + multirun_value = other_values[ collection_multirun_key ] + if multirun_value: + default_field = "select_map_over_collections" + else: + multirun_value = value + history = self._get_history( trans ) fields[ "select_single_collection" ] = self._get_single_collection_field( trans=trans, history=history, value=value, other_values=other_values ) - fields[ "select_map_over_collections" ] = self._get_select_dataset_collection_field( trans=trans, history=history, value=value, other_values=other_values ) + fields[ "select_map_over_collections" ] = self._get_select_dataset_collection_field( trans=trans, history=history, value=multirun_value, other_values=other_values ) return self._switch_fields( fields, default_field=default_field ) https://bitbucket.org/galaxy/galaxy-central/commits/2be892855090/ Changeset: 2be892855090 User: jmchilton Date: 2014-07-24 21:30:11 Summary: Small UI fix for data param multirun options. Index-based logic wasn't updated after made it so certain options wouldn't be visible if they were not valid for a given history. Affected #: 1 file diff -r 9c2cbf6c7f3db7cb59ebd53b9c2829404077993a -r 2be89285509068e862d27d41c3ba02c5a59e5b00 static/scripts/galaxy.tools.js --- a/static/scripts/galaxy.tools.js +++ b/static/scripts/galaxy.tools.js @@ -86,7 +86,7 @@ }).attr( 'title', selectionType['select_by'] - ); + ).data( "index", iIndex ); view.formRow().find( "label" ).append( button ); } }); @@ -114,11 +114,13 @@ } else { $("div#remap-row").css("display", "none"); } - this.formRow().find( "i" ).each(function(index, iElement) { + this.formRow().find( "i" ).each(function(_, iElement) { + var $iElement = $(iElement); + var index = $iElement.data("index"); if(index == enableIndex) { - $(iElement).css('color', 'black'); + $iElement.css('color', 'black'); } else { - $(iElement).css('color', 'Gray'); + $iElement.css('color', 'Gray'); } }); var $select = this.$( "select" ); 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.