11<script setup lang="ts">
2- import { faDownload , faInfoCircle , faRedo , faTable } from " @fortawesome/free-solid-svg-icons" ;
2+ import { faDownload , faInfoCircle , faTable } from " @fortawesome/free-solid-svg-icons" ;
33import { FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
44import { computed } from " vue" ;
5- import { useRouter } from " vue-router/composables" ;
5+ import { useRoute } from " vue-router/composables" ;
66
77import type { HDCASummary } from " @/api" ;
88import { getAppRoot } from " @/onload/loadConfig" ;
99
10- const router = useRouter ();
10+ import GButton from " @/components/BaseComponents/GButton.vue" ;
11+ import GButtonGroup from " @/components/BaseComponents/GButtonGroup.vue" ;
12+ import RerunJobButton from " @/components/JobInformation/RerunJobButton.vue" ;
13+
14+ const route = useRoute ();
1115
1216const props = defineProps <{
1317 dsc: HDCASummary ; // typescript recognizes HDCADetailed IS_A HDCASummary
1418}>();
1519
1620const downloadUrl = computed (() => ` ${getAppRoot ()}api/dataset_collections/${props .dsc .id }/download ` );
17- const rerunUrl = computed (() =>
18- props .dsc .job_source_type == " Job" ? ` /root?job_id=${props .dsc .job_source_id } ` : null ,
19- );
2021const showCollectionDetailsUrl = computed (() =>
2122 props .dsc .job_source_type == " Job" ? ` /jobs/${props .dsc .job_source_id }/view ` : null ,
2223);
@@ -26,62 +27,60 @@ const hasSampleSheet = computed(() => {
2627 return props .dsc .collection_type && props .dsc .collection_type .startsWith (" sample_sheet" );
2728});
2829
29- const sheetUrl = computed (() => {
30- return ` ${getAppRoot ()}collection/${props .dsc .id }/sheet ` ;
31- });
32-
33- function onDownload() {
34- window .location .href = downloadUrl .value ;
35- }
30+ const sheetUrl = computed (() => ` /collection/${props .dsc .id }/sheet ` );
3631 </script >
3732<template >
3833 <section >
3934 <nav class =" content-operations d-flex justify-content-between bg-secondary" >
40- <b-button- group >
41- <b-button
35+ <GButtonGroup class = " collection-operations-btn- group" >
36+ <GButton
4237 title =" Download Collection"
4338 :disabled =" disableDownload"
44- class =" rounded-0 text-decoration-none"
45- size =" sm"
46- variant =" link"
47- :href =" downloadUrl"
48- @click =" onDownload" >
49- <FontAwesomeIcon class =" mr-1" :icon =" faDownload" />
39+ size =" small"
40+ color =" blue"
41+ transparent
42+ :href =" downloadUrl" >
43+ <FontAwesomeIcon fixed-width :icon =" faDownload" />
5044 <span >Download</span >
51- </b-button >
52- <b-button
45+ </GButton >
46+ <GButton
5347 v-if =" showCollectionDetailsUrl"
54- class =" collection-job-details-btn px-1 "
48+ class =" collection-job-details-btn"
5549 title =" Show Details"
56- size =" sm"
57- variant =" link"
58- :href =" showCollectionDetailsUrl"
59- @click.prevent.stop =" router.push(showCollectionDetailsUrl)" >
60- <FontAwesomeIcon class =" mr-1" :icon =" faInfoCircle" />
50+ size =" small"
51+ color =" blue"
52+ transparent
53+ :pressed =" route.fullPath === showCollectionDetailsUrl"
54+ :to =" showCollectionDetailsUrl" >
55+ <FontAwesomeIcon fixed-width :icon =" faInfoCircle" />
6156 <span >Show Details</span >
62- </b-button >
63- <b-button
64- v-if =" rerunUrl"
65- title =" Rerun job"
66- class =" rounded-0 text-decoration-none"
67- size =" sm"
68- variant =" link"
69- :href =" rerunUrl"
70- @click.prevent.stop =" router.push(rerunUrl)" >
71- <FontAwesomeIcon class =" mr-1" :icon =" faRedo" />
72- <span >Run Job Again</span >
73- </b-button >
74- <b-button
57+ </GButton >
58+ <RerunJobButton
59+ v-if =" props.dsc.job_source_type === 'Job' && props.dsc.job_source_id"
60+ :job-id =" props.dsc.job_source_id" />
61+ <GButton
7562 v-if =" hasSampleSheet && sheetUrl"
76- class =" rounded-0 text-decoration-none"
77- size =" sm"
78- variant =" link"
79- :href =" sheetUrl"
80- @click.prevent.stop =" router.push(sheetUrl)" >
81- <FontAwesomeIcon class =" mr-1" :icon =" faTable" />
63+ title =" View Sample Sheet"
64+ size =" small"
65+ color =" blue"
66+ transparent
67+ :pressed =" route.fullPath === sheetUrl"
68+ :to =" sheetUrl" >
69+ <FontAwesomeIcon fixed-width :icon =" faTable" />
8270 <span >View Sheet</span >
83- </b-button >
84- </b-button-group >
71+ </GButton >
72+ </GButtonGroup >
8573 </nav >
8674 </section >
8775</template >
76+
77+ <style scoped lang="scss">
78+ .collection-operations-btn-group {
79+ display : flex ;
80+ flex-wrap : wrap ;
81+ :deep (.g-button ) {
82+ border-radius : 0 ;
83+ white-space : nowrap ;
84+ }
85+ }
86+ </style >
0 commit comments