From 9b7d0d83b5a8d9de57cf84764dfc4fa39516437c Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Mon, 4 Sep 2023 21:14:03 -0400 Subject: [PATCH] Appease sonar --- app/frontend/static/assets/js/shared/root-dir.js | 6 ++---- app/frontend/templates/notify.html | 4 ++-- app/frontend/templates/panel/server_logs.html | 4 ++-- app/frontend/templates/panel/server_term.html | 5 ++--- app/frontend/templates/server/wizard.html | 13 ++++++------- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/frontend/static/assets/js/shared/root-dir.js b/app/frontend/static/assets/js/shared/root-dir.js index 7513b9b8..92ba6463 100644 --- a/app/frontend/static/assets/js/shared/root-dir.js +++ b/app/frontend/static/assets/js/shared/root-dir.js @@ -20,11 +20,9 @@ function getDirView(event = false) { console.log("Well that failed"); } } else if ($("#root_files_button").hasClass("clicked")) { - path = $("#zip_server_path").val(); - getTreeView(path, true); + getTreeView($("#zip_server_path").val(), true); } else { - path = $("#file-uploaded").val(); - getTreeView(path, true, true); + getTreeView($("#file-uploaded").val(), true, true); } } diff --git a/app/frontend/templates/notify.html b/app/frontend/templates/notify.html index 1f73f15b..98d366e7 100644 --- a/app/frontend/templates/notify.html +++ b/app/frontend/templates/notify.html @@ -98,8 +98,8 @@ function updateAnnouncements(data) { console.log(data) let text = ""; - for (let i = 0; i < data.length; i++) { - text += `
  • ${data[i].title}

    ${data[i].date}

    ${data[i].desc}

  • ` + for (let value of data) { + text += `
  • ${value.title}

    ${value.date}

    ${value.desc}

  • ` } if (data.length > 0) { localStorage.setItem("notif-count", data.length); diff --git a/app/frontend/templates/panel/server_logs.html b/app/frontend/templates/panel/server_logs.html index 3918f1d6..9a4033a1 100644 --- a/app/frontend/templates/panel/server_logs.html +++ b/app/frontend/templates/panel/server_logs.html @@ -201,8 +201,8 @@ let responseData = await res.json(); let html = `` if (responseData.status === "ok") { - for (let i = 0; i < responseData.data.length; i++) { - html += `${responseData.data[i]}
    ` + for (let value of responseData.data) { + html += `${value}
    ` } console.log('Got Log From Server') $('#virt_console').html(html); diff --git a/app/frontend/templates/panel/server_term.html b/app/frontend/templates/panel/server_term.html index 804c09dd..bb63fbe7 100644 --- a/app/frontend/templates/panel/server_term.html +++ b/app/frontend/templates/panel/server_term.html @@ -240,8 +240,8 @@ let responseData = await res.json(); let html = `` if (responseData.status === "ok") { - for (let i = 0; i < responseData.data.length; i++) { - html += `${responseData.data[i]}
    ` + for (let value of responseData.data) { + html += `${value}
    ` } console.log('Got Log From Server') $('#virt_console').html(html); @@ -385,7 +385,6 @@ } $(document).ready(() => { - let scrolled = false; $('#virt_console').on('scroll', chkScroll); $('#to-bottom').on('click', scrollToBottom) }); diff --git a/app/frontend/templates/server/wizard.html b/app/frontend/templates/server/wizard.html index 1c37a2fe..663fbafc 100644 --- a/app/frontend/templates/server/wizard.html +++ b/app/frontend/templates/server/wizard.html @@ -890,7 +890,6 @@ window.location.reload(); } }); - let doUpload = false; } }, false); xmlHttpRequest.addEventListener('error', (e) => { @@ -1198,7 +1197,7 @@ let idx = document.getElementById('server_type').selectedIndex; // get the value of the selected option let cSelect = document.getElementById("server"); - let which; + let which = {}; try { which = document.getElementById('server_type').options[idx].value; } catch { @@ -1234,10 +1233,10 @@ } function serverJarChange(selectObj) { - let type_select = document.getElementById('server_jar') - let tidx = type_select.selectedIndex; - let val = type_select.options[tidx].value; - let jcSelect = ""; + const type_select = document.getElementById('server_jar') + const tidx = type_select.selectedIndex; + const val = type_select.options[tidx].value; + let jcSelect = {}; if (val == 'None') { jcSelect = document.getElementById("server_type"); while (jcSelect.options.length > 0) { @@ -1251,7 +1250,7 @@ // get the value of the selected option let jwhich = selectObj.options[jidx].value; // use the selected option value to retrieve the list of items from the serverTypesLists array - jcList = Object.keys(serverTypesLists[jwhich]); + let jcList = Object.keys(serverTypesLists[jwhich]); // get the country select element via its known id jcSelect = document.getElementById("server_type"); // remove the current options from the country select