Fixed wifi signal quality display when there are multiple copies of the same ssid.

Also ensured that all dialogs set their InitialFocus correctly.
This commit is contained in:
David Carley
2022-08-31 05:57:47 +00:00
parent 3a68076022
commit 6a63bd7a12
9 changed files with 37 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import Button, { Label } from "@smui/button";
import TextField from "@smui/textfield";
import MessageDialog from "$dialogs/MessageDialog.svelte";
@@ -73,7 +73,10 @@
<Content id="change-hostname-dialog-content">
<TextField
bind:value={hostname}
use={[[virtualKeyboardChange, (newValue) => (hostname = newValue)]]}
use={[
InitialFocus,
[virtualKeyboardChange, (newValue) => (hostname = newValue)],
]}
label="New Hostname"
spellcheck="false"
variant="filled"

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import TextField from "@smui/textfield";
import Button, { Label } from "@smui/button";
import { ControllerMethods } from "$lib/RegisterControllerMethods";
@@ -31,7 +31,10 @@
label="Absolute"
type="number"
bind:value
use={[[virtualKeyboardChange, (newValue) => (value = newValue)]]}
use={[
InitialFocus,
[virtualKeyboardChange, (newValue) => (value = newValue)],
]}
variant="filled"
style="width: 100%;"
/>

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import Button, { Label } from "@smui/button";
export let open: boolean;
@@ -23,7 +23,7 @@
{#if !noaction}
<Actions>
<Button defaultAction>
<Button defaultAction use={[InitialFocus]}>
<Label>OK</Label>
</Button>
</Actions>

View File

@@ -1,5 +1,5 @@
<script type="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import Button, { Label } from "@smui/button";
import Radio from "@smui/radio";
import FormField from "@smui/form-field";
@@ -53,7 +53,7 @@
</Content>
<Actions>
<Button>
<Button use={[InitialFocus]}>
<Label>Cancel</Label>
</Button>
<Button

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import TextField from "@smui/textfield";
import Button, { Label } from "@smui/button";
import { ControllerMethods } from "$lib/RegisterControllerMethods";
@@ -43,7 +43,10 @@
label="Position"
type="number"
bind:value
use={[[virtualKeyboardChange, (newValue) => (value = newValue)]]}
use={[
InitialFocus,
[virtualKeyboardChange, (newValue) => (value = newValue)],
]}
spellcheck="false"
variant="filled"
style="width: 100%;"

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import Button, { Label } from "@smui/button";
import TextField from "@smui/textfield";
import CircularProgress from "@smui/circular-progress";
@@ -154,7 +154,10 @@
<Label>Date & Time</Label>
<TextField
bind:value
use={[[virtualKeyboardChange, (newValue) => (value = newValue)]]}
use={[
InitialFocus,
[virtualKeyboardChange, (newValue) => (value = newValue)],
]}
label="Time"
type="datetime-local"
variant="filled"

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import Dialog, { Title, Content, Actions } from "@smui/dialog";
import Dialog, { Title, Content, Actions, InitialFocus } from "@smui/dialog";
import Button, { Label } from "@smui/button";
import LinearProgress from "@smui/linear-progress";
@@ -71,7 +71,7 @@
</Content>
<Actions>
<Button on:click={onCancel}>
<Button on:click={onCancel} use={[InitialFocus]}>
<Label>Cancel</Label>
</Button>
</Actions>

View File

@@ -58,7 +58,10 @@
{#if needPassword}
<TextField
bind:value={password}
use={[[virtualKeyboardChange, (newValue) => (password = newValue)]]}
use={[
InitialFocus,
[virtualKeyboardChange, (newValue) => (password = newValue)],
]}
label="Password"
spellcheck="false"
variant="filled"
@@ -91,7 +94,6 @@
<Button
defaultAction
use={[InitialFocus]}
on:click={onConfirm}
disabled={needPassword && (password.length < 8 || password.length > 128)}
>

View File

@@ -43,7 +43,13 @@ export function processNetworkInfo(rawNetworkInfo: NetworkInfo) {
if (network.Name) {
network.lastSeen = now;
network.active = rawNetworkInfo.wifi.ssid === network.Name;
networksByName[network.Name] = network;
// There can be many entries for the same ssid, so
// we want to take the one with the highest quality
const currentNetwork = networksByName[network.Name] ?? { Quality: 0 };
if (network.Quality >= currentNetwork.Quality) {
networksByName[network.Name] = network;
}
}
}