From 851c28229cd9cd5b2cce5e80cf6d2fa0578962a0 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 16 May 2022 16:21:33 +0200 Subject: [PATCH 01/18] Add winbox plugin --- client/package.json | 1 + client/yarn.lock | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/client/package.json b/client/package.json index 206ba9df25b..42e72995779 100644 --- a/client/package.json +++ b/client/package.json @@ -92,6 +92,7 @@ "vuex": "^3.6.2", "vuex-cache": "^3.4.0", "vuex-persist": "2.3", + "winbox": "^0.2.1", "xml-beautifier": "^0.5.0" }, "scripts": { diff --git a/client/yarn.lock b/client/yarn.lock index f0343e6865a..76556f42d4f 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -10163,6 +10163,11 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== +winbox@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/winbox/-/winbox-0.2.1.tgz#6ca7cd047fa52d9f3324884698ce8a9c9ba9bf27" + integrity sha512-K3PY+y+aWpkCpECGF2TqSi4w+OT+cuJHWbOKBjVerpexmdC6Is5m4y0gZ9rbxU2K+GszE1nH+d2okMAQTG05hg== + word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" From 4f2494a239c159fdd2cdfdd848f30171433def48 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 16 May 2022 16:41:28 +0200 Subject: [PATCH 02/18] Add initial migration --- client/src/layout/scratchbook.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/layout/scratchbook.js b/client/src/layout/scratchbook.js index bdbc9534b6b..b0bb64428a2 100644 --- a/client/src/layout/scratchbook.js +++ b/client/src/layout/scratchbook.js @@ -9,6 +9,8 @@ import { Dataset, createTabularDatasetChunkedView, TabularDataset } from "mvc/da import visualization from "viz/visualization"; import { TracksterUI } from "viz/trackster"; import _l from "utils/localization"; +import WinBox from "winbox/src/js/winbox.js"; +import "winbox/dist/css/winbox.min.css"; export default Backbone.View.extend({ initialize: function (options) { @@ -51,7 +53,7 @@ export default Backbone.View.extend({ getFrames() { // needed for Vue.js integration - return this.frames; + return this; }, beforeUnload() { @@ -232,7 +234,7 @@ export default Backbone.View.extend({ } } else { options.url = this._build_url(options.url, { hide_panels: true, hide_masthead: true }); - this.frames.add(options); + WinBox.new(options); } }, From 9123087e02bb39ad91ef58104da019ab20c43791 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 16 May 2022 17:05:26 +0200 Subject: [PATCH 03/18] Remove ui-frames custom window manager --- client/src/components/Masthead/Masthead.vue | 8 +- client/src/layout/scratchbook.js | 24 +- client/src/mvc/ui/ui-frames.js | 648 -------------------- 3 files changed, 16 insertions(+), 664 deletions(-) delete mode 100644 client/src/mvc/ui/ui-frames.js diff --git a/client/src/components/Masthead/Masthead.vue b/client/src/components/Masthead/Masthead.vue index 1854278e483..348e8942641 100644 --- a/client/src/components/Masthead/Masthead.vue +++ b/client/src/components/Masthead/Masthead.vue @@ -99,9 +99,9 @@ export default { frames .on("add remove", () => { const tab = this.mastheadState.frame.buttonLoad; - tab.note = String(frames.length()); - tab.visible = frames.length() > 0; - tab.show_note = frames.length() > 0; + tab.note = String(frames.counter); + tab.visible = frames.counter > 0; + tab.show_note = frames.counter > 0; }) .on("show hide", () => { this._reflectScratchbookFrames(); @@ -128,7 +128,7 @@ export default { return Object.assign({}, defaults, asJson); }, _reflectScratchbookFrames() { - const frames = this.mastheadState.frame.getFrames(); + const frames = this.mastheadState.frame; const tab = this.mastheadState.frame.buttonLoad; tab.toggle = frames.visible; tab.icon = (frames.visible && "fa-eye") || "fa-eye-slash"; diff --git a/client/src/layout/scratchbook.js b/client/src/layout/scratchbook.js index b0bb64428a2..4cf22388f8a 100644 --- a/client/src/layout/scratchbook.js +++ b/client/src/layout/scratchbook.js @@ -1,10 +1,9 @@ -/** Frame manager uses the ui-frames to create the scratch book masthead icon and functionality **/ +/** Frame manager uses the window manager to create the scratch book masthead icon and functionality **/ import _ from "underscore"; import $ from "jquery"; import Backbone from "backbone"; import { getAppRoot } from "onload/loadConfig"; import { getGalaxyInstance } from "app"; -import Frames from "mvc/ui/ui-frames"; import { Dataset, createTabularDatasetChunkedView, TabularDataset } from "mvc/dataset/data"; import visualization from "viz/visualization"; import { TracksterUI } from "viz/trackster"; @@ -15,8 +14,8 @@ import "winbox/dist/css/winbox.min.css"; export default Backbone.View.extend({ initialize: function (options) { options = options || {}; - this.frames = new Frames.View({ visible: false }); - this.setElement(this.frames.$el); + this.setElement("
"); + this.counter = 0; this.active = false; this.buttonActive = { id: "enable-scratchbook", @@ -29,7 +28,7 @@ export default Backbone.View.extend({ this.buttonActive.show_note = this.active; this.buttonActive.note_cls = this.active && "fa fa-check"; if (!this.active) { - this.frames.hide(); + this.$el.hide(); } }, }; @@ -41,10 +40,10 @@ export default Backbone.View.extend({ visible: false, note: "", onclick: (e) => { - if (this.frames.visible) { - this.frames.hide(); + if (this.visible) { + this.$el.hide(); } else { - this.frames.show(); + this.$el.show(); } }, }; @@ -58,13 +57,13 @@ export default Backbone.View.extend({ beforeUnload() { let confirmText = ""; - if (this.frames.length() > 0) { - confirmText = `You opened ${this.frames.length()} frame(s) which will be lost.`; + if (this.counter > 0) { + confirmText = `You opened ${this.counter} frame(s) which will be lost.`; } return confirmText; }, - /** Add a dataset to the frames */ + /** Add a dataset */ addDataset: function (dataset_id) { const self = this; let current_dataset = null; @@ -170,7 +169,7 @@ export default Backbone.View.extend({ }); }, - /** Add a trackster visualization to the frames. */ + /** Add a trackster visualization. */ addTrackster: function (viz_id) { const self = this; const viz = new visualization.Visualization({ id: viz_id }); @@ -234,6 +233,7 @@ export default Backbone.View.extend({ } } else { options.url = this._build_url(options.url, { hide_panels: true, hide_masthead: true }); + options.class = "modern"; WinBox.new(options); } }, diff --git a/client/src/mvc/ui/ui-frames.js b/client/src/mvc/ui/ui-frames.js deleted file mode 100644 index 79ee255792c..00000000000 --- a/client/src/mvc/ui/ui-frames.js +++ /dev/null @@ -1,648 +0,0 @@ -/** Frame view */ -import _ from "underscore"; -import $ from "jquery"; -import Backbone from "backbone"; -import _l from "utils/localization"; -import { getGalaxyInstance } from "app"; - -var FrameView = Backbone.View.extend({ - initialize: function (options) { - this.model = (options && options.model) || new Backbone.Model(options); - this.setElement($("
").addClass("corner frame")); - this.$el - .append( - $("
") - .addClass("f-header corner") - .append($("
").addClass("f-title")) - .append( - $("
") - .addClass("f-icon f-close fa fa-close") - .tooltip({ - title: _l("Close"), - placement: "bottom", - }) - ) - ) - .append($("
").addClass("f-content")) - .append($("
").addClass("f-resize f-icon corner fa fa-expand").tooltip({ title: "Resize" })) - .append($("
").addClass("f-cover")); - this.$header = this.$(".f-header"); - this.$title = this.$(".f-title"); - this.$content = this.$(".f-content"); - this.render(); - this.listenTo(this.model, "change", this.render, this); - }, - - render: function () { - var self = this; - var options = this.model.attributes; - this.$title.html(_.escape(options.title) || ""); - this.$header.find(".f-icon-left").remove(); - _.each(options.menu, (option) => { - var $option = $("
").addClass("f-icon-left").addClass(option.icon); - if (_.isFunction(option.disabled) && option.disabled()) { - $option.attr("disabled", true); - } else { - $option - .on("click", () => { - option.onclick(self); - }) - .tooltip({ - title: option.tooltip || "", - placement: "bottom", - }); - } - self.$header.append($option); - }); - if (options.url) { - this.$content.html( - $("