Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import DatasetDownload from "./DatasetDownload.vue";
const localVue = getLocalVue();

const items = [
{ id: "item_id", extension: "ext", meta_files: [{ file_type: "a" }, { file_type: "b" }] },
{ id: "item_id", extension: "ext", meta_files: [] },
{ id: "item_id", extension: "ext", file_size: 1024, meta_files: [{ file_type: "a" }, { file_type: "b" }] },
{ id: "item_id", extension: "ext", file_size: 0, meta_files: [] },
];

describe("DatasetDownload", () => {
Expand Down
12 changes: 10 additions & 2 deletions client/src/components/History/Content/Dataset/DatasetDownload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { computed } from "vue";

import type { HDADetailed } from "@/api";
import { prependPath } from "@/utils/redirect";
import { bytesToString } from "@/utils/utils";

interface Props {
item: HDADetailed;
Expand All @@ -27,6 +28,13 @@ const metaDownloadUrl = computed(() => {
const downloadUrl = computed(() => {
return prependPath(`api/datasets/${props.item.id}/display?to_ext=${props.item.extension}`);
});
const downloadTitle = computed(() => {
const size = props.item.file_size;
if (size) {
return `Download (${bytesToString(size)})`;
}
return "Download";
});

function onDownload(resource: string, extension = "") {
emit("on-download", `${resource}${extension}`);
Expand All @@ -43,7 +51,7 @@ function onDownload(resource: string, extension = "") {
size="sm"
variant="link"
toggle-class="text-decoration-none"
title="Download"
:title="downloadTitle"
class="download-btn"
data-description="dataset download">
<template v-slot:button-content>
Expand All @@ -68,7 +76,7 @@ function onDownload(resource: string, extension = "") {
v-else
v-g-tooltip.hover
class="download-btn px-1"
title="Download"
:title="downloadTitle"
size="sm"
variant="link"
:href="downloadUrl"
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/datatypes/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def set_index_file(self, dataset: HasFileName, index_file) -> bool:
def set_peek(self, dataset: DatasetProtocol, **kwd) -> None:
if not dataset.dataset.purged:
dataset.peek = "CRAM binary alignment file"
dataset.blurb = "binary data"
dataset.blurb = nice_size(dataset.get_size())
else:
dataset.peek = "file does not exist"
dataset.blurb = "file purged from disk"
Expand Down
Loading