From 157f0d61c3a1a7dd0de8071a46ec1a2715ed70ac Mon Sep 17 00:00:00 2001 From: Russel Yasol Date: Sun, 14 Jul 2024 10:26:54 +0800 Subject: [PATCH] added various fixes for simple network --- simpleadmin/www/js/parse-settings.js | 18 +++++- simpleadmin/www/js/populate-checkbox.js | 8 ++- simpleadmin/www/network.html | 83 ++++++++++++++++++++----- 3 files changed, 87 insertions(+), 22 deletions(-) diff --git a/simpleadmin/www/js/parse-settings.js b/simpleadmin/www/js/parse-settings.js index 1262349..56b4d1a 100644 --- a/simpleadmin/www/js/parse-settings.js +++ b/simpleadmin/www/js/parse-settings.js @@ -16,7 +16,7 @@ function parseCurrentSettings(rawdata) { try { this.apn = lines - .find((line) => line.includes("+CGCONTRDP: 1,0")) + .find((line) => line.includes("+CGCONTRDP: 1")) .split(",")[2] .replace(/\"/g, ""); } catch (error) { @@ -49,10 +49,22 @@ function parseCurrentSettings(rawdata) { .replace(/\"/g, ""); try { - this.bands = lines - .find((line) => line.includes("+QCAINFO:")) + const PCCbands = lines + .find((line) => line.includes('+QCAINFO: "PCC"')) .split(",")[3] .replace(/\"/g, ""); + + // Loop over all QCAINFO: "SCC" lines and get the bands + try { + const SCCbands = lines + .filter((line) => line.includes('+QCAINFO: "SCC"')) + .map((line) => line.split(",")[3].replace(/\"/g, "")) + .join(", "); + this.bands = `${PCCbands}, ${SCCbands}`; + } catch (error) { + this.bands = PCCbands; + } + } catch (error) { this.bands = "Failed fetching bands"; } diff --git a/simpleadmin/www/js/populate-checkbox.js b/simpleadmin/www/js/populate-checkbox.js index 702fe32..93efa1c 100644 --- a/simpleadmin/www/js/populate-checkbox.js +++ b/simpleadmin/www/js/populate-checkbox.js @@ -15,7 +15,7 @@ function populateCheckboxes(lte_band, nsa_nr5g_band, nr5g_band, locked_lte_bands checkboxesForm.innerHTML = ""; // Clear existing checkboxes var bandsArray; - if (bands !== null) { + if (bands !== null && bands !== "0") { bandsArray = bands.split(":"); bandsArray.forEach(function(band, index) { if (index % 5 === 0) { @@ -68,7 +68,11 @@ function populateCheckboxes(lte_band, nsa_nr5g_band, nr5g_band, locked_lte_bands currentRow.appendChild(checkboxDiv); }); } else { - // Do nothing + // Create a text saying that no bands are available + var noBandsText = document.createElement("p"); + noBandsText.className = "text-center"; + noBandsText.innerText = "No supported bands available"; + checkboxesForm.appendChild(noBandsText); } var currentRow; diff --git a/simpleadmin/www/network.html b/simpleadmin/www/network.html index 714c75d..871afac 100644 --- a/simpleadmin/www/network.html +++ b/simpleadmin/www/network.html @@ -132,6 +132,18 @@ Reset +
+ + +