1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-06-15 13:36:35 +02:00

Compare commits

...

21 Commits

Author SHA1 Message Date
c35a4a8236 Merge branch 'dev' into 'master'
Dev

See merge request turris/reforis/foris-js!164
2021-06-30 12:34:05 +00:00
67b8386cd0 Merge branch 'bump-5113' into 'dev'
Bump v5.1.13

See merge request turris/reforis/foris-js!163
2021-06-30 11:56:44 +00:00
f67edc39e1 Bump v5.1.13
* Add sentinelAgreement endpoint to forisUrls
* NPM audit fix
2021-06-30 10:51:03 +02:00
6f0f344eb4 NPM audit fix 2021-06-30 10:45:30 +02:00
3a39e44c34 Merge branch 'add-data-collection-endpoint' into 'dev'
Add sentinelAgreement endpoint to forisUrls

See merge request turris/reforis/foris-js!162
2021-06-30 08:41:09 +00:00
cff5f1e5e1 Add sentinelAgreement endpoint to forisUrls 2021-06-29 17:39:53 +02:00
b7bab92d5d Merge branch 'dev' into 'master'
Dev

See merge request turris/reforis/foris-js!160
2021-05-14 11:55:44 +00:00
75dd0fec92 Merge branch 'fix-wifi' into 'dev'
Expend library with the ResetWifiSettings function

Closes #20

See merge request turris/reforis/foris-js!155
2021-05-14 11:46:20 +00:00
3619532124 Bump v5.1.12
* Add & update translations
* Add & fix obsolete links
* Expend library with the ResetWifiSettings function
* Fix switching Wi-Fi modes depending on bands in WiFiForm
* Fix translation sources in WiFiForm
* NPM audit fix
* Other small improvements
2021-05-14 13:38:01 +02:00
ce62fd1043 Update Snapshots 2021-05-14 13:38:00 +02:00
c5bac99d8e NPM audit fix 2021-05-14 13:38:00 +02:00
f7146e3b14 Fix obsolete rebootPage link in forisUrls 2021-05-14 13:37:59 +02:00
18ba90567c Fix fuzzy translation messages in English catalog 2021-05-14 13:37:59 +02:00
2e9da55df7 Fix ids in wifiSettings fixture 2021-05-14 13:37:59 +02:00
da10a34d64 Revert "Fix reForis infinity redirect loop when WS error occurs"
It turned out that this fix doesn't work as expected in some cases.

This reverts commit 7505302875.
2021-05-14 13:37:58 +02:00
764a6c86cd Expend library with the ResetWifiSettings function
Use named export instead of the default for ResetWifiSettings,
as we want to use it not only inside the WiFiSettings component.
2021-05-14 13:37:58 +02:00
6059ce9e7b Merge branch 'fix-wifi-modes' into 'dev'
Fix switching Wi-Fi modes depending on bands in WiFiForm

Closes reforis#292

See merge request turris/reforis/foris-js!159
2021-05-14 11:11:01 +00:00
4368bea2c2 Update tests 2021-05-14 13:06:48 +02:00
9dd6bbca90 Fix switching Wi-Fi modes depending on bands in WiFiForm 2021-05-14 13:06:48 +02:00
d5bb99570c Merge branch 'add-packages-url' into 'dev'
Add Packages URL

See merge request turris/reforis/foris-js!158
2021-04-29 15:48:13 +00:00
e1260a5ea1 Add Packages URL into forisUrls 2021-04-21 14:10:23 +02:00
13 changed files with 10038 additions and 16435 deletions

26258
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "5.1.11",
"version": "5.1.13",
"description": "Set of components and utils for Foris and its plugins.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
@ -39,7 +39,7 @@
"babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0",
"bootstrap": "^4.5.0",
"css-loader": "^3.5.3",
"css-loader": "^5.2.4",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-reforis": "^1.0.0",
@ -53,7 +53,7 @@
"react": "16.9.0",
"react-dom": "16.9.0",
"react-router-dom": "^5.1.2",
"react-styleguidist": "^11.1.5",
"react-styleguidist": "^11.1.7",
"snapshot-diff": "^0.7.0",
"style-loader": "^1.2.1",
"webpack": "^5.15.0"

View File

