foris 5.5.0 → 5.6.0-beta.9c3dcaf6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ import { ForisURLs } from "../utils/forisUrls";
14
14
 
15
15
  import { Button } from "../bootstrap/Button";
16
16
  import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal";
17
- import { useAlert } from "../alertContext/AlertContext";
17
+ import { useAlert } from "../context/alertContext/AlertContext";
18
18
 
19
19
  export function RebootButton(props) {
20
20
  const [triggered, setTriggered] = useState(false);
@@ -9,7 +9,7 @@ import React, { useEffect, useState } from "react";
9
9
  import PropTypes from "prop-types";
10
10
 
11
11
  import { Button } from "../../bootstrap/Button";
12
- import { useAlert } from "../../alertContext/AlertContext";
12
+ import { useAlert } from "../../context/alertContext/AlertContext";
13
13
  import { ALERT_TYPES } from "../../bootstrap/Alert";
14
14
  import { useAPIPost } from "../../api/hooks";
15
15
  import { API_STATE } from "../../api/utils";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
2
+ * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
3
3
  *
4
4
  * This is free software, licensed under the GNU General Public License v3.
5
5
  * See /LICENSE for more information.
@@ -64,7 +64,7 @@ DeviceForm.propTypes = {
64
64
  guest_wifi: PropTypes.object.isRequired,
65
65
  encryption: PropTypes.string.isRequired,
66
66
  available_bands: PropTypes.array.isRequired,
67
- ieee80211w_disabled: PropTypes.bool.isRequired,
67
+ ieee80211w_disabled: PropTypes.bool,
68
68
  }),
69
69
  formErrors: PropTypes.object.isRequired,
70
70
  setFormValue: PropTypes.func.isRequired,
@@ -8,8 +8,8 @@
8
8
  import React, { useState, useContext, useCallback } from "react";
9
9
  import PropTypes from "prop-types";
10
10
 
11
- import { Alert, ALERT_TYPES } from "../bootstrap/Alert";
12
- import { Portal } from "../utils/Portal";
11
+ import { Alert, ALERT_TYPES } from "../../bootstrap/Alert";
12
+ import { Portal } from "../../utils/Portal";
13
13
 
