foris 6.4.0 → 6.5.0-beta.a63b5bfa

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.
Files changed (39) hide show
  1. package/bootstrap/Modal.js +10 -7
  2. package/common/ActionButtonWithModal/ActionButtonWithModal.js +135 -0
  3. package/common/ActionButtonWithModal/ActionButtonWithModal.md +39 -0
  4. package/common/RichTable/RichTable.js +86 -0
  5. package/common/RichTable/RichTable.md +135 -0
  6. package/common/RichTable/RichTableBody.js +48 -0
  7. package/common/RichTable/RichTableHeader.js +96 -0
  8. package/common/RichTable/RichTablePagination.js +128 -0
  9. package/foris-6.5.0.tgz +0 -0
  10. package/index.js +2 -1
  11. package/package.json +2 -1
  12. package/testUtils/customTestRender.js +1 -1
  13. package/translations/cs/LC_MESSAGES/forisjs.po +79 -21
  14. package/translations/da/LC_MESSAGES/forisjs.po +75 -16
  15. package/translations/de/LC_MESSAGES/forisjs.po +79 -21
  16. package/translations/el/LC_MESSAGES/forisjs.po +76 -19
  17. package/translations/en/LC_MESSAGES/forisjs.po +75 -16
  18. package/translations/es/LC_MESSAGES/forisjs.po +79 -21
  19. package/translations/fi/LC_MESSAGES/forisjs.po +75 -16
  20. package/translations/fo/LC_MESSAGES/forisjs.po +75 -16
  21. package/translations/forisjs.pot +61 -17
  22. package/translations/fr/LC_MESSAGES/forisjs.po +79 -21
  23. package/translations/hr/LC_MESSAGES/forisjs.po +75 -16
  24. package/translations/hu/LC_MESSAGES/forisjs.po +76 -16
  25. package/translations/it/LC_MESSAGES/forisjs.po +75 -16
  26. package/translations/ja/LC_MESSAGES/forisjs.po +76 -17
  27. package/translations/ko/LC_MESSAGES/forisjs.po +75 -16
  28. package/translations/lt/LC_MESSAGES/forisjs.po +75 -16
  29. package/translations/nb_NO/LC_MESSAGES/forisjs.po +78 -21
  30. package/translations/nl/LC_MESSAGES/forisjs.po +78 -22
  31. package/translations/pl/LC_MESSAGES/forisjs.po +79 -21
  32. package/translations/pt_BR/LC_MESSAGES/forisjs.po +77 -20
  33. package/translations/ro/LC_MESSAGES/forisjs.po +75 -16
  34. package/translations/ru/LC_MESSAGES/forisjs.po +79 -21
  35. package/translations/sk/LC_MESSAGES/forisjs.po +79 -21
  36. package/translations/sv/LC_MESSAGES/forisjs.po +78 -21
  37. package/common/RebootButton.js +0 -80
  38. package/foris-6.4.0.tgz +0 -0
  39. /package/testUtils/{cutomizationContextMock.js → customizationContextMock.js} +0 -0
@@ -1,80 +0,0 @@
1
- /*
2
- * Copyright (C) 2019-2024 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, { useState, useEffect } from "react";
9
-
10
- import PropTypes from "prop-types";
11
-
12
- import { useAPIPost } from "../api/hooks";
13
- import { API_STATE } from "../api/utils";
14
- import Button from "../bootstrap/Button";
15
- import { Modal, ModalHeader, ModalBody, ModalFooter } from "../bootstrap/Modal";
16
- import { useAlert } from "../context/alertContext/AlertContext";
17
- import { ForisURLs } from "../utils/forisUrls";
18
-
19
- function RebootButton(props) {
20
- const [triggered, setTriggered] = useState(false);
21
- const [modalShown, setModalShown] = useState(false);
22
- const [triggerRebootStatus, triggerReboot] = useAPIPost(ForisURLs.reboot);
23
-
24
- const [setAlert] = useAlert();
25
- useEffect(() => {
26
- if (triggerRebootStatus.state === API_STATE.ERROR) {
27
- setAlert(_("Reboot request failed."));
28
- }
29
- });
30
-
31
- const rebootHandler = () => {
32
- setTriggered(true);
33
- triggerReboot();
34
- setModalShown(false);
35
- };
36
-
37
- return (
38
- <>
39
- <RebootModal
40
- shown={modalShown}
41
- setShown={setModalShown}
42
- onReboot={rebootHandler}
43
- />
44
- <Button
45
- className="btn-danger"
46
- loading={triggered}
47
- disabled={triggered}
48
- onClick={() => setModalShown(true)}
49
- {...props}
50
- >
51
- {_("Reboot")}
52
- </Button>
53
- </>
54
- );
55
- }
56
-
57
- RebootModal.propTypes = {
58
- shown: PropTypes.bool.isRequired,
59
- setShown: PropTypes.func.isRequired,
60
- onReboot: PropTypes.func.isRequired,
61
- };
62
-
63
- function RebootModal({ shown, setShown, onReboot }) {
64
- return (
65
- <Modal shown={shown} setShown={setShown}>
66
- <ModalHeader setShown={setShown} title={_("Warning!")} />
67
- <ModalBody>
68
- <p>{_("Are you sure you want to restart the router?")}</p>
69
- </ModalBody>
70
- <ModalFooter>
71
- <Button onClick={() => setShown(false)}>{_("Cancel")}</Button>
72
- <Button className="btn-danger" onClick={onReboot}>
73
- {_("Confirm reboot")}
74
- </Button>
75
- </ModalFooter>
76
- </Modal>
77
- );
78
- }
79
-
80
- export default RebootButton;
package/foris-6.4.0.tgz DELETED
Binary file