mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Compare commits
10 Commits
0a839bf369
...
v6.7.0
Author | SHA1 | Date | |
---|---|---|---|
227a975e5f | |||
819e5a1dd2 | |||
6432073d62 | |||
94f436008d | |||
6f9e44a7b1 | |||
13ca745412 | |||
a25133d786 | |||
ede4fb0212 | |||
7197813cc9 | |||
2f249ce3dc |
17
CHANGELOG.md
17
CHANGELOG.md
@ -8,6 +8,20 @@ and this project adheres to
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [6.7.0] - 2025-03-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added encryption property to guest WiFi settings in tests
|
||||||
|
- Added global fuzzy search and columns visibility to RichTable
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Made thead of RichTable lighter
|
||||||
|
- Updated dependencies in package.json to latest versions
|
||||||
|
- Enhanced ActionButtonWithModal to support dynamic methods
|
||||||
|
- NPM audit fix
|
||||||
|
|
||||||
## [6.6.2] - 2025-02-20
|
## [6.6.2] - 2025-02-20
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@ -448,7 +462,8 @@ and this project adheres to
|
|||||||
## [0.0.7] - 2019-09-02
|
## [0.0.7] - 2019-09-02
|
||||||
|
|
||||||
[unreleased]:
|
[unreleased]:
|
||||||
https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.2...dev
|
https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.7.0...dev
|
||||||
|
[6.7.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.2...v6.7.0
|
||||||
[6.6.2]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.1...v6.6.2
|
[6.6.2]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.1...v6.6.2
|
||||||
[6.6.1]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.0...v6.6.1
|
[6.6.1]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.6.0...v6.6.1
|
||||||
[6.6.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.5.0...v6.6.0
|
[6.6.0]: https://gitlab.nic.cz/turris/reforis/foris-js/-/compare/v6.5.0...v6.6.0
|
||||||
|
2064
package-lock.json
generated
2064
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "6.6.2",
|
"version": "6.7.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": {
|
||||||
@ -46,13 +46,13 @@
|
|||||||
"bootstrap": "^5.3.3",
|
"bootstrap": "^5.3.3",
|
||||||
"css-loader": "^7.1.2",
|
"css-loader": "^7.1.2",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-reforis": "^2.1.1",
|
"eslint-config-reforis": "^2.2.1",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.0.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
"jest-mock-axios": "^4.8.0",
|
"jest-mock-axios": "^4.8.0",
|
||||||
"moment-timezone": "^0.5.47",
|
"moment-timezone": "^0.5.47",
|
||||||
"prettier": "^3.5.2",
|
"prettier": "^3.5.3",
|
||||||
"prop-types": "15.8.1",
|
"prop-types": "15.8.1",
|
||||||
"react": "16.9.0",
|
"react": "16.9.0",
|
||||||
"react-dom": "16.9.0",
|
"react-dom": "16.9.0",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2024 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
* Copyright (C) 2019-2025 CZ.NIC z.s.p.o. (https://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.
|
||||||
@ -9,7 +9,7 @@ import React, { useState, useEffect } from "react";
|
|||||||
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { useAPIPost } from "../../api/hooks";
|
import { useAPIPost, useAPIPut } from "../../api/hooks";
|
||||||
import { API_STATE } from "../../api/utils";
|
import { API_STATE } from "../../api/utils";
|
||||||
import Button from "../../bootstrap/Button";
|
import Button from "../../bootstrap/Button";
|
||||||
import {
|
import {
|
||||||
@ -23,6 +23,8 @@ import { useAlert } from "../../context/alertContext/AlertContext";
|
|||||||
ActionButtonWithModal.propTypes = {
|
ActionButtonWithModal.propTypes = {
|
||||||
/** Component that triggers the action. */
|
/** Component that triggers the action. */
|
||||||
actionTrigger: PropTypes.elementType.isRequired,
|
actionTrigger: PropTypes.elementType.isRequired,
|
||||||
|
/** Method to use for the action. */
|
||||||
|
actionMethod: PropTypes.string,
|
||||||
/** URL to send the action to. */
|
/** URL to send the action to. */
|
||||||
actionUrl: PropTypes.string.isRequired,
|
actionUrl: PropTypes.string.isRequired,
|
||||||
/** Title of the modal. */
|
/** Title of the modal. */
|
||||||
@ -41,6 +43,7 @@ ActionButtonWithModal.propTypes = {
|
|||||||
|
|
||||||
function ActionButtonWithModal({
|
function ActionButtonWithModal({
|
||||||
actionTrigger: ActionTriggerComponent,
|
actionTrigger: ActionTriggerComponent,
|
||||||
|
actionMethod = "POST",
|
||||||
actionUrl,
|
actionUrl,
|
||||||
modalTitle,
|
modalTitle,
|
||||||
modalMessage,
|
modalMessage,
|
||||||
@ -51,24 +54,43 @@ function ActionButtonWithModal({
|
|||||||
}) {
|
}) {
|
||||||
const [triggered, setTriggered] = useState(false);
|
const [triggered, setTriggered] = useState(false);
|
||||||
const [modalShown, setModalShown] = useState(false);
|
const [modalShown, setModalShown] = useState(false);
|
||||||
const [triggerActionStatus, triggerAction] = useAPIPost(actionUrl);
|
const [triggerPostActionStatus, triggerPostAction] = useAPIPost(actionUrl);
|
||||||
|
const [triggerPutActionStatus, triggerPutAction] = useAPIPut(actionUrl);
|
||||||
|
|
||||||
const [setAlert] = useAlert();
|
const [setAlert] = useAlert();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (triggerActionStatus.state === API_STATE.SUCCESS) {
|
if (
|
||||||
|
triggerPostActionStatus.state === API_STATE.SUCCESS ||
|
||||||
|
triggerPutActionStatus.state === API_STATE.SUCCESS
|
||||||
|
) {
|
||||||
setAlert(
|
setAlert(
|
||||||
successMessage || _("Action successful."),
|
successMessage || _("Action successful."),
|
||||||
API_STATE.SUCCESS
|
API_STATE.SUCCESS
|
||||||
);
|
);
|
||||||
|
setTriggered(false);
|
||||||
}
|
}
|
||||||
if (triggerActionStatus.state === API_STATE.ERROR) {
|
if (
|
||||||
|
triggerPostActionStatus.state === API_STATE.ERROR ||
|
||||||
|
triggerPutActionStatus.state === API_STATE.ERROR
|
||||||
|
) {
|
||||||
setAlert(errorMessage || _("Action failed."));
|
setAlert(errorMessage || _("Action failed."));
|
||||||
|
setTriggered(false);
|
||||||
}
|
}
|
||||||
}, [triggerActionStatus, setAlert, successMessage, errorMessage]);
|
}, [
|
||||||
|
triggerPostActionStatus,
|
||||||
|
triggerPutActionStatus,
|
||||||
|
setAlert,
|
||||||
|
successMessage,
|
||||||
|
errorMessage,
|
||||||
|
]);
|
||||||
|
|
||||||
const actionHandler = () => {
|
const actionHandler = () => {
|
||||||
setTriggered(true);
|
setTriggered(true);
|
||||||
triggerAction();
|
if (actionMethod === "POST") {
|
||||||
|
triggerPostAction();
|
||||||
|
} else {
|
||||||
|
triggerPutAction();
|
||||||
|
}
|
||||||
setModalShown(false);
|
setModalShown(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user