-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from LCOGT/feature/tif-downloads
Feature/tif downloads
- Loading branch information
Showing
2 changed files
with
67 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/components/Project/ImageAnalysis/ImageDownloadMenu.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup> | ||
import { useAlertsStore } from '@/stores/alerts' | ||
const props = defineProps(['image', 'tifUrl']) | ||
defineEmits(['analysisAction']) | ||
const alertStore = useAlertsStore() | ||
function downloadLink(link, filename, fileType='file'){ | ||
if(!link){ | ||
alertStore.setAlert('error', `No ${fileType} available for download`) | ||
return | ||
} | ||
const a = document.createElement('a') | ||
a.href = link | ||
a.download = filename | ||
document.body.appendChild(a) | ||
a.click() | ||
document.body.removeChild(a) | ||
} | ||
</script> | ||
<template> | ||
<v-speed-dial | ||
location="left center" | ||
transition="fade-transition" | ||
> | ||
<template #activator="{ props: activatorProps }"> | ||
<v-btn | ||
v-bind="activatorProps" | ||
icon="mdi-download" | ||
/> | ||
</template> | ||
<v-btn | ||
key="1" | ||
text=".FITS" | ||
@click="downloadLink(props.image.url, props.image.basename, 'FITs')" | ||
/> | ||
<v-btn | ||
key="2" | ||
text=".TIF" | ||
@click="$emit('analysisAction', 'get-tif', {'basename': props.image.basename}, downloadLink)" | ||
/> | ||
<v-btn | ||
key="3" | ||
text=".JPG" | ||
@click="downloadLink(props.image.largeCachedUrl, props.image.basename, 'JPG')" | ||
/> | ||
</v-speed-dial> | ||
</template> | ||
<style scoped> | ||
.v-btn{ | ||
background-color: var(--metal); | ||
} | ||
</style> |