diff --git a/config/plugins/visualizations/jqplot/jqplot_bar/config/jqplot_bar.xml b/config/plugins/visualizations/jqplot/jqplot_bar/config/jqplot_bar.xml index af6ec9da2cf0..4dc9dfc63ef7 100644 --- a/config/plugins/visualizations/jqplot/jqplot_bar/config/jqplot_bar.xml +++ b/config/plugins/visualizations/jqplot/jqplot_bar/config/jqplot_bar.xml @@ -1,6 +1,6 @@ - + jqplot_shared.xml diff --git a/config/plugins/visualizations/jqplot/jqplot_box/config/jqplot_box.xml b/config/plugins/visualizations/jqplot/jqplot_box/config/jqplot_box.xml index 93d559089053..0e440be10e82 100644 --- a/config/plugins/visualizations/jqplot/jqplot_box/config/jqplot_box.xml +++ b/config/plugins/visualizations/jqplot/jqplot_box/config/jqplot_box.xml @@ -1,6 +1,6 @@ - + ../../jqplot_bar/config/jqplot_shared.xml diff --git a/config/plugins/visualizations/jqplot/jqplot_histogram/config/jqplot_histogram.xml b/config/plugins/visualizations/jqplot/jqplot_histogram/config/jqplot_histogram.xml index e38ec98c0af5..7537a379893f 100644 --- a/config/plugins/visualizations/jqplot/jqplot_histogram/config/jqplot_histogram.xml +++ b/config/plugins/visualizations/jqplot/jqplot_histogram/config/jqplot_histogram.xml @@ -1,6 +1,6 @@ - + ../../jqplot_bar/config/jqplot_shared.xml diff --git a/config/plugins/visualizations/jqplot/jqplot_line/config/jqplot_line.xml b/config/plugins/visualizations/jqplot/jqplot_line/config/jqplot_line.xml index b2255cdf3e06..2791123bb260 100644 --- a/config/plugins/visualizations/jqplot/jqplot_line/config/jqplot_line.xml +++ b/config/plugins/visualizations/jqplot/jqplot_line/config/jqplot_line.xml @@ -1,6 +1,6 @@ - + ../../jqplot_bar/config/jqplot_shared.xml diff --git a/config/plugins/visualizations/jqplot/jqplot_scatter/config/jqplot_scatter.xml b/config/plugins/visualizations/jqplot/jqplot_scatter/config/jqplot_scatter.xml index e88a693311e6..7347b2717d34 100644 --- a/config/plugins/visualizations/jqplot/jqplot_scatter/config/jqplot_scatter.xml +++ b/config/plugins/visualizations/jqplot/jqplot_scatter/config/jqplot_scatter.xml @@ -1,6 +1,6 @@ - + ../../jqplot_bar/config/jqplot_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_bar/config/nvd3_bar.xml b/config/plugins/visualizations/nvd3/nvd3_bar/config/nvd3_bar.xml index ebc6e765d08a..94e55dd22e6d 100644 --- a/config/plugins/visualizations/nvd3/nvd3_bar/config/nvd3_bar.xml +++ b/config/plugins/visualizations/nvd3/nvd3_bar/config/nvd3_bar.xml @@ -1,6 +1,6 @@ - + nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_bar_stacked/config/nvd3_bar_stacked.xml b/config/plugins/visualizations/nvd3/nvd3_bar_stacked/config/nvd3_bar_stacked.xml index 6fb0a3f2b401..81e6c652f2d2 100644 --- a/config/plugins/visualizations/nvd3/nvd3_bar_stacked/config/nvd3_bar_stacked.xml +++ b/config/plugins/visualizations/nvd3/nvd3_bar_stacked/config/nvd3_bar_stacked.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_histogram/config/nvd3_histogram.xml b/config/plugins/visualizations/nvd3/nvd3_histogram/config/nvd3_histogram.xml index 159bd6bd90bb..7db9332b905e 100644 --- a/config/plugins/visualizations/nvd3/nvd3_histogram/config/nvd3_histogram.xml +++ b/config/plugins/visualizations/nvd3/nvd3_histogram/config/nvd3_histogram.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_histogram_discrete/config/nvd3_histogram_discrete.xml b/config/plugins/visualizations/nvd3/nvd3_histogram_discrete/config/nvd3_histogram_discrete.xml index a32f52001ee8..3dcfc0a03575 100644 --- a/config/plugins/visualizations/nvd3/nvd3_histogram_discrete/config/nvd3_histogram_discrete.xml +++ b/config/plugins/visualizations/nvd3/nvd3_histogram_discrete/config/nvd3_histogram_discrete.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_horizontal/config/nvd3_horizontal.xml b/config/plugins/visualizations/nvd3/nvd3_horizontal/config/nvd3_horizontal.xml index 15e2050f2183..39b66e5f7024 100644 --- a/config/plugins/visualizations/nvd3/nvd3_horizontal/config/nvd3_horizontal.xml +++ b/config/plugins/visualizations/nvd3/nvd3_horizontal/config/nvd3_horizontal.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_horizontal_stacked/config/nvd3_horizontal_stacked.xml b/config/plugins/visualizations/nvd3/nvd3_horizontal_stacked/config/nvd3_horizontal_stacked.xml index f5710f72dd89..4875c8dcb913 100644 --- a/config/plugins/visualizations/nvd3/nvd3_horizontal_stacked/config/nvd3_horizontal_stacked.xml +++ b/config/plugins/visualizations/nvd3/nvd3_horizontal_stacked/config/nvd3_horizontal_stacked.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_line/config/nvd3_line.xml b/config/plugins/visualizations/nvd3/nvd3_line/config/nvd3_line.xml index bcdd01e1f817..0a0145a2e74b 100644 --- a/config/plugins/visualizations/nvd3/nvd3_line/config/nvd3_line.xml +++ b/config/plugins/visualizations/nvd3/nvd3_line/config/nvd3_line.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_line_focus/config/nvd3_line_focus.xml b/config/plugins/visualizations/nvd3/nvd3_line_focus/config/nvd3_line_focus.xml index f6dac98cbf82..8998dc8aeeaa 100644 --- a/config/plugins/visualizations/nvd3/nvd3_line_focus/config/nvd3_line_focus.xml +++ b/config/plugins/visualizations/nvd3/nvd3_line_focus/config/nvd3_line_focus.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_pie/config/nvd3_pie.xml b/config/plugins/visualizations/nvd3/nvd3_pie/config/nvd3_pie.xml index 093543e25593..3e28b302506c 100644 --- a/config/plugins/visualizations/nvd3/nvd3_pie/config/nvd3_pie.xml +++ b/config/plugins/visualizations/nvd3/nvd3_pie/config/nvd3_pie.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_scatter/config/nvd3_scatter.xml b/config/plugins/visualizations/nvd3/nvd3_scatter/config/nvd3_scatter.xml index 05399c0c81d5..148e07569778 100644 --- a/config/plugins/visualizations/nvd3/nvd3_scatter/config/nvd3_scatter.xml +++ b/config/plugins/visualizations/nvd3/nvd3_scatter/config/nvd3_scatter.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_stackedarea/config/nvd3_stackedarea.xml b/config/plugins/visualizations/nvd3/nvd3_stackedarea/config/nvd3_stackedarea.xml index ef2e4ae1b19d..ab21737e50c4 100644 --- a/config/plugins/visualizations/nvd3/nvd3_stackedarea/config/nvd3_stackedarea.xml +++ b/config/plugins/visualizations/nvd3/nvd3_stackedarea/config/nvd3_stackedarea.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_stackedarea_full/config/nvd3_stackedarea_full.xml b/config/plugins/visualizations/nvd3/nvd3_stackedarea_full/config/nvd3_stackedarea_full.xml index bfc4dc2e63f4..c25cf714e43f 100644 --- a/config/plugins/visualizations/nvd3/nvd3_stackedarea_full/config/nvd3_stackedarea_full.xml +++ b/config/plugins/visualizations/nvd3/nvd3_stackedarea_full/config/nvd3_stackedarea_full.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/nvd3/nvd3_stackedarea_stream/config/nvd3_stackedarea_stream.xml b/config/plugins/visualizations/nvd3/nvd3_stackedarea_stream/config/nvd3_stackedarea_stream.xml index f11aa05aa36f..a34df97a071a 100644 --- a/config/plugins/visualizations/nvd3/nvd3_stackedarea_stream/config/nvd3_stackedarea_stream.xml +++ b/config/plugins/visualizations/nvd3/nvd3_stackedarea_stream/config/nvd3_stackedarea_stream.xml @@ -1,6 +1,6 @@ - + ../../nvd3_bar/config/nvd3_shared.xml diff --git a/config/plugins/visualizations/scatterplot/config/scatterplot.xml b/config/plugins/visualizations/scatterplot/config/scatterplot.xml index 9f3121e2bebd..606aa04864e8 100644 --- a/config/plugins/visualizations/scatterplot/config/scatterplot.xml +++ b/config/plugins/visualizations/scatterplot/config/scatterplot.xml @@ -1,6 +1,6 @@ - + Creates a 2D-scatterplot from tabular datapoints diff --git a/lib/galaxy/visualization/plugins/config_parser.py b/lib/galaxy/visualization/plugins/config_parser.py index ffefbe2dfb8a..a26c6fd20845 100644 --- a/lib/galaxy/visualization/plugins/config_parser.py +++ b/lib/galaxy/visualization/plugins/config_parser.py @@ -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 diff --git a/lib/galaxy/visualization/plugins/registry.py b/lib/galaxy/visualization/plugins/registry.py index bd293dca85b0..8d7141b3067b 100644 --- a/lib/galaxy/visualization/plugins/registry.py +++ b/lib/galaxy/visualization/plugins/registry.py @@ -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): """ diff --git a/lib/galaxy/webapps/galaxy/api/plugins.py b/lib/galaxy/webapps/galaxy/api/plugins.py index d8af00154ea1..d1f861b57cf2 100644 --- a/lib/galaxy/webapps/galaxy/api/plugins.py +++ b/lib/galaxy/webapps/galaxy/api/plugins.py @@ -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):