servers parameters update

This commit is contained in:
Ivan 2023-09-30 01:19:10 +03:00
parent 33668b7906
commit f5f0171a6c
Signed by untrusted user who does not match committer: ppechenkoo
GPG Key ID: 0C191B86D9582583
4 changed files with 22 additions and 7 deletions

View File

@ -2802,12 +2802,14 @@ app.put('/install-parameters', async (req, res) => {
const { serial } = req.query; const { serial } = req.query;
const { const {
SP SP,
M
} = requestData; } = requestData;
const requestBody = { const requestBody = {
"MCMS": { "MCMS": {
"M": parseInt(M, 10),
"SP": SP "SP": SP
} }
}; };

View File

@ -268,12 +268,16 @@ for (let radioButton of radioButtons) {
console.log(data.DATA); console.log(data.DATA);
console.log(decodeCHValue(data.DATA.MCMS.M)); const decodedValues = decodeCHValue(data.DATA.MCMS.M);
console.log(decodedValues);
clearServerContainer(); clearServerContainer();
data.DATA.MCMS.SP.forEach((data) => { decodedValues.forEach((value, index) => {
addServer(data); const dataIndex = value - 1;
if (data.DATA.MCMS.SP[dataIndex]) {
addServer(data.DATA.MCMS.SP[dataIndex]);
}
}); });
$("select").trigger("input"); $("select").trigger("input");

View File

@ -162,7 +162,6 @@
</section> </section>
<img src="../img/xmark.svg" id="close-form-btn">
<form id="edit-form" enctype="multipart/form-data" method="post" action="/updatedevice"> <form id="edit-form" enctype="multipart/form-data" method="post" action="/updatedevice">
<div id="details" class="new-parameters active"> <div id="details" class="new-parameters active">

View File

@ -1302,6 +1302,14 @@ const requestBody = {
if (type === 'install') { if (type === 'install') {
var serverContainer = document.getElementById('server-container');
var servers = serverContainer.getElementsByClassName('server');
var serverNumbersArray = Array.from({ length: servers.length }, (_, index) => index + 1);
const M = encodeCHValue(serverNumbersArray);
const deleteConfirmation = document.getElementById("addInformation"); const deleteConfirmation = document.getElementById("addInformation");
const loader = document.getElementById("loader"); const loader = document.getElementById("loader");
const status = document.getElementById("status"); const status = document.getElementById("status");
@ -1316,12 +1324,14 @@ const requestBody = {
saveData(); saveData();
const SP = serverData; const SP = serverData;
console.log(SP);
const requestData = { const requestData = {
SP SP,
M
}; };
console.log(requestData);
try { try {
const response = await fetch(`/install-parameters?serial=${serial}`, { const response = await fetch(`/install-parameters?serial=${serial}`, {
method: 'PUT', method: 'PUT',