Skip to content

Commit

Permalink
Add download file button to report displa
Browse files Browse the repository at this point in the history
  • Loading branch information
hvangeffen authored and wkramer committed Sep 30, 2024
1 parent d99696b commit 902cf2c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/views/ReportsDisplayView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
variant="solo-filled"
density="compact"
/>
<v-btn @click="downloadFile" icon="mdi-download" />
</v-toolbar>
<iframe :key="url" :src="url" class="html-content" />
</div>
Expand All @@ -49,6 +50,7 @@ import {
import { computed, ref, watch } from 'vue'
import { configManager } from '@/services/application-config'
import { filterToParams } from '@deltares/fews-wms-requests'
import { downloadFileWithXhr } from '@/lib/download'
interface Props {
topologyNode?: TopologyNode
Expand Down Expand Up @@ -110,6 +112,14 @@ function reportItemToTitle(item: ReportItem) {
function reportToTitle(item: Report) {
return item.moduleInstanceName ?? item.moduleInstanceId
}
async function downloadFile() {
const report = selectedReportItem.value
if (!report || !url.value) return
const fileName = `${report.timeZero}-${report.moduleInstanceId}`
downloadFileWithXhr(url.value, fileName)
}
</script>
<style scoped>
Expand Down

0 comments on commit 902cf2c

Please sign in to comment.