diff --git a/web/js/react/src/ControlPanelService/Firewalls.js b/web/js/react/src/ControlPanelService/Firewalls.js index e882c67e1..3b2e003fd 100644 --- a/web/js/react/src/ControlPanelService/Firewalls.js +++ b/web/js/react/src/ControlPanelService/Firewalls.js @@ -17,16 +17,17 @@ export const getBanList = () => { return axios.get(BASE_URL + banListUri); } -export const bulkAction = (action, firewalls) => { +export const bulkAction = (action, ips, banIps) => { const formData = new FormData(); formData.append("action", action); formData.append("token", getAuthToken()); - firewalls.forEach(firewall => { - formData.append("rule[]", firewall); + ips.forEach(ip => { + const banIp = banIps.find(banIp => banIp.NAME === ip); + formData.append("ipchain[]", `${ip}:${banIp['CHAIN']}`); }); - return axios.post(BASE_URL + '/api/v1/bulk/firewall/', formData); + return axios.post(BASE_URL + '/api/v1/bulk/firewall/banlist/', formData); }; export const handleAction = uri => { @@ -54,11 +55,13 @@ export const getBanIps = data => { export const addBanIp = (data) => { let formDataObject = new FormData(); + formDataObject.append('token', getAuthToken()); + for (let key in data) { formDataObject.append(key, data[key]); } - return axios.get(BASE_URL + addBanIpsUri, { + return axios.post(BASE_URL + addBanIpsUri, formDataObject, { params: { token: getAuthToken() } diff --git a/web/js/react/src/ControlPanelService/Updates.js b/web/js/react/src/ControlPanelService/Updates.js index 334cf7d26..be5478e4c 100644 --- a/web/js/react/src/ControlPanelService/Updates.js +++ b/web/js/react/src/ControlPanelService/Updates.js @@ -1,8 +1,8 @@ import axios from "axios"; import { getAuthToken } from "src/utils/token"; -const deleteAutoUpdateUri = '/delete/cron/autoupdate/'; -const addAutoUpdateUri = '/add/cron/autoupdate/'; +const deleteAutoUpdateUri = '/api/v1/delete/cron/autoupdate/'; +const addAutoUpdateUri = '/api/v1/add/cron/autoupdate/'; const webApiUri = '/api/v1/list/updates/index.php'; const BASE_URL = window.location.origin; diff --git a/web/js/react/src/components/ControlPanel/AddItemLayout/AddItemLayout.scss b/web/js/react/src/components/ControlPanel/AddItemLayout/AddItemLayout.scss index b4c255476..e3b839798 100644 --- a/web/js/react/src/components/ControlPanel/AddItemLayout/AddItemLayout.scss +++ b/web/js/react/src/components/ControlPanel/AddItemLayout/AddItemLayout.scss @@ -207,7 +207,7 @@ $errorColor: #BE5ABF; label.label-wrapper { display: flex; align-items: flex-end; - width: fit-content; + width: max-content; span { font-weight: normal; diff --git a/web/js/react/src/components/Firewall/Add/AddFirewall.scss b/web/js/react/src/components/Firewall/Add/AddFirewall.scss index aff53e9fd..05d56dc08 100644 --- a/web/js/react/src/components/Firewall/Add/AddFirewall.scss +++ b/web/js/react/src/components/Firewall/Add/AddFirewall.scss @@ -1,6 +1,6 @@ .content .edit-template.add-firewall { .toolbar .search-toolbar-name { - width: fit-content; + width: max-content; } label.label-wrapper[for=ip] span { diff --git a/web/js/react/src/components/Firewall/Add/Banlist/index.jsx b/web/js/react/src/components/Firewall/Add/Banlist/index.jsx index 66d3d7136..35c75b2ce 100644 --- a/web/js/react/src/components/Firewall/Add/Banlist/index.jsx +++ b/web/js/react/src/components/Firewall/Add/Banlist/index.jsx @@ -43,15 +43,18 @@ const AddBanIP = () => { } if (Object.keys(newUser).length !== 0 && newUser.constructor === Object) { + setState({ ...state, loading: true }); addBanIp(newUser) .then(result => { if (result.status === 200) { const { error_msg, ok_msg } = result.data; if (error_msg) { - setState({ ...state, errorMessage: error_msg, okMessage: '' }); + setState({ ...state, errorMessage: error_msg, okMessage: '', loading: false }); } else if (ok_msg) { - setState({ ...state, errorMessage: '', okMessage: ok_msg }); + setState({ ...state, errorMessage: '', okMessage: ok_msg, loading: false }); + } else { + setState({ ...state, loading: false }); } } }) @@ -81,6 +84,8 @@ const AddBanIP = () => { {state.loading ? :
submitFormHandler(event)} id="add-user"> + +