Skip to content

Commit

Permalink
Merge pull request galaxyproject#17182 from mvdbeek/add_rerun_and_inf…
Browse files Browse the repository at this point in the history
…o_button_collection_operations

[23.2] Add rerun and show details buttons in expanded collection
  • Loading branch information
mvdbeek authored Dec 13, 2023
2 parents 3e0b093 + 386759b commit 2daff04
Showing 1 changed file with 46 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<script setup lang="ts">
import { computed } from "vue";
import { useRouter } from "vue-router/composables";
import { HDCADetailed } from "@/api";
import { getAppRoot } from "@/onload/loadConfig";
const router = useRouter();
const props = defineProps<{
dsc: HDCADetailed;
}>();
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
);
function onDownload() {
window.location.href = downloadUrl.value;
}
</script>
<template>
<section>
<nav class="content-operations d-flex justify-content-between bg-secondary">
Expand All @@ -12,26 +36,29 @@
<Icon class="mr-1" icon="download" />
<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)">
<icon icon="info-circle" />
<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)">
<Icon class="mr-1" icon="redo" />
<span>Run Job Again</span>
</b-button>
</b-button-group>
</nav>
</section>
</template>

<script>
export default {
props: {
dsc: { type: Object, required: true },
},
computed: {
/** @return {String} */
downloadUrl() {
return `${this.dsc.url}/download`;
},
},
methods: {
onDownload() {
window.location.href = this.downloadUrl;
},
},
};
</script>

0 comments on commit 2daff04

Please sign in to comment.