Skip to content

Commit

Permalink
Merge pull request #18307 from mvdbeek/do_not_show_display_applicatio…
Browse files Browse the repository at this point in the history
…n_links_for_deleted_datasets

[24.0] Don't serialize display application links for deleted datasets
  • Loading branch information
mvdbeek authored Jun 3, 2024
2 parents 132ea2b + 91610dd commit a4376d3
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions lib/galaxy/managers/hdas.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,18 +617,19 @@ def serialize_display_apps(self, item, key, trans=None, **context):
"""
hda = item
display_apps: List[Dict[str, Any]] = []
for display_app in hda.get_display_applications(trans).values():
app_links = []
for link_app in display_app.links.values():
app_links.append(
{
"target": link_app.url.get("target_frame", "_blank"),
"href": link_app.get_display_url(hda, trans),
"text": gettext.gettext(link_app.name),
}
)
if app_links:
display_apps.append(dict(label=display_app.name, links=app_links))
if hda.state == model.HistoryDatasetAssociation.states.OK and not hda.deleted:
for display_app in hda.get_display_applications(trans).values():
app_links = []
for link_app in display_app.links.values():
app_links.append(
{
"target": link_app.url.get("target_frame", "_blank"),
"href": link_app.get_display_url(hda, trans),
"text": gettext.gettext(link_app.name),
}
)
if app_links:
display_apps.append(dict(label=display_app.name, links=app_links))

return display_apps

Expand All @@ -638,28 +639,30 @@ def serialize_old_display_applications(self, item, key, trans=None, **context):
"""
hda = item
display_apps: List[Dict[str, Any]] = []
if not self.app.config.enable_old_display_applications:
return display_apps

display_link_fn = hda.datatype.get_display_links
for display_app in hda.datatype.get_display_types():
target_frame, display_links = display_link_fn(
hda,
display_app,
self.app,
trans.request.base,
)
if (
self.app.config.enable_old_display_applications
and hda.state == model.HistoryDatasetAssociation.states.OK
and not hda.deleted
):
display_link_fn = hda.datatype.get_display_links
for display_app in hda.datatype.get_display_types():
target_frame, display_links = display_link_fn(
hda,
display_app,
self.app,
trans.request.base,
)

if len(display_links) > 0:
display_label = hda.datatype.get_display_label(display_app)
if len(display_links) > 0:
display_label = hda.datatype.get_display_label(display_app)

app_links = []
for display_name, display_link in display_links:
app_links.append(
{"target": target_frame, "href": display_link, "text": gettext.gettext(display_name)}
)
if app_links:
display_apps.append(dict(label=display_label, links=app_links))
app_links = []
for display_name, display_link in display_links:
app_links.append(
{"target": target_frame, "href": display_link, "text": gettext.gettext(display_name)}
)
if app_links:
display_apps.append(dict(label=display_label, links=app_links))

return display_apps

Expand Down

0 comments on commit a4376d3

Please sign in to comment.