forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCollectionOperations.vue
More file actions
87 lines (80 loc) · 3.3 KB
/
CollectionOperations.vue
File metadata and controls
87 lines (80 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<script setup lang="ts">
import { faDownload, faInfoCircle, faRedo, faTable } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { computed } from "vue";
import { useRouter } from "vue-router/composables";
import type { HDCASummary } from "@/api";
import { getAppRoot } from "@/onload/loadConfig";
const router = useRouter();
const props = defineProps<{
dsc: HDCASummary; // typescript recognizes HDCADetailed IS_A HDCASummary
}>();
const downloadUrl = computed(() => `${getAppRoot()}api/dataset_collections/${props.dsc.id}/download`);
const rerunUrl = computed(() =>
props.dsc.job_source_type == "Job" ? `/root?job_id=${props.dsc.job_source_id}` : null,
);
const showCollectionDetailsUrl = computed(() =>
props.dsc.job_source_type == "Job" ? `/jobs/${props.dsc.job_source_id}/view` : null,
);
const disableDownload = props.dsc.populated_state !== "ok";
const hasSampleSheet = computed(() => {
return props.dsc.collection_type && props.dsc.collection_type.startsWith("sample_sheet");
});
const sheetUrl = computed(() => {
return `${getAppRoot()}collection/${props.dsc.id}/sheet`;
});
function onDownload() {
window.location.href = downloadUrl.value;
}
</script>
<template>
<section>
<nav class="content-operations d-flex justify-content-between bg-secondary">
<b-button-group>
<b-button
title="Download Collection"
:disabled="disableDownload"
class="rounded-0 text-decoration-none"
size="sm"
variant="link"
:href="downloadUrl"
@click="onDownload">
<FontAwesomeIcon class="mr-1" :icon="faDownload" />
<span>Download</span>
</b-button>
<b-button
v-if="showCollectionDetailsUrl"
class="collection-job-details-btn px-1"
title="Show Details"
size="sm"
variant="link"
:href="showCollectionDetailsUrl"
@click.prevent.stop="router.push(showCollectionDetailsUrl)">
<FontAwesomeIcon class="mr-1" :icon="faInfoCircle" />
<span>Show Details</span>
</b-button>
<b-button
v-if="rerunUrl"
title="Rerun job"
class="rounded-0 text-decoration-none"
size="sm"
variant="link"
:href="rerunUrl"
@click.prevent.stop="router.push(rerunUrl)">
<FontAwesomeIcon class="mr-1" :icon="faRedo" />
<span>Run Job Again</span>
</b-button>
<b-button
v-if="hasSampleSheet && sheetUrl"
class="rounded-0 text-decoration-none"
size="sm"
variant="link"
:href="sheetUrl"
@click.prevent.stop="router.push(sheetUrl)">
<FontAwesomeIcon class="mr-1" :icon="faTable" />
<span>View Sheet</span>
</b-button>
</b-button-group>
</nav>
</section>
</template>