@@ -24,10 +24,11 @@ const { getDataset, isLoadingDataset } = useDatasetStore();
2424const props = defineProps <Props >();
2525
2626const content = ref ();
27+ const contentTruncated = ref ();
28+ const contentType = ref ();
2729const errorMessage = ref ();
28- const sanitizedImport = ref (false );
30+ const sanitizedJobImported = ref ();
2931const sanitizedToolId = ref ();
30- const truncated = ref ();
3132
3233const { isAdmin } = storeToRefs (useUserStore ());
3334
@@ -38,7 +39,7 @@ const isLoading = computed(() => isLoadingDataset(props.datasetId));
3839
3940const sanitizedMessage = computed (() => {
4041 const plainText = " Contents are shown as plain text." ;
41- if (sanitizedImport .value ) {
42+ if (sanitizedJobImported .value ) {
4243 return ` Dataset has been imported. ${plainText } ` ;
4344 } else if (sanitizedToolId .value ) {
4445 return ` Dataset created by a tool that is not known to create safe HTML. ${plainText } ` ;
5354 try {
5455 const { data, headers } = await axios .get (url );
5556 content .value = data ;
56- truncated .value = headers [" x-content-truncated" ];
57- sanitizedImport .value = !! headers [" x-sanitized-job-imported" ];
57+ contentTruncated .value = headers [" x-content-truncated" ];
58+ contentType .value = headers [" content-type" ];
59+ sanitizedJobImported .value = headers [" x-sanitized-job-imported" ];
5860 sanitizedToolId .value = headers [" x-sanitized-tool-id" ];
5961 errorMessage .value = " " ;
6062 } catch (e ) {
@@ -89,12 +91,14 @@ watch(
8991 This is a binary (or unknown to Galaxy) dataset of size {{ bytesToString(dataset.file_size) }}. Preview
9092 is not implemented for this filetype. Displaying as ASCII text.
9193 </div >
92- <div v-if =" truncated" class =" warningmessagelarge" >
93- <div >This dataset is large and only the first {{ bytesToString(truncated) }} is shown below.</div >
94+ <div v-if =" contentTruncated" class =" warningmessagelarge" >
95+ <div >
96+ This dataset is large and only the first {{ bytesToString(contentTruncated) }} is shown below.
97+ </div >
9498 <a :href =" downloadUrl" >Download</a >
9599 </div >
96- <pre v-if =" sanitizedMessage || sanitizedToolId " >{{ content }}</ pre >
97- <pre v-else v-html = " content" / >
100+ <pre v-if =" contentType === 'text/html' " v-html = " content" / >
101+ <pre v-else >{{ content }}</ pre >
98102 </div >
99103 </div >
100104</template >
0 commit comments