mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Use path helper within window manager
Routes already patched by underlying mako
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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--;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user