mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-08-03 20:13:28 +02:00
Compare commits
8 Commits
v5.6.0
...
15f6cf6709
Author | SHA1 | Date | |
---|---|---|---|
|
15f6cf6709 | ||
|
3fc1388a9f | ||
|
2bbdda566c | ||
|
f12de3205f | ||
|
a971e8ce1a | ||
|
1297d8446c | ||
|
0791087d8f | ||
|
ce3d439005 |
2
Makefile
2
Makefile
@@ -97,6 +97,8 @@ test-js-watch:
|
|||||||
.PHONY: test-js-update-snapshots
|
.PHONY: test-js-update-snapshots
|
||||||
test-js-update-snapshots:
|
test-js-update-snapshots:
|
||||||
npm test -- -u
|
npm test -- -u
|
||||||
|
test-js-watch:
|
||||||
|
npm test -- --watch
|
||||||
|
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
|
747
package-lock.json
generated
747
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "5.6.0",
|
"version": "5.5.0",
|
||||||
"description": "Foris JS library is a set of components and utils for reForis application and plugins.",
|
"description": "Foris JS library is a set of components and utils for reForis application and plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
import React, { useState, useContext, useCallback } from "react";
|
import React, { useState, useContext, useCallback } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { Alert, ALERT_TYPES } from "../../bootstrap/Alert";
|
import { Alert, ALERT_TYPES } from "../bootstrap/Alert";
|
||||||
import { Portal } from "../../utils/Portal";
|
import { Portal } from "../utils/Portal";
|
||||||
|
|
||||||
AlertContextProvider.propTypes = {
|
AlertContextProvider.propTypes = {
|
||||||
children: PropTypes.oneOfType([
|
children: PropTypes.oneOfType([
|
@@ -14,7 +14,7 @@ import { ForisURLs } from "../utils/forisUrls";
|
|||||||
|
|
||||||
import { Button } from "../bootstrap/Button";
|
import { Button } from "../bootstrap/Button";
|
||||||
import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal";
|
import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal";
|
||||||
import { useAlert } from "../context/alertContext/AlertContext";
|
import { useAlert } from "../alertContext/AlertContext";
|
||||||
|
|
||||||
export function RebootButton(props) {
|
export function RebootButton(props) {
|
||||||
const [triggered, setTriggered] = useState(false);
|
const [triggered, setTriggered] = useState(false);
|
||||||
|
@@ -9,7 +9,7 @@ import React, { useEffect, useState } from "react";
|
|||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { Button } from "../../bootstrap/Button";
|
import { Button } from "../../bootstrap/Button";
|
||||||
import { useAlert } from "../../context/alertContext/AlertContext";
|
import { useAlert } from "../../alertContext/AlertContext";
|
||||||
import { ALERT_TYPES } from "../../bootstrap/Alert";
|
import { ALERT_TYPES } from "../../bootstrap/Alert";
|
||||||
import { useAPIPost } from "../../api/hooks";
|
import { useAPIPost } from "../../api/hooks";
|
||||||
import { API_STATE } from "../../api/utils";
|
import { API_STATE } from "../../api/utils";
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://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.
|
||||||
@@ -64,7 +64,7 @@ DeviceForm.propTypes = {
|
|||||||
guest_wifi: PropTypes.object.isRequired,
|
guest_wifi: PropTypes.object.isRequired,
|
||||||
encryption: PropTypes.string.isRequired,
|
encryption: PropTypes.string.isRequired,
|
||||||
available_bands: PropTypes.array.isRequired,
|
available_bands: PropTypes.array.isRequired,
|
||||||
ieee80211w_disabled: PropTypes.bool,
|
ieee80211w_disabled: PropTypes.bool.isRequired,
|
||||||
}),
|
}),
|
||||||
formErrors: PropTypes.object.isRequired,
|
formErrors: PropTypes.object.isRequired,
|
||||||
setFormValue: PropTypes.func.isRequired,
|
setFormValue: PropTypes.func.isRequired,
|
||||||
|
@@ -8,10 +8,10 @@
|
|||||||
import React, { useContext, useEffect } from "react";
|
import React, { useContext, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { useAPIGet } from "../../api/hooks";
|
import { useAPIGet } from "../api/hooks";
|
||||||
import { ForisURLs } from "../../utils/forisUrls";
|
import { ForisURLs } from "../utils/forisUrls";
|
||||||
|
|
||||||
import { Spinner } from "../../bootstrap/Spinner";
|
import { Spinner } from "../bootstrap/Spinner";
|
||||||
|
|
||||||
CustomizationContextProvider.propTypes = {
|
CustomizationContextProvider.propTypes = {
|
||||||
children: PropTypes.oneOfType([
|
children: PropTypes.oneOfType([
|
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { render, wait, getByText } from "customTestRender";
|
import { render, wait } from "customTestRender";
|
||||||
import mockAxios from "jest-mock-axios";
|
import mockAxios from "jest-mock-axios";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -18,35 +18,39 @@ import {
|
|||||||
const CUSTOM = "Description / component for customized reForis (Shield)";
|
const CUSTOM = "Description / component for customized reForis (Shield)";
|
||||||
const ORIGINAL = "Description / component for original reForis (other devices)";
|
const ORIGINAL = "Description / component for original reForis (other devices)";
|
||||||
|
|
||||||
const CustomizationTest = () => {
|
function CustomizationTest() {
|
||||||
const { isCustomized } = useCustomizationContext();
|
const isCustomized = useCustomizationContext();
|
||||||
|
|
||||||
return <p>{isCustomized ? CUSTOM : ORIGINAL}</p>;
|
return <p>{isCustomized ? CUSTOM : ORIGINAL}</p>;
|
||||||
};
|
}
|
||||||
|
|
||||||
describe("CustomizationContext", () => {
|
describe("CustomizationContext", () => {
|
||||||
let componentContainer;
|
let componentContainer;
|
||||||
beforeEach(() => {
|
|
||||||
const { container } = render(
|
it("should render component without customization", async () => {
|
||||||
|
const { container, getByText } = render(
|
||||||
<CustomizationContextProvider>
|
<CustomizationContextProvider>
|
||||||
<CustomizationTest />
|
<CustomizationTest />
|
||||||
</CustomizationContextProvider>
|
</CustomizationContextProvider>
|
||||||
);
|
);
|
||||||
componentContainer = container;
|
componentContainer = container;
|
||||||
});
|
|
||||||
|
|
||||||
it("should render component without customization", async () => {
|
|
||||||
mockAxios.mockResponse({ data: {} });
|
mockAxios.mockResponse({ data: {} });
|
||||||
|
await wait(() => getByText(ORIGINAL));
|
||||||
await wait(() => getByText(componentContainer, ORIGINAL));
|
|
||||||
|
|
||||||
expect(componentContainer).toMatchSnapshot();
|
expect(componentContainer).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should render customized component", async () => {
|
it("should render customized component", async () => {
|
||||||
mockAxios.mockResponse({ data: { customization: "shield" } });
|
const { container, getByText } = render(
|
||||||
|
<CustomizationContextProvider>
|
||||||
|
<CustomizationTest />
|
||||||
|
</CustomizationContextProvider>
|
||||||
|
);
|
||||||
|
componentContainer = container;
|
||||||
|
|
||||||
await wait(() => getByText(componentContainer, CUSTOM));
|
mockAxios.mockResponse({ data: { customization: "shield" } });
|
||||||
|
await wait(() => getByText(CUSTOM));
|
||||||
|
|
||||||
expect(componentContainer).toMatchSnapshot();
|
expect(componentContainer).toMatchSnapshot();
|
||||||
});
|
});
|
@@ -13,7 +13,7 @@ import { ALERT_TYPES } from "../../bootstrap/Alert";
|
|||||||
import { API_STATE } from "../../api/utils";
|
import { API_STATE } from "../../api/utils";
|
||||||
import { formFieldsSize } from "../../bootstrap/constants";
|
import { formFieldsSize } from "../../bootstrap/constants";
|
||||||
import { Spinner } from "../../bootstrap/Spinner";
|
import { Spinner } from "../../bootstrap/Spinner";
|
||||||
import { useAlert } from "../../context/alertContext/AlertContext";
|
import { useAlert } from "../../alertContext/AlertContext";
|
||||||
import { useAPIPost } from "../../api/hooks";
|
import { useAPIPost } from "../../api/hooks";
|
||||||
|
|
||||||
import { useForisModule, useForm } from "../hooks";
|
import { useForisModule, useForm } from "../hooks";
|
||||||
|
@@ -90,13 +90,10 @@ export {
|
|||||||
} from "./utils/validations";
|
} from "./utils/validations";
|
||||||
|
|
||||||
// Alert context
|
// Alert context
|
||||||
export {
|
export { AlertContextProvider, useAlert } from "./alertContext/AlertContext";
|
||||||
AlertContextProvider,
|
|
||||||
useAlert,
|
|
||||||
} from "./context/alertContext/AlertContext";
|
|
||||||
|
|
||||||
// Customization context
|
// Customization context
|
||||||
export {
|
export {
|
||||||
CustomizationContextProvider,
|
CustomizationContextProvider,
|
||||||
useCustomizationContext,
|
useCustomizationContext,
|
||||||
} from "./context/customizationContext/CustomizationContext";
|
} from "./customizationContext/CustomizationContext";
|
||||||
|
@@ -25,13 +25,13 @@ Wrapper.propTypes = {
|
|||||||
|
|
||||||
function Wrapper({ children }) {
|
function Wrapper({ children }) {
|
||||||
return (
|
return (
|
||||||
<CustomizationContextMock>
|
<AlertContextMock>
|
||||||
<AlertContextMock>
|
<CustomizationContextMock>
|
||||||
<StaticRouter>
|
<StaticRouter>
|
||||||
<UIDReset>{children}</UIDReset>
|
<UIDReset>{children}</UIDReset>
|
||||||
</StaticRouter>
|
</StaticRouter>
|
||||||
</AlertContextMock>
|
</CustomizationContextMock>
|
||||||
</CustomizationContextMock>
|
</AlertContextMock>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,23 +9,11 @@ import React from "react";
|
|||||||
|
|
||||||
window.CustomizationContext = React.createContext();
|
window.CustomizationContext = React.createContext();
|
||||||
|
|
||||||
const deviceDetails = {
|
const isCustomized = jest.fn();
|
||||||
kernel: "5.x.x",
|
|
||||||
model: "Turris Omnia",
|
|
||||||
os_branch: {
|
|
||||||
mode: "branch",
|
|
||||||
value: "hbs",
|
|
||||||
},
|
|
||||||
os_version: "6.x.x",
|
|
||||||
reforis_version: "1.x.x",
|
|
||||||
serial: 123456789,
|
|
||||||
};
|
|
||||||
|
|
||||||
const isCustomized = false;
|
|
||||||
|
|
||||||
function CustomizationContextMock({ children }) {
|
function CustomizationContextMock({ children }) {
|
||||||
return (
|
return (
|
||||||
<CustomizationContext.Provider value={{ deviceDetails, isCustomized }}>
|
<CustomizationContext.Provider value={isCustomized}>
|
||||||
{children}
|
{children}
|
||||||
</CustomizationContext.Provider>
|
</CustomizationContext.Provider>
|
||||||
);
|
);
|
||||||
|
@@ -43,7 +43,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Alert Context",
|
name: "Alert Context",
|
||||||
components: ["src/context/alertContext/AlertContext.js"],
|
components: ["src/alertContext/AlertContext.js"],
|
||||||
exampleMode: "expand",
|
exampleMode: "expand",
|
||||||
usageMode: "expand",
|
usageMode: "expand",
|
||||||
},
|
},
|
||||||
@@ -53,9 +53,7 @@ module.exports = {
|
|||||||
|
|
||||||
{
|
{
|
||||||
name: "Customization Context",
|
name: "Customization Context",
|
||||||
components: [
|
components: ["src/customizationContext/CustomizationContext.js"],
|
||||||
"src/context/customizationContext/CustomizationContext.js",
|
|
||||||
],
|
|
||||||
exampleMode: "expand",
|
exampleMode: "expand",
|
||||||
usageMode: "expand",
|
usageMode: "expand",
|
||||||
},
|
},
|
||||||
|
@@ -8,17 +8,16 @@ msgstr ""
|
|||||||
"Project-Id-Version: PROJECT VERSION\n"
|
"Project-Id-Version: PROJECT VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2022-12-02 15:54+0100\n"
|
"POT-Creation-Date: 2022-12-02 15:54+0100\n"
|
||||||
"PO-Revision-Date: 2022-12-07 12:47+0000\n"
|
"PO-Revision-Date: 2022-05-28 09:19+0000\n"
|
||||||
"Last-Translator: Алексей Леньшин <alenshin@gmail.com>\n"
|
"Last-Translator: Алексей Леньшин <alenshin@gmail.com>\n"
|
||||||
"Language-Team: Russian <https://hosted.weblate.org/projects/turris/foris-js/"
|
|
||||||
"ru/>\n"
|
|
||||||
"Language: ru\n"
|
"Language: ru\n"
|
||||||
|
"Language-Team: Russian <https://hosted.weblate.org/projects/turris/foris-"
|
||||||
|
"js/ru/>\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
|
||||||
|
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
"Content-Type: text/plain; charset=utf-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
|
|
||||||
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
|
||||||
"X-Generator: Weblate 4.15-dev\n"
|
|
||||||
"Generated-By: Babel 2.11.0\n"
|
"Generated-By: Babel 2.11.0\n"
|
||||||
|
|
||||||
#: src/api/utils.js:61
|
#: src/api/utils.js:61
|
||||||
@@ -119,15 +118,13 @@ msgstr "Шифрование"
|
|||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:226
|
#: src/common/WiFiSettings/WiFiForm.js:226
|
||||||
msgid "Disable Management Frame Protection"
|
msgid "Disable Management Frame Protection"
|
||||||
msgstr "Отключить защиту кадров управления"
|
msgstr ""
|
||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:227
|
#: src/common/WiFiSettings/WiFiForm.js:227
|
||||||
msgid ""
|
msgid ""
|
||||||
"In case you have trouble connecting to WiFi Access Point, try disabling "
|
"In case you have trouble connecting to WiFi Access Point, try disabling "
|
||||||
"Management Frame Protection."
|
"Management Frame Protection."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Если у вас возникли проблемы с подключением к точке доступа Wi-Fi, "
|
|
||||||
"попробуйте отключить защиту кадров управления."
|
|
||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:262
|
#: src/common/WiFiSettings/WiFiForm.js:262
|
||||||
msgid "auto"
|
msgid "auto"
|
||||||
@@ -384,3 +381,4 @@ msgstr "Не содержит списка электронных адресов
|
|||||||
#~ "конфигурации Wi-Fi и восстановлению "
|
#~ "конфигурации Wi-Fi и восстановлению "
|
||||||
#~ "значений по умолчанию.\n"
|
#~ "значений по умолчанию.\n"
|
||||||
#~ " "
|
#~ " "
|
||||||
|
|
||||||
|
@@ -8,16 +8,15 @@ msgstr ""
|
|||||||
"Project-Id-Version: PROJECT VERSION\n"
|
"Project-Id-Version: PROJECT VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2022-12-02 15:54+0100\n"
|
"POT-Creation-Date: 2022-12-02 15:54+0100\n"
|
||||||
"PO-Revision-Date: 2022-12-05 16:48+0000\n"
|
"PO-Revision-Date: 2022-05-30 06:14+0000\n"
|
||||||
"Last-Translator: Atec <dr.atec@gmail.com>\n"
|
"Last-Translator: Atec <dr.atec@gmail.com>\n"
|
||||||
"Language-Team: Slovak <https://hosted.weblate.org/projects/turris/foris-js/"
|
|
||||||
"sk/>\n"
|
|
||||||
"Language: sk\n"
|
"Language: sk\n"
|
||||||
|
"Language-Team: Slovak <https://hosted.weblate.org/projects/turris/foris-"
|
||||||
|
"js/sk/>\n"
|
||||||
|
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
"Content-Type: text/plain; charset=utf-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
|
|
||||||
"X-Generator: Weblate 4.15-dev\n"
|
|
||||||
"Generated-By: Babel 2.11.0\n"
|
"Generated-By: Babel 2.11.0\n"
|
||||||
|
|
||||||
#: src/api/utils.js:61
|
#: src/api/utils.js:61
|
||||||
@@ -118,15 +117,13 @@ msgstr "Šifrovanie"
|
|||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:226
|
#: src/common/WiFiSettings/WiFiForm.js:226
|
||||||
msgid "Disable Management Frame Protection"
|
msgid "Disable Management Frame Protection"
|
||||||
msgstr "Zakázať Management Frame Protection"
|
msgstr ""
|
||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:227
|
#: src/common/WiFiSettings/WiFiForm.js:227
|
||||||
msgid ""
|
msgid ""
|
||||||
"In case you have trouble connecting to WiFi Access Point, try disabling "
|
"In case you have trouble connecting to WiFi Access Point, try disabling "
|
||||||
"Management Frame Protection."
|
"Management Frame Protection."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Ak máte problémy s pripojením k prístupovému bodu WiFi, skúste zakázať "
|
|
||||||
"Management Frame Protection."
|
|
||||||
|
|
||||||
#: src/common/WiFiSettings/WiFiForm.js:262
|
#: src/common/WiFiSettings/WiFiForm.js:262
|
||||||
msgid "auto"
|
msgid "auto"
|
||||||
@@ -380,3 +377,4 @@ msgstr "Neobsahuje zoznam e-mailov oddelených čiarkami."
|
|||||||
#~ "že sa tým odstráni aktuálna konfigurácia"
|
#~ "že sa tým odstráni aktuálna konfigurácia"
|
||||||
#~ " a obnovia sa východiskové hodnoty.\n"
|
#~ " a obnovia sa východiskové hodnoty.\n"
|
||||||
#~ " "
|
#~ " "
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user