# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Kanwei Li <kanwei@gmail.com> # Date 1289852143 18000 # Node ID 02f6c9dae26e9aef40a44bc151ed07b457715839 # Parent 0505090dbbe610741cacd7a9a1c2e79b8cc9ea5c Data libraries: Fix 'import from current history' showing metadata files that are not visible. Also fix this same issue for 'Copy history items' feature. Do this by adding new 'visible_datasets' mapping property for HDAs. Checkbox labels for both features can now be clicked. --- a/templates/root/index.mako +++ b/templates/root/index.mako @@ -40,7 +40,7 @@ "Show Hidden Datasets": function() { galaxy_history.location = "${h.url_for( controller='root', action='history', show_hidden=True)}"; }, - "Show structure": function() { + "Show Structure": function() { galaxy_main.location = "${h.url_for( controller='history', action='display_structured' )}"; }, "Export to File": function() { --- a/templates/library/common/common.mako +++ b/templates/library/common/common.mako @@ -427,14 +427,11 @@ <input type="hidden" name="upload_option" value="import_from_history"/><input type="hidden" name="ldda_message" value="${ldda_message}"/><% + role_ids_selected = '' if roles_select_list: - role_ids_selected = roles_select_list.get_selected( return_value=True, multi=True ) - if role_ids_selected: - role_ids_selected = ','.join( role_ids_selected ) - else: - role_ids_selected = '' - else: - role_ids_selected = '' + selected = roles_select_list.get_selected( return_value=True, multi=True ) + if selected: + role_ids_selected = ','.join( selected ) %><input type="hidden" name="roles" value="${role_ids_selected}"/> %if replace_dataset not in [ None, 'None' ]: @@ -450,9 +447,11 @@ ${render_template_field( field, render_as_hidden=True )} %endfor %endif - %for hda in history.active_datasets: + %for hda in history.visible_datasets: + <% encoded_id = trans.security.encode_id( hda.id ) %><div class="form-row"> - <input name="hda_ids" value="${trans.security.encode_id( hda.id )}" type="checkbox"/>${hda.hid}: ${hda.name} + <input name="hda_ids" id="hist_${encoded_id}" value="${encoded_id}" type="checkbox"/> + <label for="hist_${encoded_id}" style="display: inline;font-weight:normal;">${hda.hid}: ${hda.name}</label></div> %endfor <div class="form-row"> @@ -460,9 +459,7 @@ </div></form> %else: - <p/> - Your current history is empty - <p/> + <p>Your current history is empty</p> %endif </div></div> --- a/templates/dataset/copy_view.mako +++ b/templates/dataset/copy_view.mako @@ -17,22 +17,29 @@ </p> %endif <p> + <div class="infomessage">Select any number of source history items and any number of target histories and click "Copy History Items" to add a copy of each selected history item to each selected target history.</div> + <div style="clear: both"></div> +</p> +<p><div class="toolForm"><form> - <div style="float: left; width: 50%; padding: 0px 0px 0px 0px;"> + <div style="float: left; width: 50%; padding: 0px;"><div class="toolFormTitle">Source History Items</div><div class="toolFormBody"> %for data in source_datasets: <% checked = "" if data.id in source_dataset_ids: - checked = " checked" + checked = " checked='checked'" %> - <div class="form-row"><input type="checkbox" name="source_dataset_ids" value="${data.id}"${checked}/> ${data.hid}: ${data.name}</div> + <div class="form-row"> + <input type="checkbox" name="source_dataset_ids" id="dataset_${data.id}" value="${data.id}"${checked}/> + <label for="dataset_${data.id}" style="display: inline;font-weight:normal;"> ${data.hid}: ${data.name}</label> + </div> %endfor </div></div> - <div style="float: right; width: 50%; padding: 0px 0px 0px 0px;"> + <div style="float: right; width: 50%; padding: 0px;"><div class="toolFormTitle">Target Histories</div><div class="toolFormBody"> %for i, hist in enumerate( target_histories ): @@ -44,13 +51,16 @@ if hist == trans.get_history(): cur_history_text = " <strong>(current history)</strong>" %> - <div class="form-row"><input type="checkbox" name="target_history_ids" value="${hist.id}"${checked}/> ${i + 1}${cur_history_text}: ${hist.name}</div> + <div class="form-row"> + <input type="checkbox" name="target_history_ids" id="hist_${hist.id}" value="${hist.id}"${checked}/> + <label for="hist_${hist.id}" style="display: inline;font-weight:normal;">${i + 1}: ${hist.name}${cur_history_text}</label> + </div> %endfor %if trans.get_user(): <% checked = "" if "create_new_history" in target_history_ids: - checked = " checked" + checked = " checked='checked'" %><br/><div class="form-row"><input type="checkbox" name="target_history_ids" value="create_new_history"${checked}/>New history named: <input type="textbox" name="new_history_name" value="${new_history_name}"/></div> @@ -64,8 +74,3 @@ </form></div></p> -<div style="clear: both"></div> -<p> - <div class="infomessage">Select any number of source history items and any number of target histories and click "Copy History Items" to add a copy of each selected history item to each selected target history.</div> - <div style="clear: both"></div> -</p> --- a/lib/galaxy/web/controllers/dataset.py +++ b/lib/galaxy/web/controllers/dataset.py @@ -773,7 +773,7 @@ class DatasetInterface( BaseController, trans.sa_session.refresh( history ) elif create_new_history: target_history_ids.append( "create_new_history" ) - source_datasets = history.active_datasets + source_datasets = history.visible_datasets target_histories = [history] if user: target_histories = user.active_histories --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -1033,7 +1033,9 @@ assign_mapper( context, ImplicitlyConver assign_mapper( context, History, History.table, properties=dict( galaxy_sessions=relation( GalaxySessionToHistoryAssociation ), datasets=relation( HistoryDatasetAssociation, backref="history", order_by=asc(HistoryDatasetAssociation.table.c.hid) ), - active_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & ( not_( HistoryDatasetAssociation.table.c.deleted ) ) ), order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ), + active_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & not_( HistoryDatasetAssociation.table.c.deleted ) ), order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ), + visible_datasets=relation( HistoryDatasetAssociation, primaryjoin=( ( HistoryDatasetAssociation.table.c.history_id == History.table.c.id ) & not_( HistoryDatasetAssociation.table.c.deleted ) & HistoryDatasetAssociation.table.c.visible ), + order_by=asc( HistoryDatasetAssociation.table.c.hid ), viewonly=True ), tags=relation( HistoryTagAssociation, order_by=HistoryTagAssociation.table.c.id, backref="histories" ), annotations=relation( HistoryAnnotationAssociation, order_by=HistoryAnnotationAssociation.table.c.id, backref="histories" ), ratings=relation( HistoryRatingAssociation, order_by=HistoryRatingAssociation.table.c.id, backref="histories" ) )