Display a spinner when the extinction is in progress
This commit is contained in:
parent
7db7489b4c
commit
0f9af99b94
@ -2,6 +2,7 @@
|
|||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
Icon,
|
Icon,
|
||||||
|
Spinner,
|
||||||
} from 'sveltestrap';
|
} from 'sveltestrap';
|
||||||
|
|
||||||
import CycleCounter from '$lib/components/CycleCounter.svelte';
|
import CycleCounter from '$lib/components/CycleCounter.svelte';
|
||||||
@ -20,6 +21,11 @@
|
|||||||
}
|
}
|
||||||
function reloadIsActiveAlarm() {
|
function reloadIsActiveAlarm() {
|
||||||
isActiveP = isAlarmActive();
|
isActiveP = isAlarmActive();
|
||||||
|
isActiveP.then((isActive) => {
|
||||||
|
if (!isActive) {
|
||||||
|
extinctionInProgress = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
return isActiveP;
|
return isActiveP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +34,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stopAlarm() {
|
function stopAlarm() {
|
||||||
|
extinctionInProgress = true;
|
||||||
alarmStop();
|
alarmStop();
|
||||||
reloadIsActiveAlarm().then((isActive) => {
|
reloadIsActiveAlarm().then((isActive) => {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
@ -35,6 +42,8 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let extinctionInProgress = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Container class="flex-fill d-flex flex-column justify-content-center text-center">
|
<Container class="flex-fill d-flex flex-column justify-content-center text-center">
|
||||||
@ -125,7 +134,11 @@
|
|||||||
class="btn btn-danger"
|
class="btn btn-danger"
|
||||||
on:click={stopAlarm}
|
on:click={stopAlarm}
|
||||||
>
|
>
|
||||||
<Icon name="stop-circle" />
|
{#if extinctionInProgress}
|
||||||
|
<Spinner size="sm" />
|
||||||
|
{:else}
|
||||||
|
<Icon name="stop-circle" />
|
||||||
|
{/if}
|
||||||
Éteindre le réveil
|
Éteindre le réveil
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-outline-info">
|
<button class="btn btn-outline-info">
|
||||||
|
Loading…
Reference in New Issue
Block a user