@ -20,7 +20,7 @@ ResetWiFiSettings.propTypes = {
endpoint: PropTypes.string.isRequired,
};
export default function ResetWiFiSettings({ ws, endpoint }) {
export function ResetWiFiSettings({ ws, endpoint }) {
const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
@ -54,14 +54,13 @@ export default function ResetWiFiSettings({ ws, endpoint }) {
<div className={formFieldsSize}>
<h2>{_("Reset Wi-Fi Settings")}</h2>
<p>
{_(`
If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the
current Wi-Fi configuration and restore the default values.
`)}
{_(`If a number of wireless cards doesn't match, you may try \
to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi \
configuration and restore the default values.`)}
</p>
<div className="text-right">
<Button
className="btn-warning"
className="btn-primary"
forisFormSize
loading={isLoading}
disabled={isLoading}

View File

@ -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.
* See /LICENSE for more information.
@ -163,6 +163,10 @@ function DeviceForm({
[deviceIndex]: {
hwmode: { $set: value },
channel: { $set: "0" },
htmode: {
$set:
value === "11a" ? "VHT80" : "HT20",
},
},
},
}))}

View File

@ -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.
* See /LICENSE for more information.
@ -10,7 +10,7 @@ import PropTypes from "prop-types";
import { ForisForm } from "../../form/components/ForisForm";
import WiFiForm from "./WiFiForm";
import ResetWiFiSettings from "./ResetWiFiSettings";
import { ResetWiFiSettings } from "./ResetWiFiSettings";
WiFiSettings.propTypes = {
ws: PropTypes.object.isRequired,

View File

@ -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.
* See /LICENSE for more information.
@ -14,7 +14,7 @@ import { mockJSONError } from "testUtils/network";
import { mockSetAlert } from "testUtils/alertContextMock";
import { ALERT_TYPES } from "../../../bootstrap/Alert";
import ResetWiFiSettings from "../ResetWiFiSettings";
import { ResetWiFiSettings } from "../ResetWiFiSettings";
describe("<ResetWiFiSettings/>", () => {
const webSockets = new WebSockets();

View File

@ -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.
* See /LICENSE for more information.
@ -116,7 +116,7 @@ describe("<WiFiSettings/>", () => {
enabled: true,
guest_wifi: { enabled: false },
hidden: false,
htmode: "HT40",
htmode: "HT80",
hwmode: "11a",
id: 0,
password: "TestPass",
@ -145,7 +145,7 @@ describe("<WiFiSettings/>", () => {
enabled: true,
guest_wifi: { enabled: false },
hidden: false,
htmode: "HT40",
htmode: "HT20",
hwmode: "11g",
id: 0,
password: "TestPass",
@ -181,7 +181,7 @@ describe("<WiFiSettings/>", () => {
password: "test_password",
},
hidden: false,
htmode: "HT40",
htmode: "HT80",
hwmode: "11a",
id: 0,
password: "TestPass",

View File

@ -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.
* See /LICENSE for more information.
@ -226,7 +226,7 @@ export function wifiSettingsFixture() {
password: "",
},
hidden: false,
htmode: "HT40",
htmode: "HT80",
hwmode: "11a",
id: 0,
password: "TestPass",
@ -349,7 +349,7 @@ const twoDevices = {
hidden: false,
htmode: "HT40",
hwmode: "11a",
id: 0,
id: 1,
password: "TestPass",
},
],
@ -376,7 +376,7 @@ const threeDevices = {
hidden: false,
htmode: "HT40",
hwmode: "11a",
id: 0,
id: 1,
password: "TestPass",
},
{
@ -387,7 +387,7 @@ const threeDevices = {
hidden: false,
htmode: "HT40",
hwmode: "11a",
id: 0,
id: 2,
password: "",
},
],

View File

@ -316,16 +316,13 @@ exports[`<WiFiSettings/> Snapshot both modules disabled. 1`] = `
Reset Wi-Fi Settings
</h2>
<p>
If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the
current Wi-Fi configuration and restore the default values.
If a number of wireless cards doesn't match, you may try to reset the Wi-Fi settings. Note that this will remove the current Wi-Fi configuration and restore the default values.
</p>
<div
class="text-right"
>
<button
class="btn btn-warning col-sm-12 col-md-3 col-lg-2"
class="btn btn-primary col-sm-12 col-md-3 col-lg-2"
type="button"
>
Reset Wi-Fi Settings

View File

@ -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.
* See /LICENSE for more information.
@ -39,6 +39,7 @@ export { Modal, ModalBody, ModalFooter, ModalHeader } from "./bootstrap/Modal";
// Common
export { RebootButton } from "./common/RebootButton";
export { WiFiSettings } from "./common/WiFiSettings/WiFiSettings";
export { ResetWiFiSettings } from "./common/WiFiSettings/ResetWiFiSettings";
// Form
export { ForisForm } from "./form/components/ForisForm";
export {

View File

@ -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.
* See /LICENSE for more information.
@ -18,9 +18,12 @@ export const ForisURLs = {
packageManagement: {
updateSettings: `${REFORIS_URL_PREFIX}/package-management/update-settings`,
updates: `${REFORIS_URL_PREFIX}/package-management/updates`,
packages: `${REFORIS_URL_PREFIX}/package-management/packages`,
},
// Plugins
storage: `${REFORIS_URL_PREFIX}/storage`,
sentinelAgreement: `${REFORIS_URL_PREFIX}/sentinel/agreement`,
// Notifications links are used with <Link/> inside Router, thus url subdir is not required.
overview: "/overview",
@ -29,7 +32,7 @@ export const ForisURLs = {
approveUpdates: "/package-management/updates",
languages: "/package-management/languages",
rebootPage: "/administration/reboot",
maintenance: "/administration/maintenance",
luci: "/cgi-bin/luci",
// API

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
* Copyright (C) 2020 CZ.NIC z.s.p.o. (http://www.nic.cz/)
*
* This is free software, licensed under the GNU General Public License v3.
* See /LICENSE for more information.
@ -7,6 +7,8 @@
/* eslint no-console: "off" */
import { ForisURLs } from "../utils/forisUrls";
const PROTOCOL = window.location.protocol === "http:" ? "ws" : "wss";
const URL = process.env.LIGHTTPD
@ -19,7 +21,13 @@ export class WebSockets {
constructor() {
this.ws = new WebSocket(URL);
this.ws.onerror = (e) => {
console.error("WS: Error observed:", e);
if (window.location.pathname !== ForisURLs.login) {
console.error(
"WS: Error observed, you aren't logged probably."
);
window.location.replace(ForisURLs.login);
}
console.error(`WS: Error: ${e}`);
};
this.ws.onmessage = (e) => {
console.debug(`WS: Received Message: ${e.data}`);

View File

@ -37,11 +37,11 @@ msgstr ""
#: src/common/RebootButton.js:27
msgid "Reboot request failed."
msgstr "Reboot is required"
msgstr ""
#: src/common/RebootButton.js:51
msgid "Reboot"
msgstr "Reboot"
msgstr ""
#: src/common/RebootButton.js:66
msgid "Warning!"
@ -87,16 +87,15 @@ msgstr ""
#: src/common/WiFiSettings/WiFiForm.js:217
msgid "auto"
msgstr "auto"
msgstr ""
#: src/common/WiFiSettings/WiFiGuestForm.js:42
#, fuzzy
msgid "Enable Guest Wi-Fi"
msgstr "Enable Guest Wifi"
msgstr ""
#: src/common/WiFiSettings/WiFiGuestForm.js:80
msgid "Password"
msgstr "Password"
msgstr ""
#: src/common/WiFiSettings/WiFiQRCode.js:71
msgid "Wi-Fi QR Code"
@ -109,52 +108,50 @@ msgstr ""
#: src/common/WiFiSettings/WiFiSettings.js:78
#: src/common/WiFiSettings/WiFiSettings.js:90
msgid "SSID can't be longer than 32 symbols"
msgstr "SSID can't be longer than 32 symbols"
msgstr ""
#: src/common/WiFiSettings/WiFiSettings.js:79
#: src/common/WiFiSettings/WiFiSettings.js:92
msgid "SSID can't be empty"
msgstr "SSID can't be empty"
msgstr ""
#: src/common/WiFiSettings/WiFiSettings.js:81
#: src/common/WiFiSettings/WiFiSettings.js:94
#, fuzzy
msgid "SSID can't be longer than 32 bytes"
msgstr "SSID can't be longer than 32 symbols"
msgstr ""
#: src/common/WiFiSettings/WiFiSettings.js:84
#: src/common/WiFiSettings/WiFiSettings.js:97
msgid "Password must contain at least 8 symbols"
msgstr "Password must contain at least 8 symbols"
msgstr ""
#: src/common/WiFiSettings/constants.js:9
msgid "Disabled"
msgstr "Disabled"
msgstr ""
#: src/common/WiFiSettings/constants.js:10
msgid "802.11n - 20 MHz wide channel"
msgstr "802.11n - 20 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:11
msgid "802.11n - 40 MHz wide channel"
msgstr "802.11n - 40 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:12
msgid "802.11ac - 20 MHz wide channel"
msgstr "802.11ac - 20 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:13
msgid "802.11ac - 40 MHz wide channel"
msgstr "802.11ac - 40 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:14
msgid "802.11ac - 80 MHz wide channel"
msgstr "802.11ac - 80 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:15
#, fuzzy
msgid "802.11ac - 160 MHz wide channel"
msgstr "802.11ac - 80 MHz wide channel"
msgstr ""
#: src/common/WiFiSettings/constants.js:22
msgid ""
@ -168,13 +165,10 @@ msgid ""
" WPA2 pre-shared key, that is required to connect to the network.\n"
" "
msgstr ""
"\n"
" WPA2 pre-shared key, that is required to connect to the network.\n"
" "
#: src/common/WiFiSettings/constants.js:28
msgid "If set, network is not visible when scanning for available networks."
msgstr "If set, network is not visible when scanning for available networks."
msgstr ""
#: src/common/WiFiSettings/constants.js:31
msgid ""
@ -185,12 +179,6 @@ msgid ""
"usually has less interference, but the signal\n"
" does not carry so well indoors."
msgstr ""
"\n"
" The 2.4 GHz band is more widely supported by clients, but tends "
"to have more interference. The 5 GHz band is a\n"
" newer standard and may not be supported by all your devices. It "
"usually has less interference, but the signal\n"
" does not carry so well indoors."
#: src/common/WiFiSettings/constants.js:35
msgid ""
@ -202,13 +190,6 @@ msgid ""
" option with 20 MHz wide channel.\n"
" "
msgstr ""
"\n"
" Change this to adjust 802.11n/ac mode of operation. 802.11n with "
"40 MHz wide channels can yield higher\n"
" throughput but can cause more interference in the network. If you"
" don't know what to choose, use the default\n"
" option with 20 MHz wide channel.\n"
" "
#: src/common/WiFiSettings/constants.js:40
msgid ""
@ -221,14 +202,6 @@ msgid ""
"tab.\n"
" "
msgstr ""
"\n"
" Enables Wi-Fi for guests, which is separated from LAN network. "
"Devices connected to this network are allowed to\n"
" access the internet, but aren't allowed to access other devices "
"and the configuration interface of the router.\n"
" Parameters of the guest network can be set in the Guest network "
"tab.\n"
" "
#: src/form/components/ForisForm.js:121
msgid "Settings saved successfully"
@ -240,15 +213,15 @@ msgstr ""
#: src/form/components/SubmitButton.js:31
msgid "Updating"
msgstr "Updating"
msgstr ""
#: src/form/components/SubmitButton.js:34
msgid "Load settings"
msgstr "Load settings"
msgstr ""
#: src/form/components/SubmitButton.js:37
msgid "Save"
msgstr "Save"
msgstr ""
#: src/utils/ErrorMessage.js:16
msgid "An error occurred while fetching data."
@ -256,31 +229,31 @@ msgstr ""
#: src/utils/validations.js:13
msgid "This is not a valid IPv4 address."
msgstr "This is not a valid IPv4 address."
msgstr ""
#: src/utils/validations.js:14
msgid "This is not a valid IPv6 address."
msgstr "This is not a valid IPv6 address."
msgstr ""
#: src/utils/validations.js:15
msgid "This is not a valid IPv6 prefix."
msgstr "This is not a valid IPv6 prefix."
msgstr ""
#: src/utils/validations.js:16
msgid "This is not a valid domain name."
msgstr "This is not a valid domain name."
msgstr ""
#: src/utils/validations.js:17
msgid "This is not a valid DUID."
msgstr "This is not a valid DUID."
msgstr ""
#: src/utils/validations.js:18
msgid "This is not a valid MAC address."
msgstr "This is not a valid MAC address."
msgstr ""
#: src/utils/validations.js:19
msgid "Doesn't contain a list of emails separated by commas."
msgstr "Doesn't contain a list of emails separated by commas."
msgstr ""
#~ msgid "An unknown error occurred. Check the console for more info."
#~ msgstr ""
@ -289,5 +262,5 @@ msgstr "Doesn't contain a list of emails separated by commas."
#~ msgstr ""
#~ msgid "Enable"
#~ msgstr "Enable"
#~ msgstr ""