Skip to content

Commit 9608020

Browse files
Merge pull request #20684 from dannon/fix-scratchbook-display
[25.0] Fix scratchbook display
2 parents 8693934 + e634402 commit 9608020

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

client/src/components/Dataset/DatasetView.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ const { toggled: headerCollapsed, toggle: toggleHeaderCollapse } = usePersistent
2929
interface Props {
3030
datasetId: string;
3131
tab?: "details" | "edit" | "error" | "preview" | "raw" | "visualize";
32+
displayOnly?: boolean;
3233
}
3334
3435
const props = withDefaults(defineProps<Props>(), {
3536
tab: "preview",
37+
displayOnly: false,
3638
});
3739
3840
const iframeLoading = ref(true);
@@ -90,7 +92,7 @@ watch(
9092
<template>
9193
<LoadingSpan v-if="isLoading || !dataset" message="Loading dataset details" />
9294
<div v-else class="dataset-view d-flex flex-column h-100">
93-
<header :key="`dataset-header-${dataset.id}`" class="dataset-header flex-shrink-0">
95+
<header v-if="!displayOnly" :key="`dataset-header-${dataset.id}`" class="dataset-header flex-shrink-0">
9496
<div class="d-flex">
9597
<Heading
9698
h1
@@ -132,7 +134,7 @@ watch(
132134
</div>
133135
</transition>
134136
</header>
135-
<BNav pills class="my-2 p-2 bg-light border-bottom">
137+
<BNav v-if="!displayOnly" pills class="my-2 p-2 bg-light border-bottom">
136138
<BNavItem
137139
title="View a preview of the dataset contents"
138140
:active="tab === 'preview'"

client/src/components/History/Content/ContentItem.vue

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { BBadge, BButton, BCollapse } from "bootstrap-vue";
1313
import { computed, ref } from "vue";
1414
import { useRoute, useRouter } from "vue-router/composables";
1515
16+
import { getGalaxyInstance } from "@/app";
1617
import type { ItemUrls } from "@/components/History/Content/Dataset/index";
1718
import { updateContentFields } from "@/components/History/model/queries";
1819
import { useEntryPointStore } from "@/stores/entryPointStore";
@@ -21,6 +22,7 @@ import { clearDrag } from "@/utils/setDrag";
2122
2223
import { JobStateSummary } from "./Collection/JobStateSummary";
2324
import { getContentItemState, type StateMap, STATES } from "./model/states";
25+
import type { RouterPushOptions } from "./router-push-options";
2426
2527
import CollectionDescription from "./Collection/CollectionDescription.vue";
2628
import ContentOptions from "./ContentOptions.vue";
@@ -263,15 +265,33 @@ function onDisplay() {
263265
const url = entryPointsForHda[0]?.target;
264266
window.open(url, "_blank");
265267
} else {
268+
const Galaxy = getGalaxyInstance();
269+
const isWindowManagerActive = Galaxy.frame && Galaxy.frame.active;
270+
271+
// Build the display URL with displayOnly query param if needed
272+
let displayUrl = itemUrls.value.display;
273+
if (isWindowManagerActive && displayUrl) {
274+
displayUrl += displayUrl.includes("?") ? "&displayOnly=true" : "?displayOnly=true";
275+
}
276+
266277
// vue-router 4 supports a native force push with clean URLs,
267278
// but we're using a __vkey__ bit as a workaround
268279
// Only conditionally force to keep urls clean most of the time.
269280
if (route.path === itemUrls.value.display) {
281+
const options: RouterPushOptions = {
282+
force: true,
283+
preventWindowManager: !isWindowManagerActive,
284+
title: isWindowManagerActive ? `${props.item.hid}: ${props.name}` : undefined,
285+
};
270286
// @ts-ignore - monkeypatched router, drop with migration.
271-
router.push(itemUrls.value.display, { force: true, preventWindowManager: true });
272-
} else if (itemUrls.value.display) {
287+
router.push(displayUrl, options);
288+
} else if (displayUrl) {
289+
const options: RouterPushOptions = {
290+
preventWindowManager: !isWindowManagerActive,
291+
title: isWindowManagerActive ? `${props.item.hid}: ${props.name}` : undefined,
292+
};
273293
// @ts-ignore - monkeypatched router, drop with migration.
274-
router.push(itemUrls.value.display, { preventWindowManager: true });
294+
router.push(displayUrl, options);
275295
}
276296
}
277297
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Custom options for the monkeypatched router.push() method
3+
* Used to control window manager behavior and force navigation
4+
*/
5+
export interface RouterPushOptions {
6+
// Title for window manager frame
7+
title?: string;
8+
// Force reload (currently by adding timestamp to URL)
9+
force?: boolean;
10+
// Explicit WM bypass -- prevent opening in window manager even if active
11+
preventWindowManager?: boolean;
12+
}

client/src/entry/analysis/router.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ export function getRouter(Galaxy) {
266266
props: (route) => ({
267267
datasetId: route.params.datasetId,
268268
tab: route.params.tab,
269+
displayOnly: route.query.displayOnly === "true",
269270
}),
270271
},
271272
{

0 commit comments

Comments
 (0)