Fix settings saving
This commit is contained in:
parent
912f3265ae
commit
4e0450faca
@ -1,4 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { tick } from 'svelte';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
Form,
|
Form,
|
||||||
@ -19,13 +21,18 @@
|
|||||||
$: settingsP.then((s) => settings = s);
|
$: settingsP.then((s) => settings = s);
|
||||||
|
|
||||||
let settings;
|
let settings;
|
||||||
|
|
||||||
|
async function submitSettings() {
|
||||||
|
await tick();
|
||||||
|
settings.save();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Container class="flex-fill d-flex flex-column py-2">
|
<Container class="flex-fill d-flex flex-column py-2">
|
||||||
<h2>
|
<h2>
|
||||||
Paramètres
|
Paramètres
|
||||||
</h2>
|
</h2>
|
||||||
<Form>
|
<Form on:submit={submitSettings}>
|
||||||
{#await settingsP}
|
{#await settingsP}
|
||||||
<div class="d-flex justify-content-center align-items-center gap-2">
|
<div class="d-flex justify-content-center align-items-center gap-2">
|
||||||
<Spinner color="primary" /> Chargement en cours…
|
<Spinner color="primary" /> Chargement en cours…
|
||||||
@ -39,7 +46,7 @@
|
|||||||
id="gongIntervals"
|
id="gongIntervals"
|
||||||
placeholder="20"
|
placeholder="20"
|
||||||
bind:value={settings.gong_interval}
|
bind:value={settings.gong_interval}
|
||||||
on:change={() => settings.save()}
|
on:input={submitSettings}
|
||||||
/>
|
/>
|
||||||
<InputGroupText>min</InputGroupText>
|
<InputGroupText>min</InputGroupText>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
@ -53,7 +60,7 @@
|
|||||||
id="weatherDelay"
|
id="weatherDelay"
|
||||||
placeholder="5"
|
placeholder="5"
|
||||||
bind:value={settings.weather_delay}
|
bind:value={settings.weather_delay}
|
||||||
on:change={() => settings.save()}
|
on:input={submitSettings}
|
||||||
/>
|
/>
|
||||||
<InputGroupText>min</InputGroupText>
|
<InputGroupText>min</InputGroupText>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
@ -66,7 +73,7 @@
|
|||||||
type="select"
|
type="select"
|
||||||
id="weatherRituel"
|
id="weatherRituel"
|
||||||
bind:value={settings.weather_action}
|
bind:value={settings.weather_action}
|
||||||
on:change={() => settings.save()}
|
on:input={submitSettings}
|
||||||
>
|
>
|
||||||
{#each $actions.list as action (action.id)}
|
{#each $actions.list as action (action.id)}
|
||||||
<option value="{action.path}">{action.name}</option>
|
<option value="{action.path}">{action.name}</option>
|
||||||
@ -86,8 +93,8 @@
|
|||||||
<Input
|
<Input
|
||||||
type="select"
|
type="select"
|
||||||
id="greetingLanguage"
|
id="greetingLanguage"
|
||||||
bind:value={settings.lang}
|
bind:value={settings.language}
|
||||||
on:change={() => settings.save()}
|
on:input={submitSettings}
|
||||||
>
|
>
|
||||||
<option value="fr_FR">Français</option>
|
<option value="fr_FR">Français</option>
|
||||||
<option value="en_US">Anglais</option>
|
<option value="en_US">Anglais</option>
|
||||||
@ -104,7 +111,7 @@
|
|||||||
id="maxRunTime"
|
id="maxRunTime"
|
||||||
placeholder="60"
|
placeholder="60"
|
||||||
bind:value={settings.max_run_time}
|
bind:value={settings.max_run_time}
|
||||||
on:change={() => settings.save()}
|
on:input={submitSettings}
|
||||||
/>
|
/>
|
||||||
<InputGroupText>min</InputGroupText>
|
<InputGroupText>min</InputGroupText>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user