Prevent spamming button

This commit is contained in:
Adria Navarro 2023-07-10 16:00:16 +02:00
parent 8375ea4c5a
commit 4b32c51924
1 changed files with 25 additions and 2 deletions

View File

@ -1,17 +1,40 @@
<script>
import { Layout, Body, Button } from "@budibase/bbui"
import { downloadStream } from "@budibase/frontend-core"
import Spinner from "components/common/Spinner.svelte"
import { API } from "api"
let loading = false
async function download() {
downloadStream(await API.getServerLogs())
loading = true
try {
await downloadStream(await API.getServerLogs())
} finally {
loading = false
}
}
</script>
<Layout noPadding>
<Body>Download your latest logs to share with the Budibase team</Body>
<div class="download-button">
<Button cta on:click={download}>Download system logs</Button>
<Button cta on:click={download} disabled={loading}>
<div class="button-content">
{#if loading}
<div><Spinner size="10" /></div>
{/if}
Download system logs
</div>
</Button>
</div>
</Layout>
<style>
.button-content {
display: flex;
align-items: center;
gap: var(--spacing-m);
}
</style>