diff --git a/client/src/components/Masthead/initMasthead.js b/client/src/components/Masthead/initMasthead.js index f4303bf5b7c..6b96f5d82cf 100644 --- a/client/src/components/Masthead/initMasthead.js +++ b/client/src/components/Masthead/initMasthead.js @@ -2,7 +2,7 @@ * Temporary function used to mount the masthead inside the current application. * This function is exposed with the rest of the page-globals in bundledEntries. */ -import { mountMasthead } from "../../layout/masthead"; +import { mountMasthead } from "layout/masthead"; import $ from "jquery"; export function initMasthead(config, container) { diff --git a/client/src/components/plugins/legacyNavigation.js b/client/src/components/plugins/legacyNavigation.js index 3b31a75514f..ec514d74494 100644 --- a/client/src/components/plugins/legacyNavigation.js +++ b/client/src/components/plugins/legacyNavigation.js @@ -13,7 +13,7 @@ export function iframeAdd({ path, title = "Galaxy", $router = null }) { if (Galaxy.frame && Galaxy.frame.active) { Galaxy.frame.add({ title: _l(title), - url: prependPath(path), + url: path, }); return true; } else if ($router) { diff --git a/client/src/layout/masthead.js b/client/src/layout/masthead.js index 584de733725..45f0de3c29b 100644 --- a/client/src/layout/masthead.js +++ b/client/src/layout/masthead.js @@ -1,18 +1,23 @@ import Masthead from "../components/Masthead/Masthead"; import { mountVueComponent } from "../utils/mountVueComponent"; import { fetchMenu } from "entry/analysis/menu"; -import { safePath } from "utils/redirect"; +import { WindowManager } from "layout/window-manager"; +import { getGalaxyInstance } from "app"; export function mountMasthead(el, options) { + const windowManager = new WindowManager(options); + const Galaxy = getGalaxyInstance(); + Galaxy.frame = windowManager; return mountVueComponent(Masthead)( { el: el, displayGalaxyBrand: options.display_galaxy_brand, baseTabs: fetchMenu(options), brand: options.brand, - brandLink: safePath(options.logo_url), - brandImage: safePath(options.logo_src), - brandImageSecondary: safePath(options.logo_src_secondary), + brandLink: options.logo_url, + brandImage: options.logo_src, + brandImageSecondary: options.logo_src_secondary, + windowTab: windowManager.getTab(), }, el ); diff --git a/client/src/layout/window-manager.js b/client/src/layout/window-manager.js index 3f63950dcc6..0ee2e49b40c 100644 --- a/client/src/layout/window-manager.js +++ b/client/src/layout/window-manager.js @@ -2,6 +2,7 @@ import _l from "utils/localization"; import WinBox from "winbox/src/js/winbox.js"; import "winbox/dist/css/winbox.min.css"; +import { safePath } from "utils/redirect"; export class WindowManager { constructor(options) { @@ -25,27 +26,28 @@ export class WindowManager { /** Add and display a new window based on options. */ add(options) { + const url = safePath(options.url); if (options.target == "_blank") { - window.open(options.url); + window.open(url); } else if (options.target == "_top" || options.target == "_parent" || options.target == "_self") { - window.location = options.url; + window.location = url; } else if (!this.active) { const $galaxy_main = window.parent.document.getElementById("galaxy_main"); if (options.target == "galaxy_main" || options.target == "center") { if ($galaxy_main.length === 0) { - window.location = this._build_url(options.url, { use_panels: true }); + window.location = this._build_url(url, { use_panels: true }); } else { - $galaxy_main.attr("src", options.url); + $galaxy_main.attr("src", url); } } else { - window.location = options.url; + window.location = url; } } else { this.counter++; - const url = this._build_url(options.url, { hide_panels: true, hide_masthead: true }); + const boxUrl = this._build_url(url, { hide_panels: true, hide_masthead: true }); WinBox.new({ title: options.title || "Window", - url: url, + url: boxUrl, onclose: () => { this.counter--; },