Skip to content

Commit f28a13b

Browse files
committed
Add content chunked to header
1 parent eaa6c6c commit f28a13b

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

client/src/components/Dataset/DatasetDisplay.vue

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import axios from "axios";
32
import { BAlert } from "bootstrap-vue";
43
import { storeToRefs } from "pinia";
54
import { computed, ref, watch } from "vue";
@@ -24,8 +23,8 @@ const { getDataset, isLoadingDataset } = useDatasetStore();
2423
2524
const props = defineProps<Props>();
2625
27-
const content = ref();
2826
const contentTruncated = ref();
27+
const contentChunked = ref();
2928
const errorMessage = ref();
3029
const sanitizedJobImported = ref();
3130
const sanitizedToolId = ref();
@@ -52,11 +51,11 @@ watch(
5251
() => props.datasetId,
5352
async () => {
5453
try {
55-
const { data, headers } = await axios.get(previewUrl.value);
56-
content.value = data;
57-
contentTruncated.value = headers["x-content-truncated"];
58-
sanitizedJobImported.value = headers["x-sanitized-job-imported"];
59-
sanitizedToolId.value = headers["x-sanitized-tool-id"];
54+
const { headers } = await fetch(previewUrl.value, { method: "HEAD" });
55+
contentChunked.value = headers.get("x-content-chunked");
56+
contentTruncated.value = headers.get("x-content-truncated");
57+
sanitizedJobImported.value = headers.get("x-sanitized-job-imported");
58+
sanitizedToolId.value = headers.get("x-sanitized-tool-id");
6059
errorMessage.value = "";
6160
} catch (e) {
6261
errorMessage.value = errorMessageAsString(e);
@@ -84,8 +83,8 @@ watch(
8483
<div v-if="dataset.deleted" id="deleted-data-message" class="errormessagelarge">
8584
You are viewing a deleted dataset.
8685
</div>
87-
<TabularChunkedView v-if="content && content.ck_data" :options="{ ...dataset, first_data_chunk: content }" />
88-
<div v-else-if="content" class="h-100">
86+
<TabularChunkedView v-if="contentChunked" :options="dataset" />
87+
<div v-else class="h-100">
8988
<div v-if="isBinary">
9089
This is a binary (or unknown to Galaxy) dataset of size {{ bytesToString(dataset.file_size) }}. Preview
9190
is not implemented for this filetype. Displaying as ASCII text.

client/src/components/Dataset/Tabular/TabularChunkedView.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ interface TabularChunkedViewProps {
1616
options: {
1717
id: string;
1818
file_ext: string;
19-
first_data_chunk: TabularChunk;
2019
metadata_columns: number;
2120
metadata_column_types: string[];
2221
metadata_column_names: string[];
@@ -159,14 +158,6 @@ function nextChunk() {
159158
loading.value = false;
160159
});
161160
}
162-
163-
onMounted(() => {
164-
// Render first chunk if available.
165-
if (props.options.first_data_chunk) {
166-
processChunk(props.options.first_data_chunk);
167-
loading.value = false;
168-
}
169-
});
170161
</script>
171162

172163
<template>

lib/galaxy/datatypes/binary.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,7 @@ def display_data(
819819
elif to_ext or not preview:
820820
return super().display_data(trans, dataset, preview, filename, to_ext, **kwd)
821821
else:
822+
headers["x-content-chunked"] = "true"
822823
return self.get_chunk(trans, dataset, 0), headers
823824

824825
def validate(self, dataset: DatasetProtocol, **kwd) -> DatatypeValidation:

lib/galaxy/datatypes/tabular.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def display_data(
200200
with compression_utils.get_fileobj(dataset.get_file_name(), "rb") as fh:
201201
return util.unicodify(fh.read(max_peek_size)), headers
202202
else:
203+
headers["x-content-chunked"] = "true"
203204
return self.get_chunk(trans, dataset, 0), headers
204205

205206
def display_as_markdown(self, dataset_instance: DatasetProtocol) -> str:

0 commit comments

Comments
 (0)