Skip to content

Commit b17d4a6

Browse files
committed
Restore iframe, inject content
1 parent 34ed1ab commit b17d4a6

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

client/src/components/Dataset/DatasetDisplay.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import { bytesToString } from "@/utils/utils";
1212
1313
import Alert from "@/components/Alert.vue";
1414
import LoadingSpan from "@/components/LoadingSpan.vue";
15-
import TabularChunkedView from "./Tabular/TabularChunkedView.vue";
15+
import CenterFrame from "@/entry/analysis/modules/CenterFrame.vue";
16+
import TabularChunkedView from "components/Dataset/Tabular/TabularChunkedView.vue";
1617
1718
interface Props {
1819
datasetId: string;
@@ -73,7 +74,7 @@ watch(
7374
{{ errorMessage }}
7475
</BAlert>
7576
<LoadingSpan v-else-if="isLoading || !dataset" message="Loading dataset content" />
76-
<div v-else>
77+
<div v-else class="h-100">
7778
<Alert v-if="sanitizedMessage" :dismissible="true" variant="warning" data-description="sanitization warning">
7879
{{ sanitizedMessage }}
7980
<span v-if="isAdmin && sanitizedToolId">
@@ -86,7 +87,7 @@ watch(
8687
You are viewing a deleted dataset.
8788
</div>
8889
<TabularChunkedView v-if="content && content.ck_data" :options="{ ...dataset, first_data_chunk: content }" />
89-
<div v-else-if="content">
90+
<div v-else-if="content" class="h-100">
9091
<div v-if="isBinary">
9192
This is a binary (or unknown to Galaxy) dataset of size {{ bytesToString(dataset.file_size) }}. Preview
9293
is not implemented for this filetype. Displaying as ASCII text.
@@ -97,7 +98,7 @@ watch(
9798
</div>
9899
<a :href="downloadUrl">Download</a>
99100
</div>
100-
<pre v-if="contentType === 'text/html'" v-html="content" />
101+
<CenterFrame v-if="contentType === 'text/html'" :html="content" />
101102
<pre v-else>{{ content }}</pre>
102103
</div>
103104
</div>

client/src/entry/analysis/modules/CenterFrame.vue

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, ref } from "vue";
2+
import { computed, onMounted, ref, watch } from "vue";
33
44
import { withPrefix } from "@/utils/redirect";
55
@@ -10,16 +10,25 @@ const props = withDefaults(
1010
defineProps<{
1111
id?: string;
1212
src?: string;
13+
html?: string;
1314
}>(),
1415
{
1516
id: "frame",
1617
src: "",
18+
html: "",
1719
},
1820
);
1921
22+
const iframeRef = ref<HTMLIFrameElement>();
2023
const srcWithRoot = computed(() => withPrefix(props.src));
2124
const isLoading = ref(true);
2225
26+
function injectHtml(val: string) {
27+
if (iframeRef.value && val) {
28+
iframeRef.value.srcdoc = val;
29+
}
30+
}
31+
2332
function onLoad(ev: Event) {
2433
isLoading.value = false;
2534
const iframe = ev.currentTarget as HTMLIFrameElement;
@@ -32,14 +41,19 @@ function onLoad(ev: Event) {
3241
console.warn("[CenterFrame] onLoad location access forbidden.", ev, location);
3342
}
3443
}
44+
45+
watch(() => props.html, injectHtml);
46+
onMounted(() => injectHtml(props.html));
3547
</script>
48+
3649
<template>
3750
<div class="h-100">
3851
<LoadingSpan v-if="isLoading">Loading ...</LoadingSpan>
3952
<iframe
4053
:id="id"
54+
ref="iframeRef"
4155
:name="id"
42-
:src="srcWithRoot"
56+
:src="props.html ? undefined : srcWithRoot"
4357
class="center-frame"
4458
frameborder="0"
4559
title="galaxy frame"

0 commit comments

Comments
 (0)