From c49b58d97e4d1d2c801d451f0b3405011dd98f54 Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 5 Sep 2024 15:23:47 +0300 Subject: [PATCH 1/3] Rename groups section in visualization xml to tracks while allowing backward compatibility --- client/src/mvc/visualization/chart/views/editor.js | 2 +- client/src/mvc/visualization/chart/views/groups.js | 4 ++-- lib/galaxy/visualization/plugins/config_parser.py | 6 +++--- lib/galaxy/visualization/plugins/plugin.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client/src/mvc/visualization/chart/views/editor.js b/client/src/mvc/visualization/chart/views/editor.js index 3c9c21bb3f32..3b0a3f026285 100644 --- a/client/src/mvc/visualization/chart/views/editor.js +++ b/client/src/mvc/visualization/chart/views/editor.js @@ -36,7 +36,7 @@ export default Backbone.View.extend({ ) .append(new Settings(this.app).$el), }); - if (this.chart.plugin.groups) { + if (this.chart.plugin.tracks) { this.tabs.add({ id: "groups", icon: "fa-database", diff --git a/client/src/mvc/visualization/chart/views/groups.js b/client/src/mvc/visualization/chart/views/groups.js index fa3f68f4f8be..b262c9968fbe 100644 --- a/client/src/mvc/visualization/chart/views/groups.js +++ b/client/src/mvc/visualization/chart/views/groups.js @@ -25,7 +25,7 @@ var GroupView = Backbone.View.extend({ }, render: function () { var self = this; - var inputs = Utils.clone(this.chart.plugin.groups) || []; + var inputs = Utils.clone(this.chart.plugin.tracks) || []; var dataset_id = this.chart.get("dataset_id"); if (dataset_id) { this.chart.state("wait", "Loading metadata..."); @@ -127,7 +127,7 @@ export default Backbone.View.extend({ }); }, render: function () { - if (_.size(this.chart.plugin.groups) > 0) { + if (_.size(this.chart.plugin.tracks) > 0) { this.repeat.$el.show(); } else { this.repeat.$el.hide(); diff --git a/lib/galaxy/visualization/plugins/config_parser.py b/lib/galaxy/visualization/plugins/config_parser.py index 160f52acef2c..2e784abda7bc 100644 --- a/lib/galaxy/visualization/plugins/config_parser.py +++ b/lib/galaxy/visualization/plugins/config_parser.py @@ -151,9 +151,9 @@ def parse_visualization(self, xml_tree): if (specs_section := xml_tree.find("specs")) is not None: returned["specs"] = DictParser(specs_section) - # load group specifiers - if (groups_section := xml_tree.find("groups")) is not None: - returned["groups"] = ListParser(groups_section) + # load tracks specifiers (allow 'groups' section for backward compatibility) + if (tracks_section := xml_tree.find("tracks") or xml_tree.find("groups")) is not None: + returned["tracks"] = ListParser(tracks_section) # load settings specifiers if (settings_section := xml_tree.find("settings")) is not None: diff --git a/lib/galaxy/visualization/plugins/plugin.py b/lib/galaxy/visualization/plugins/plugin.py index c53f7977834a..e3bdf0e03d3c 100644 --- a/lib/galaxy/visualization/plugins/plugin.py +++ b/lib/galaxy/visualization/plugins/plugin.py @@ -125,8 +125,8 @@ def to_dict(self): "embeddable": self.config.get("embeddable"), "entry_point": self.config.get("entry_point"), "settings": self.config.get("settings"), - "groups": self.config.get("groups"), "specs": self.config.get("specs"), + "tracks": self.config.get("tracks"), "href": self._get_url(), } From 74b0732b579f237a5d3920cb6925571bc43527d0 Mon Sep 17 00:00:00 2001 From: guerler Date: Thu, 5 Sep 2024 15:29:21 +0300 Subject: [PATCH 2/3] Allow tracks and groups section name for legacy charts wrapper --- client/src/components/Markdown/MarkdownVisualization.vue | 6 +++--- client/src/mvc/visualization/chart/components/model.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/components/Markdown/MarkdownVisualization.vue b/client/src/components/Markdown/MarkdownVisualization.vue index 614cb1725fab..02fd69bb6439 100644 --- a/client/src/components/Markdown/MarkdownVisualization.vue +++ b/client/src/components/Markdown/MarkdownVisualization.vue @@ -73,14 +73,14 @@ export default { if (this.argumentPayload.settings && this.argumentPayload.settings.length > 0) { settings = this.argumentPayload.settings.slice(); } - if (this.argumentPayload.groups && this.argumentPayload.groups.length > 0) { + if (this.argumentPayload.tracks && this.argumentPayload.tracks.length > 0) { settings = settings || []; settings.push({ type: "repeat", title: "Columns", - name: "groups", + name: "tracks", min: 1, - inputs: this.argumentPayload.groups.map((x) => { + inputs: this.argumentPayload.tracks.map((x) => { if (x.type == "data_column") { x.is_workflow = true; } diff --git a/client/src/mvc/visualization/chart/components/model.js b/client/src/mvc/visualization/chart/components/model.js index 458663122b1f..814bbafe6386 100644 --- a/client/src/mvc/visualization/chart/components/model.js +++ b/client/src/mvc/visualization/chart/components/model.js @@ -2,7 +2,7 @@ import Backbone from "backbone"; import { Visualization } from "mvc/visualization/visualization-model"; import Utils from "utils/utils"; -const MATCH_GROUP = /^groups_([0-9]+)\|([\w]+)/; +const MATCH_GROUP = /^(groups|tracks)_([0-9]+)\|([\w]+)/; export default Backbone.Model.extend({ defaults: { From 37dc284eeb0cb4f8c025b13209716b485966cd07 Mon Sep 17 00:00:00 2001 From: guerler Date: Tue, 10 Sep 2024 13:27:42 +0300 Subject: [PATCH 3/3] Adjust jest test --- client/src/components/Markdown/MarkdownVisualization.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Markdown/MarkdownVisualization.test.js b/client/src/components/Markdown/MarkdownVisualization.test.js index 55ab54943181..da48cf495b37 100644 --- a/client/src/components/Markdown/MarkdownVisualization.test.js +++ b/client/src/components/Markdown/MarkdownVisualization.test.js @@ -9,7 +9,7 @@ describe("Markdown/MarkdownVisualization", () => { argumentName: "name", argumentPayload: { settings: [{}, {}], - groups: [{}], + tracks: [{}], }, history: "history_id", labels: [],