From 48c323c1a1619e17b05dc482aca050ac14701e50 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Fri, 17 Jul 2020 12:15:40 +0200 Subject: [PATCH 1/4] Fix Wi-Fi Form bug with additional Wi-Fi modules --- src/common/WiFiSettings/WiFiForm.js | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/common/WiFiSettings/WiFiForm.js b/src/common/WiFiSettings/WiFiForm.js index 34aa2f7..ac04184 100644 --- a/src/common/WiFiSettings/WiFiForm.js +++ b/src/common/WiFiSettings/WiFiForm.js @@ -31,18 +31,19 @@ WiFiForm.propTypes = { WiFiForm.defaultProps = { formData: { devices: [] }, - setFormValue: () => {}, + setFormValue: () => { }, hasGuestNetwork: true, }; export default function WiFiForm({ formData, formErrors, setFormValue, hasGuestNetwork, disabled, }) { - return formData.devices.map((device) => ( + return formData.devices.map((device, idx) => ( ({ devices: { [deviceID]: { enabled: { $set: value } } } }), + (value) => ({ devices: { [deviceNumber]: { enabled: { $set: value } } } }), )} {...props} @@ -98,7 +100,13 @@ function DeviceForm({ error={formErrors.SSID || null} required onChange={setFormValue( - (value) => ({ devices: { [deviceID]: { SSID: { $set: value } } } }), + (value) => ({ + devices: { + [deviceNumber]: { + SSID: { $set: value }, + }, + }, + }), )} {...props} @@ -121,7 +129,7 @@ function DeviceForm({ onChange={setFormValue( (value) => ( - { devices: { [deviceID]: { password: { $set: value } } } } + { devices: { [deviceNumber]: { password: { $set: value } } } } ), )} @@ -135,7 +143,7 @@ function DeviceForm({ onChange={setFormValue( (value) => ( - { devices: { [deviceID]: { hidden: { $set: value } } } } + { devices: { [deviceNumber]: { hidden: { $set: value } } } } ), )} @@ -152,7 +160,7 @@ function DeviceForm({ onChange={setFormValue( (value) => ({ devices: { - [deviceID]: { + [deviceNumber]: { hwmode: { $set: value }, channel: { $set: "0" }, }, @@ -171,7 +179,7 @@ function DeviceForm({ onChange={setFormValue( (value) => ( - { devices: { [deviceID]: { htmode: { $set: value } } } } + { devices: { [deviceNumber]: { htmode: { $set: value } } } } ), )} @@ -185,7 +193,7 @@ function DeviceForm({ onChange={setFormValue( (value) => ( - { devices: { [deviceID]: { channel: { $set: value } } } } + { devices: { [deviceNumber]: { channel: { $set: value } } } } ), )} @@ -194,7 +202,7 @@ function DeviceForm({ {hasGuestNetwork && ( Date: Fri, 17 Jul 2020 13:38:30 +0200 Subject: [PATCH 2/4] Add 802.11ac 160 MHz wide channel to constants --- src/common/WiFiSettings/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/WiFiSettings/constants.js b/src/common/WiFiSettings/constants.js index eb4c971..3cc086e 100644 --- a/src/common/WiFiSettings/constants.js +++ b/src/common/WiFiSettings/constants.js @@ -12,6 +12,7 @@ export const HTMODES = { VHT20: _("802.11ac - 20 MHz wide channel"), VHT40: _("802.11ac - 40 MHz wide channel"), VHT80: _("802.11ac - 80 MHz wide channel"), + VHT160: _("802.11ac - 160 MHz wide channel"), }; export const HWMODES = { "11g": "2.4", From 597b6fcf4cc7eba22e20965982adfbfc2a41cdc2 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Fri, 17 Jul 2020 13:39:28 +0200 Subject: [PATCH 3/4] Add Natural sort order for list of options --- src/bootstrap/Select.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/Select.js b/src/bootstrap/Select.js index 002f7de..5dfd7d1 100644 --- a/src/bootstrap/Select.js +++ b/src/bootstrap/Select.js @@ -28,10 +28,11 @@ export function Select({ }) { const uid = useUID(); - const options = Object.keys(choices).map( + const options = Object.keys(choices).sort( + (a, b) => a - b || a.toString().localeCompare(b.toString()), + ).map( (key) => , ); - return (
From 16a7a6c52d790de9bc9b29c32a78e1c5c3c438a5 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Fri, 17 Jul 2020 14:08:57 +0200 Subject: [PATCH 4/4] Update Snapshots --- .../__tests__/__snapshots__/WiFiSettings.test.js.snap | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/WiFiSettings/__tests__/__snapshots__/WiFiSettings.test.js.snap b/src/common/WiFiSettings/__tests__/__snapshots__/WiFiSettings.test.js.snap index b75bb05..f7e2aaa 100644 --- a/src/common/WiFiSettings/__tests__/__snapshots__/WiFiSettings.test.js.snap +++ b/src/common/WiFiSettings/__tests__/__snapshots__/WiFiSettings.test.js.snap @@ -617,11 +617,6 @@ exports[` Snapshot one module enabled. 1`] = ` + id=\\"8\\" + > + -+ + ++