14
14
  AlertContextProvider.propTypes = {
15
15
  children: PropTypes.oneOfType([
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
3
+ *
4
+ * This is free software, licensed under the GNU General Public License v3.
5
+ * See /LICENSE for more information.
6
+ */
7
+
8
+ import React, { useContext, useEffect } from "react";
9
+ import PropTypes from "prop-types";
10
+
11
+ import { useAPIGet } from "../../api/hooks";
12
+ import { ForisURLs } from "../../utils/forisUrls";
13
+
14
+ import { Spinner } from "../../bootstrap/Spinner";
15
+
16
+ CustomizationContextProvider.propTypes = {
17
+ children: PropTypes.oneOfType([
18
+ PropTypes.arrayOf(PropTypes.node),
19
+ PropTypes.node,
20
+ ]),
21
+ };
22
+
23
+ function CustomizationContextProvider({ children }) {
24
+ const { CustomizationContext } = window;
25
+ const [getCustomizationResponse, getCustomization] = useAPIGet(
26
+ ForisURLs.about
27
+ );
28
+
29
+ useEffect(() => {
30
+ getCustomization();
31
+ }, [getCustomization]);
32
+
33
+ if (getCustomizationResponse.state !== "success") {
34
+ return <Spinner fullScreen />;
35
+ }
36
+
37
+ const deviceDetails = getCustomizationResponse.data || {};
38
+
39
+ const isCustomized = !!(
40
+ deviceDetails &&
41
+ deviceDetails.customization !== undefined &&
42
+ deviceDetails.customization === "shield"
43
+ );
44
+
45
+ return (
46
+ <CustomizationContext.Provider value={{ deviceDetails, isCustomized }}>
47
+ {children}
48
+ </CustomizationContext.Provider>
49
+ );
50
+ }
51
+
52
+ function useCustomizationContext() {
53
+ const { CustomizationContext } = window;
54
+ return useContext(CustomizationContext);
55
+ }
56
+
57
+ export { CustomizationContextProvider, useCustomizationContext };
@@ -0,0 +1,3 @@
1
+ It provides customization context to the children. `CustomizationContext` allows
2
+ using `useCustomizationContext` in components to check if the reForis UI is
3
+ customized or not for specific devices.
Binary file
@@ -13,7 +13,7 @@ import { ALERT_TYPES } from "../../bootstrap/Alert";
13
13
  import { API_STATE } from "../../api/utils";
14
14
  import { formFieldsSize } from "../../bootstrap/constants";
15
15
  import { Spinner } from "../../bootstrap/Spinner";
16
- import { useAlert } from "../../alertContext/AlertContext";
16
+ import { useAlert } from "../../context/alertContext/AlertContext";
17
17
  import { useAPIPost } from "../../api/hooks";
18
18
 
19
19
  import { useForisModule, useForm } from "../hooks";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2019-2021 CZ.NIC z.s.p.o. (http://www.nic.cz/)
2
+ * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
3
3
  *
4
4
  * This is free software, licensed under the GNU General Public License v3.
5
5
  * See /LICENSE for more information.
@@ -90,4 +90,13 @@ export {
90
90
  } from "./utils/validations";
91
91
 
92
92
  // Alert context
93
- export { AlertContextProvider, useAlert } from "./alertContext/AlertContext";
93
+ export {
94
+ AlertContextProvider,
95
+ useAlert,
96
+ } from "./context/alertContext/AlertContext";
97
+
98
+ // Customization context
99
+ export {
100
+ CustomizationContextProvider,
101
+ useCustomizationContext,
102
+ } from "./context/customizationContext/CustomizationContext";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foris",
3
- "version": "5.5.0",
3
+ "version": "5.6.0-beta.9c3dcaf6",
4
4
  "description": "Foris JS library is a set of components and utils for reForis application and plugins.",
5
5
  "author": "CZ.NIC, z.s.p.o.",
6
6
  "repository": {
@@ -14,6 +14,7 @@ import { render } from "@testing-library/react";
14
14
  import PropTypes from "prop-types";
15
15
 
16
16
  import { AlertContextMock } from "./alertContextMock";
17
+ import { CustomizationContextMock } from "./cutomizationContextMock";
17
18
 
18
19
  Wrapper.propTypes = {
19
20
  children: PropTypes.oneOfType([
@@ -24,11 +25,13 @@ Wrapper.propTypes = {
24
25
 
25
26
  function Wrapper({ children }) {
26
27
  return (
27
- <AlertContextMock>
28
- <StaticRouter>
29
- <UIDReset>{children}</UIDReset>
30
- </StaticRouter>
31
- </AlertContextMock>
28
+ <CustomizationContextMock>
29
+ <AlertContextMock>
30
+ <StaticRouter>
31
+ <UIDReset>{children}</UIDReset>
32
+ </StaticRouter>
33
+ </AlertContextMock>
34
+ </CustomizationContextMock>
32
35
  );
33
36
  }
34
37
 
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
3
+ *
4
+ * This is free software, licensed under the GNU General Public License v3.
5
+ * See /LICENSE for more information.
6
+ */
7
+
8
+ import React from "react";
9
+
10
+ window.CustomizationContext = React.createContext();
11
+
12
+ const deviceDetails = {
13
+ kernel: "5.x.x",
14
+ model: "Turris Omnia",
15
+ os_branch: {
16
+ mode: "branch",
17
+ value: "hbs",
18
+ },
19
+ os_version: "6.x.x",
20
+ reforis_version: "1.x.x",
21
+ serial: 123456789,
22
+ };
23
+
24
+ const isCustomized = false;
25
+
26
+ function CustomizationContextMock({ children }) {
27
+ return (
28
+ <CustomizationContext.Provider value={{ deviceDetails, isCustomized }}>
29
+ {children}
30
+ </CustomizationContext.Provider>
31
+ );
32
+ }
33
+
34
+ export { CustomizationContextMock };
@@ -8,16 +8,17 @@ msgstr ""
8
8
  "Project-Id-Version: PROJECT VERSION\n"
9
9
  "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10
10
  "POT-Creation-Date: 2022-12-02 15:54+0100\n"
11
- "PO-Revision-Date: 2022-05-28 09:19+0000\n"
11
+ "PO-Revision-Date: 2022-12-07 12:47+0000\n"
12
12
  "Last-Translator: Алексей Леньшин <alenshin@gmail.com>\n"
13
+ "Language-Team: Russian <https://hosted.weblate.org/projects/turris/foris-js/"
14
+ "ru/>\n"
13
15
  "Language: ru\n"
14
- "Language-Team: Russian <https://hosted.weblate.org/projects/turris/foris-"
15
- "js/ru/>\n"
16
- "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
17
- "n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
18
16
  "MIME-Version: 1.0\n"
19
17
  "Content-Type: text/plain; charset=utf-8\n"
20
18
  "Content-Transfer-Encoding: 8bit\n"
19
+ "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
20
+ "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
21
+ "X-Generator: Weblate 4.15-dev\n"
21
22
  "Generated-By: Babel 2.11.0\n"
22
23
 
23
24
  #: src/api/utils.js:61
@@ -118,13 +119,15 @@ msgstr "Шифрование"
118
119
 
119
120
  #: src/common/WiFiSettings/WiFiForm.js:226
120
121
  msgid "Disable Management Frame Protection"
121
- msgstr ""
122
+ msgstr "Отключить защиту кадров управления"
122
123
 
123
124
  #: src/common/WiFiSettings/WiFiForm.js:227
124
125
  msgid ""
125
126
  "In case you have trouble connecting to WiFi Access Point, try disabling "
126
127
  "Management Frame Protection."
127
128
  msgstr ""
129
+ "Если у вас возникли проблемы с подключением к точке доступа Wi-Fi, "
130
+ "попробуйте отключить защиту кадров управления."
128
131
 
129
132
  #: src/common/WiFiSettings/WiFiForm.js:262
130
133
  msgid "auto"
@@ -381,4 +384,3 @@ msgstr "Не содержит списка электронных адресов
381
384
  #~ "конфигурации Wi-Fi и восстановлению "
382
385
  #~ "значений по умолчанию.\n"
383
386
  #~ " "
384
-
@@ -8,15 +8,16 @@ msgstr ""
8
8
  "Project-Id-Version: PROJECT VERSION\n"
9
9
  "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
10
10
  "POT-Creation-Date: 2022-12-02 15:54+0100\n"
11
- "PO-Revision-Date: 2022-05-30 06:14+0000\n"
11
+ "PO-Revision-Date: 2022-12-05 16:48+0000\n"
12
12
  "Last-Translator: Atec <dr.atec@gmail.com>\n"
13
+ "Language-Team: Slovak <https://hosted.weblate.org/projects/turris/foris-js/"
14
+ "sk/>\n"
13
15
  "Language: sk\n"
14
- "Language-Team: Slovak <https://hosted.weblate.org/projects/turris/foris-"
15
- "js/sk/>\n"
16
- "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
17
16
  "MIME-Version: 1.0\n"
18
17
  "Content-Type: text/plain; charset=utf-8\n"
19
18
  "Content-Transfer-Encoding: 8bit\n"
19
+ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
20
+ "X-Generator: Weblate 4.15-dev\n"
20
21
  "Generated-By: Babel 2.11.0\n"
21
22
 
22
23
  #: src/api/utils.js:61
@@ -117,13 +118,15 @@ msgstr "Šifrovanie"
117
118
 
118
119
  #: src/common/WiFiSettings/WiFiForm.js:226
119
120
  msgid "Disable Management Frame Protection"
120
- msgstr ""
121
+ msgstr "Zakázať Management Frame Protection"
121
122
 
122
123
  #: src/common/WiFiSettings/WiFiForm.js:227
123
124
  msgid ""
124
125
  "In case you have trouble connecting to WiFi Access Point, try disabling "
125
126
  "Management Frame Protection."
126
127
  msgstr ""
128
+ "Ak máte problémy s pripojením k prístupovému bodu WiFi, skúste zakázať "
129
+ "Management Frame Protection."
127
130
 
128
131
  #: src/common/WiFiSettings/WiFiForm.js:262
129
132
  msgid "auto"
@@ -377,4 +380,3 @@ msgstr "Neobsahuje zoznam e-mailov oddelených čiarkami."
377
380
  #~ "že sa tým odstráni aktuálna konfigurácia"
378
381
  #~ " a obnovia sa východiskové hodnoty.\n"
379
382
  #~ " "
380
-
@@ -36,5 +36,6 @@ export const ForisURLs = {
36
36
  luci: "/cgi-bin/luci",
37
37
 
38
38
  // API
39
+ about: `${REFORIS_API_URL_PREFIX}/about`,
39
40
  reboot: `${REFORIS_API_URL_PREFIX}/reboot`,
40
41
  };
package/foris-5.5.0.tgz DELETED
Binary file