Debian Codegraph @

frontend/src/reports/query/QueryLinks.svelte

raw
1 <!--
2 @component
3 Renders the links to download the query result in CSV and possibly
4 other formats.
5 -->
6 <script lang="ts">
7 import { urlFor } from "../../helpers";
8 import { _ } from "../../i18n";
9 import { HAVE_EXCEL } from "../../stores";
10
11 interface Props {
12 /** The query string. */
13 query: string;
14 }
15
16 let { query }: Props = $props();
17 let params = $derived({ query_string: query });
18 </script>
19
20 <span>
21 ({_("Download as")}
22 <a href={$urlFor("download-query/query_result.csv", params)} data-remote>
23 CSV
24 </a>
25 {#if $HAVE_EXCEL}
26 ,
27 <a href={$urlFor("download-query/query_result.xlsx", params)} data-remote>
28 XLSX
29 </a>
30 , or
31 <a href={$urlFor("download-query/query_result.ods", params)} data-remote>
32 ODS
33 </a>
34 {/if}
35 )
36 </span>
37
38 <style>
39 span {
40 color: var(--text-color-lighter);
41 }
42 </style>