v4 board impl
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Controller } from "./main";
|
||||
import {NetworkConfig, SSIDList} from "./api";
|
||||
|
||||
export class NetworkConfigView {
|
||||
setScanResult(ssidList: SSIDList) {
|
||||
@@ -14,6 +15,7 @@ export class NetworkConfigView {
|
||||
private readonly password: HTMLInputElement;
|
||||
private readonly mqtt_url: HTMLInputElement;
|
||||
private readonly base_topic: HTMLInputElement;
|
||||
private readonly max_wait: HTMLInputElement;
|
||||
private readonly ssidlist: HTMLElement;
|
||||
|
||||
constructor(controller: Controller, publicIp: string) {
|
||||
@@ -28,6 +30,9 @@ export class NetworkConfigView {
|
||||
this.ssid.onchange = controller.configChanged
|
||||
this.password = (document.getElementById("password") as HTMLInputElement);
|
||||
this.password.onchange = controller.configChanged
|
||||
this.max_wait = (document.getElementById("max_wait") as HTMLInputElement);
|
||||
this.max_wait.onchange = controller.configChanged
|
||||
|
||||
this.mqtt_url = document.getElementById("mqtt_url") as HTMLInputElement;
|
||||
this.mqtt_url.onchange = controller.configChanged
|
||||
this.base_topic = document.getElementById("base_topic") as HTMLInputElement;
|
||||
@@ -47,10 +52,12 @@ export class NetworkConfigView {
|
||||
this.password.value = network.password;
|
||||
this.mqtt_url.value = network.mqtt_url;
|
||||
this.base_topic.value = network.base_topic;
|
||||
this.max_wait.value = network.max_wait.toString();
|
||||
}
|
||||
|
||||
getConfig(): NetworkConfig {
|
||||
return {
|
||||
max_wait: +this.max_wait.value,
|
||||
ap_ssid: this.ap_ssid.value,
|
||||
ssid: this.ssid.value ?? null,
|
||||
password: this.password.value ?? null,
|
||||
|
||||
Reference in New Issue
Block a user