File tree Expand file tree Collapse file tree 2 files changed +6
-20
lines changed
Expand file tree Collapse file tree 2 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ const sanitizedToolId = ref();
3434const { isAdmin } = storeToRefs (useUserStore ());
3535
3636const dataset = computed (() => getDataset (props .datasetId ));
37- const datasetUrl = computed (() => withPrefix ( ` /dataset/display?dataset_id= ${props .datasetId }` ) );
38- const downloadUrl = computed (() => withPrefix (` ${datasetUrl .value }& to_ext=${dataset .value ?.file_ext } ` ));
37+ const datasetUrl = computed (() => ` /datasets/ ${props .datasetId }/display ` );
38+ const downloadUrl = computed (() => withPrefix (` ${datasetUrl .value }? to_ext=${dataset .value ?.file_ext } ` ));
3939const isLoading = computed (() => isLoadingDataset (props .datasetId ));
4040
4141const sanitizedMessage = computed (() => {
@@ -51,7 +51,7 @@ const sanitizedMessage = computed(() => {
5151watch (
5252 () => props .datasetId ,
5353 async () => {
54- const url = withPrefix (` /datasets/${ props . datasetId }/display/ ?preview=True` );
54+ const url = withPrefix (` ${ datasetUrl . value } ?preview=True` );
5555 try {
5656 const { data, headers } = await axios .get (url );
5757 content .value = data ;
9898 </div >
9999 <a :href =" downloadUrl" >Download</a >
100100 </div >
101- <CenterFrame v-if =" contentType === 'text/html'" :html = " content " />
101+ <CenterFrame v-if =" contentType === 'text/html'" :src = " datasetUrl " />
102102 <pre v-else >{{ content }}</pre >
103103 </div >
104104 </div >
Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { computed , onMounted , ref , watch } from " vue" ;
2+ import { computed , ref } from " vue" ;
33
44import { withPrefix } from " @/utils/redirect" ;
55
@@ -10,25 +10,16 @@ const props = withDefaults(
1010 defineProps <{
1111 id? : string ;
1212 src? : string ;
13- html? : string ;
1413 }>(),
1514 {
1615 id: " frame" ,
1716 src: " " ,
18- html: " " ,
1917 },
2018);
2119
22- const iframeRef = ref <HTMLIFrameElement >();
2320const srcWithRoot = computed (() => withPrefix (props .src ));
2421const isLoading = ref (true );
2522
26- function injectHtml(val : string ) {
27- if (iframeRef .value && val ) {
28- iframeRef .value .srcdoc = val ;
29- }
30- }
31-
3223function onLoad(ev : Event ) {
3324 isLoading .value = false ;
3425 const iframe = ev .currentTarget as HTMLIFrameElement ;
@@ -41,19 +32,14 @@ function onLoad(ev: Event) {
4132 console .warn (" [CenterFrame] onLoad location access forbidden." , ev , location );
4233 }
4334}
44-
45- watch (() => props .html , injectHtml );
46- onMounted (() => injectHtml (props .html ));
4735 </script >
48-
4936<template >
5037 <div class =" h-100" >
5138 <LoadingSpan v-if =" isLoading" >Loading ...</LoadingSpan >
5239 <iframe
5340 :id =" id"
54- ref =" iframeRef"
5541 :name =" id"
56- :src =" props.html ? undefined : srcWithRoot"
42+ :src =" srcWithRoot"
5743 class =" center-frame"
5844 frameborder =" 0"
5945 title =" galaxy frame"
You can’t perform that action at this time.
0 commit comments