Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide outdated visualizations from visualizations activity panel #19353

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Bar diagram (jqPlot)">
<visualization name="Bar diagram (jqPlot)" visible="false">
<macros>
<import>jqplot_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Box plot (jqPlot)" embeddable="false">
<visualization name="Box plot (jqPlot)" embeddable="false" visible="false">
<macros>
<import>../../jqplot_bar/config/jqplot_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Discrete Histogram (jqPlot)" embeddable="false">
<visualization name="Discrete Histogram (jqPlot)" embeddable="false" visible="false">
<macros>
<import>../../jqplot_bar/config/jqplot_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Line chart (jqPlot)">
<visualization name="Line chart (jqPlot)" visible="false">
<macros>
<import>../../jqplot_bar/config/jqplot_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Scatter plot (jqPlot)">
<visualization name="Scatter plot (jqPlot)" visible="false">
<macros>
<import>../../jqplot_bar/config/jqplot_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Bar diagram (NVD3)">
<visualization name="Bar diagram (NVD3)" visible="false">
<macros>
<import>nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Bar Stacked (NVD3)">
<visualization name="Bar Stacked (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Histogram (NVD3)" embeddable="false">
<visualization name="Histogram (NVD3)" embeddable="false" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Histogram Discrete (NVD3)" embeddable="false">
<visualization name="Histogram Discrete (NVD3)" embeddable="false" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Bar Horizontal (NVD3)">
<visualization name="Bar Horizontal (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Bar Horizontal Stacked (NVD3)">
<visualization name="Bar Horizontal Stacked (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Line chart (NVD3)">
<visualization name="Line chart (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Line with focus (NVD3)">
<visualization name="Line with focus (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Pie chart (NVD3)">
<visualization name="Pie chart (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Scatter plot (NVD3)">
<visualization name="Scatter plot (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Stacked area (NVD3)">
<visualization name="Stacked area (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Expanded (NVD3)">
<visualization name="Expanded (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Stream (NVD3)">
<visualization name="Stream (NVD3)" visible="false">
<macros>
<import>../../nvd3_bar/config/nvd3_shared.xml</import>
</macros>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
<visualization name="Scatterplot">
<visualization name="Scatterplot" visible="false">
<description>Creates a 2D-scatterplot from tabular datapoints</description>
<data_sources>
<data_source>
Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/visualization/plugins/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ def parse_visualization(self, xml_tree):
if "embeddable" in xml_tree.attrib:
returned["embeddable"] = asbool(xml_tree.attrib.get("embeddable"))

# record the visible flag - defaults to true
returned["visible"] = True
if "visible" in xml_tree.attrib:
returned["visible"] = asbool(xml_tree.attrib.get("visible"))

# a (for now) text description of what the visualization does
description = xml_tree.find("description")
returned["description"] = description.text.strip() if description is not None else None
Expand Down
26 changes: 11 additions & 15 deletions lib/galaxy/visualization/plugins/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,26 +225,22 @@ def get_plugin(self, key):
raise ObjectNotFound(f"Unknown or invalid visualization: {key}")
return self.plugins[key]

def get_plugins(self, embeddable=None):
result = []
for plugin in self.plugins.values():
if embeddable and not plugin.config.get("embeddable"):
continue
result.append(plugin.to_dict())
return sorted(result, key=lambda k: k.get("html"))

# -- building links to visualizations from objects --
def get_visualizations(self, trans, target_object):
def get_visualizations(self, trans, target_object=None, embeddable=None):
"""
Get the names of visualizations usable on the `target_object` and
the urls to call in order to render the visualizations.
"""
applicable_visualizations = []
for vis_name in self.plugins:
url_data = self.get_visualization(trans, vis_name, target_object)
if url_data:
applicable_visualizations.append(url_data)
return sorted(applicable_visualizations, key=lambda k: k.get("html"))
result = []
for vis_name, vis_plugin in self.plugins.items():
if not vis_plugin.config.get("visible"):
continue
if embeddable and not vis_plugin.config.get("embeddable"):
continue
if target_object is not None and self.get_visualization(trans, vis_name, target_object) is None:
continue
result.append(vis_plugin.to_dict())
return sorted(result, key=lambda k: k.get("html"))

def get_visualization(self, trans, visualization_name, target_object):
"""
Expand Down
9 changes: 4 additions & 5 deletions lib/galaxy/webapps/galaxy/api/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ def index(self, trans, **kwargs):
GET /api/plugins:
"""
registry = self._get_registry()
embeddable = asbool(kwargs.get("embeddable"))
target_object = None
if (dataset_id := kwargs.get("dataset_id")) is not None:
hda = self.hda_manager.get_accessible(self.decode_id(dataset_id), trans.user)
return registry.get_visualizations(trans, hda)
else:
embeddable = asbool(kwargs.get("embeddable"))
return registry.get_plugins(embeddable=embeddable)
target_object = self.hda_manager.get_accessible(self.decode_id(dataset_id), trans.user)
return registry.get_visualizations(trans, target_object=target_object, embeddable=embeddable)

@expose_api
def show(self, trans, id, **kwargs):
Expand Down
Loading