mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-25 00:11:36 +01:00
Merge branch 'dev' into 'master'
Bump v5.1.15 See merge request turris/reforis/foris-js!171
This commit is contained in:
commit
c1e807bc74
63717
package-lock.json
generated
63717
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "5.1.14",
|
"version": "5.1.15",
|
||||||
"description": "Set of components and utils for Foris and its plugins.",
|
"description": "Set of components and utils for Foris and its plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -58,6 +58,9 @@
|
||||||
"style-loader": "^1.2.1",
|
"style-loader": "^1.2.1",
|
||||||
"webpack": "^5.15.0"
|
"webpack": "^5.15.0"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"immer": "9.0.6"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint src",
|
"lint": "eslint src",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
|
@ -65,6 +68,7 @@
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:coverage": "jest --coverage --colors",
|
"test:coverage": "jest --coverage --colors",
|
||||||
"docs": "npx styleguidist build ",
|
"docs": "npx styleguidist build ",
|
||||||
"docs:watch": "styleguidist server"
|
"docs:watch": "styleguidist server",
|
||||||
|
"preinstall": "npx npm-force-resolutions"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
|
@ -18,18 +18,23 @@ Select.propTypes = {
|
||||||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
|
||||||
/** Help text message. */
|
/** Help text message. */
|
||||||
helpText: PropTypes.string,
|
helpText: PropTypes.string,
|
||||||
|
/** Turns on/off alphabetical ordering of the Select options. */
|
||||||
|
customOrder: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Select({ label, choices, helpText, ...props }) {
|
export function Select({ label, choices, helpText, customOrder, ...props }) {
|
||||||
const uid = useUID();
|
const uid = useUID();
|
||||||
|
|
||||||
const options = Object.keys(choices)
|
const keys = Object.keys(choices);
|
||||||
.sort((a, b) => a - b || a.toString().localeCompare(b.toString()))
|
if (!customOrder) {
|
||||||
.map((key) => (
|
keys.sort((a, b) => a - b || a.toString().localeCompare(b.toString()));
|
||||||
<option key={key} value={key}>
|
}
|
||||||
{choices[key]}
|
const options = keys.map((key) => (
|
||||||
</option>
|
<option key={key} value={key}>
|
||||||
));
|
{choices[key]}
|
||||||
|
</option>
|
||||||
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label htmlFor={uid}>{label}</label>
|
<label htmlFor={uid}>{label}</label>
|
||||||
|
|
|
@ -15,7 +15,7 @@ import { Select } from "../../bootstrap/Select";
|
||||||
import { TextInput } from "../../bootstrap/TextInput";
|
import { TextInput } from "../../bootstrap/TextInput";
|
||||||
import WiFiQRCode from "./WiFiQRCode";
|
import WiFiQRCode from "./WiFiQRCode";
|
||||||
import WifiGuestForm from "./WiFiGuestForm";
|
import WifiGuestForm from "./WiFiGuestForm";
|
||||||
import { HELP_TEXTS, HTMODES, HWMODES } from "./constants";
|
import { HELP_TEXTS, HTMODES, HWMODES, ENCRYPTIONMODES } from "./constants";
|
||||||
|
|
||||||
WiFiForm.propTypes = {
|
WiFiForm.propTypes = {
|
||||||
formData: PropTypes.shape({ devices: PropTypes.arrayOf(PropTypes.object) })
|
formData: PropTypes.shape({ devices: PropTypes.arrayOf(PropTypes.object) })
|
||||||
|
@ -63,6 +63,7 @@ DeviceForm.propTypes = {
|
||||||
htmode: PropTypes.string.isRequired,
|
htmode: PropTypes.string.isRequired,
|
||||||
channel: PropTypes.string.isRequired,
|
channel: PropTypes.string.isRequired,
|
||||||
guest_wifi: PropTypes.object.isRequired,
|
guest_wifi: PropTypes.object.isRequired,
|
||||||
|
encryption: PropTypes.string.isRequired,
|
||||||
}),
|
}),
|
||||||
formErrors: PropTypes.object.isRequired,
|
formErrors: PropTypes.object.isRequired,
|
||||||
setFormValue: PropTypes.func.isRequired,
|
setFormValue: PropTypes.func.isRequired,
|
||||||
|
@ -198,6 +199,20 @@ function DeviceForm({
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
label={_("Encryption")}
|
||||||
|
choices={getEncryptionChoices(formData)}
|
||||||
|
helpText={HELP_TEXTS.wpa3}
|
||||||
|
value={formData.encryption}
|
||||||
|
onChange={setFormValue((value) => ({
|
||||||
|
devices: {
|
||||||
|
[deviceIndex]: { encryption: { $set: value } },
|
||||||
|
},
|
||||||
|
}))}
|
||||||
|
customOrder
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
|
||||||
{hasGuestNetwork && (
|
{hasGuestNetwork && (
|
||||||
<WifiGuestForm
|
<WifiGuestForm
|
||||||
formData={{
|
formData={{
|
||||||
|
@ -256,3 +271,10 @@ function getHwmodeChoices(device) {
|
||||||
value: availableBand.hwmode,
|
value: availableBand.hwmode,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getEncryptionChoices(device) {
|
||||||
|
if (device.encryption === "custom") {
|
||||||
|
ENCRYPTIONMODES.custom = _("Custom");
|
||||||
|
}
|
||||||
|
return ENCRYPTIONMODES;
|
||||||
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ describe("<WiFiSettings/>", () => {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{ enabled: false, id: 1 },
|
{ enabled: false, id: 1 },
|
||||||
],
|
],
|
||||||
|
@ -149,6 +150,7 @@ describe("<WiFiSettings/>", () => {
|
||||||
hwmode: "11g",
|
hwmode: "11g",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{ enabled: false, id: 1 },
|
{ enabled: false, id: 1 },
|
||||||
],
|
],
|
||||||
|
@ -185,6 +187,7 @@ describe("<WiFiSettings/>", () => {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{ enabled: false, id: 1 },
|
{ enabled: false, id: 1 },
|
||||||
],
|
],
|
||||||
|
|
|
@ -230,6 +230,7 @@ export function wifiSettingsFixture() {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SSID: "Turris",
|
SSID: "Turris",
|
||||||
|
@ -308,6 +309,7 @@ export function wifiSettingsFixture() {
|
||||||
hwmode: "11g",
|
hwmode: "11g",
|
||||||
id: 1,
|
id: 1,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -324,6 +326,7 @@ const oneDevice = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -340,6 +343,7 @@ const twoDevices = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SSID: "Turris2",
|
SSID: "Turris2",
|
||||||
|
@ -351,6 +355,7 @@ const twoDevices = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 1,
|
id: 1,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -367,6 +372,7 @@ const threeDevices = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 0,
|
id: 0,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SSID: "Turris2",
|
SSID: "Turris2",
|
||||||
|
@ -378,6 +384,7 @@ const threeDevices = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 1,
|
id: 1,
|
||||||
password: "TestPass",
|
password: "TestPass",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
SSID: "Turris3",
|
SSID: "Turris3",
|
||||||
|
@ -389,6 +396,7 @@ const threeDevices = {
|
||||||
hwmode: "11a",
|
hwmode: "11a",
|
||||||
id: 2,
|
id: 2,
|
||||||
password: "",
|
password: "",
|
||||||
|
encryption: "WPA3",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -337,7 +337,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
- First value
|
- First value
|
||||||
+ Second value
|
+ Second value
|
||||||
|
|
||||||
@@ -479,10 +479,94 @@
|
@@ -513,10 +513,94 @@
|
||||||
Parameters of the guest network can be set in the Guest network tab.
|
Parameters of the guest network can be set in the Guest network tab.
|
||||||
|
|
||||||
</small>
|
</small>
|
||||||
|
@ -347,7 +347,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ class=\\"form-group\\"
|
+ class=\\"form-group\\"
|
||||||
+ >
|
+ >
|
||||||
+ <label
|
+ <label
|
||||||
+ for=\\"20\\"
|
+ for=\\"22\\"
|
||||||
+ >
|
+ >
|
||||||
+ SSID
|
+ SSID
|
||||||
+ </label>
|
+ </label>
|
||||||
|
@ -356,7 +356,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ class=\\"form-control\\"
|
+ class=\\"form-control\\"
|
||||||
+ id=\\"20\\"
|
+ id=\\"22\\"
|
||||||
+ type=\\"text\\"
|
+ type=\\"text\\"
|
||||||
+ value=\\"TestGuestSSID\\"
|
+ value=\\"TestGuestSSID\\"
|
||||||
+ />
|
+ />
|
||||||
|
@ -386,7 +386,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ class=\\"form-group\\"
|
+ class=\\"form-group\\"
|
||||||
+ >
|
+ >
|
||||||
+ <label
|
+ <label
|
||||||
+ for=\\"21\\"
|
+ for=\\"23\\"
|
||||||
+ >
|
+ >
|
||||||
+ Password
|
+ Password
|
||||||
+ </label>
|
+ </label>
|
||||||
|
@ -396,7 +396,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
+ <input
|
+ <input
|
||||||
+ autocomplete=\\"new-password\\"
|
+ autocomplete=\\"new-password\\"
|
||||||
+ class=\\"form-control is-invalid\\"
|
+ class=\\"form-control is-invalid\\"
|
||||||
+ id=\\"21\\"
|
+ id=\\"23\\"
|
||||||
+ required=\\"\\"
|
+ required=\\"\\"
|
||||||
+ type=\\"password\\"
|
+ type=\\"password\\"
|
||||||
+ value=\\"\\"
|
+ value=\\"\\"
|
||||||
|
@ -432,7 +432,7 @@ exports[`<WiFiSettings/> Snapshot guest network. 1`] = `
|
||||||
class=\\"form-group switch\\"
|
class=\\"form-group switch\\"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -506,10 +590,11 @@
|
@@ -540,10 +624,11 @@
|
||||||
<div
|
<div
|
||||||
class=\\"text-right\\"
|
class=\\"text-right\\"
|
||||||
>
|
>
|
||||||
|
@ -451,7 +451,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
- First value
|
- First value
|
||||||
+ Second value
|
+ Second value
|
||||||
|
|
||||||
@@ -22,10 +22,467 @@
|
@@ -22,10 +22,501 @@
|
||||||
Wi-Fi 1
|
Wi-Fi 1
|
||||||
</h2>
|
</h2>
|
||||||
</label>
|
</label>
|
||||||
|
@ -889,17 +889,51 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"form-group\\"
|
+ class=\\"form-group\\"
|
||||||
+ >
|
+ >
|
||||||
|
+ <label
|
||||||
|
+ for=\\"10\\"
|
||||||
|
+ >
|
||||||
|
+ Encryption
|
||||||
|
+ </label>
|
||||||
|
+ <select
|
||||||
|
+ class=\\"custom-select\\"
|
||||||
|
+ id=\\"10\\"
|
||||||
|
+ >
|
||||||
|
+ <option
|
||||||
|
+ value=\\"WPA3\\"
|
||||||
|
+ >
|
||||||
|
+ WPA3 only
|
||||||
|
+ </option>
|
||||||
|
+ <option
|
||||||
|
+ value=\\"WPA2/3\\"
|
||||||
|
+ >
|
||||||
|
+ WPA3 with WPA2 as fallback (default)
|
||||||
|
+ </option>
|
||||||
|
+ <option
|
||||||
|
+ value=\\"WPA2\\"
|
||||||
|
+ >
|
||||||
|
+ WPA2 only
|
||||||
|
+ </option>
|
||||||
|
+ </select>
|
||||||
|
+ <small
|
||||||
|
+ class=\\"form-text text-muted\\"
|
||||||
|
+ >
|
||||||
|
+ The WPA3 standard is the new most secure encryption method that is suggested to be used with any device that supports it. The older devices without WPA3 support require older WPA2. If you experience issues with connecting older devices, try to enable WPA2.
|
||||||
|
+ </small>
|
||||||
|
+ </div>
|
||||||
|
+ <div
|
||||||
|
+ class=\\"form-group\\"
|
||||||
|
+ >
|
||||||
+ <div
|
+ <div
|
||||||
+ class=\\"custom-control custom-switch\\"
|
+ class=\\"custom-control custom-switch\\"
|
||||||
+ >
|
+ >
|
||||||
+ <input
|
+ <input
|
||||||
+ class=\\"custom-control-input\\"
|
+ class=\\"custom-control-input\\"
|
||||||
+ id=\\"10\\"
|
+ id=\\"11\\"
|
||||||
+ type=\\"checkbox\\"
|
+ type=\\"checkbox\\"
|
||||||
+ />
|
+ />
|
||||||
+ <label
|
+ <label
|
||||||
+ class=\\"custom-control-label\\"
|
+ class=\\"custom-control-label\\"
|
||||||
+ for=\\"10\\"
|
+ for=\\"11\\"
|
||||||
+ >
|
+ >
|
||||||
+ Enable Guest Wi-Fi
|
+ Enable Guest Wi-Fi
|
||||||
+ </label>
|
+ </label>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
* Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
||||||
*
|
*
|
||||||
* This is free software, licensed under the GNU General Public License v3.
|
* This is free software, licensed under the GNU General Public License v3.
|
||||||
* See /LICENSE for more information.
|
* See /LICENSE for more information.
|
||||||
|
@ -18,6 +18,11 @@ export const HWMODES = {
|
||||||
"11g": "2.4",
|
"11g": "2.4",
|
||||||
"11a": "5",
|
"11a": "5",
|
||||||
};
|
};
|
||||||
|
export const ENCRYPTIONMODES = {
|
||||||
|
WPA3: _("WPA3 only"),
|
||||||
|
"WPA2/3": _("WPA3 with WPA2 as fallback (default)"),
|
||||||
|
WPA2: _("WPA2 only"),
|
||||||
|
};
|
||||||
export const HELP_TEXTS = {
|
export const HELP_TEXTS = {
|
||||||
ssid: _(
|
ssid: _(
|
||||||
`SSID which contains non-standard characters could cause problems on some devices.`
|
`SSID which contains non-standard characters could cause problems on some devices.`
|
||||||
|
@ -42,4 +47,7 @@ export const HELP_TEXTS = {
|
||||||
access the internet, but aren't allowed to access other devices and the configuration interface of the router.
|
access the internet, but aren't allowed to access other devices and the configuration interface of the router.
|
||||||
Parameters of the guest network can be set in the Guest network tab.
|
Parameters of the guest network can be set in the Guest network tab.
|
||||||
`),
|
`),
|
||||||
|
wpa3: _(
|
||||||
|
"The WPA3 standard is the new most secure encryption method that is suggested to be used with any device that supports it. The older devices without WPA3 support require older WPA2. If you experience issues with connecting older devices, try to enable WPA2."
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user