diff --git a/server.js b/server.js index 67e6316..aeb8b33 100644 --- a/server.js +++ b/server.js @@ -2802,12 +2802,14 @@ app.put('/install-parameters', async (req, res) => { const { serial } = req.query; const { - SP + SP, + M } = requestData; const requestBody = { "MCMS": { + "M": parseInt(M, 10), "SP": SP } }; diff --git a/static/scripts/parameters-form.js b/static/scripts/parameters-form.js index afcd92f..88de46f 100644 --- a/static/scripts/parameters-form.js +++ b/static/scripts/parameters-form.js @@ -268,12 +268,16 @@ for (let radioButton of radioButtons) { console.log(data.DATA); - console.log(decodeCHValue(data.DATA.MCMS.M)); + const decodedValues = decodeCHValue(data.DATA.MCMS.M); + console.log(decodedValues); clearServerContainer(); - data.DATA.MCMS.SP.forEach((data) => { - addServer(data); + decodedValues.forEach((value, index) => { + const dataIndex = value - 1; + if (data.DATA.MCMS.SP[dataIndex]) { + addServer(data.DATA.MCMS.SP[dataIndex]); + } }); $("select").trigger("input"); diff --git a/static/templates/devices/device.html b/static/templates/devices/device.html index 4c83568..5b39d6e 100644 --- a/static/templates/devices/device.html +++ b/static/templates/devices/device.html @@ -162,7 +162,6 @@ -
diff --git a/static/templates/devices/system.html b/static/templates/devices/system.html index 578f51a..2f898b3 100644 --- a/static/templates/devices/system.html +++ b/static/templates/devices/system.html @@ -1302,6 +1302,14 @@ const requestBody = { 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 loader = document.getElementById("loader"); const status = document.getElementById("status"); @@ -1316,12 +1324,14 @@ const requestBody = { saveData(); const SP = serverData; - console.log(SP); const requestData = { - SP + SP, + M }; + console.log(requestData); + try { const response = await fetch(`/install-parameters?serial=${serial}`, { method: 'PUT',