From f3bbbeea3f2a02b8f117e486e9a2f4e66667a7c4 Mon Sep 17 00:00:00 2001 From: Joel Samson Date: Thu, 20 Feb 2025 23:32:16 -0500 Subject: [PATCH 1/2] Fix WebUI Changelog Check Approval Fix WebUI Changelog Check Approval --- MerlinAU.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MerlinAU.sh b/MerlinAU.sh index b7ea2c9c..b760d939 100644 --- a/MerlinAU.sh +++ b/MerlinAU.sh @@ -10395,7 +10395,7 @@ then sleep 1 ;; "${SCRIPT_NAME}approvechangelog") - local currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")" + currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")" if [ "$currApprovalStatus" = "BLOCKED" ] then Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED" @@ -10404,6 +10404,16 @@ then Update_Custom_Settings "FW_New_Update_Changelog_Approval" "BLOCKED" fi ;; + "${SCRIPT_NAME}blockchangelog") + currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")" + if [ "$currApprovalStatus" = "APPROVED" ] + then + Update_Custom_Settings "FW_New_Update_Changelog_Approval" "BLOCKED" + elif [ "$currApprovalStatus" = "BLOCKED" ] + then + Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED" + fi + ;; "${SCRIPT_NAME}checkupdate" | \ "${SCRIPT_NAME}checkupdate_bypassDays") if _AcquireLock_ cliFileLock From dbf8463706c7cac1a09badbb1122be535d1c449c Mon Sep 17 00:00:00 2001 From: Joel Samson Date: Thu, 20 Feb 2025 23:36:04 -0500 Subject: [PATCH 2/2] Update MerlinAU.asp --- MerlinAU.asp | 67 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/MerlinAU.asp b/MerlinAU.asp index fd93d363..448fb31a 100644 --- a/MerlinAU.asp +++ b/MerlinAU.asp @@ -1229,20 +1229,51 @@ function InitializeFields() // Always display the button approveChangelogButton.style.display = 'inline-block'; - // Condition: Enable button only if - // 1. Changelog Check is enabled - // 2. Changelog Approval is neither empty nor "TBD" - if (isChangelogCheckEnabled && changelogApprovalValue && changelogApprovalValue !== 'TBD') + // Decide whether we want "Approve" or "Block" + if (changelogApprovalValue === 'APPROVED') { - approveChangelogButton.disabled = false; // Enable the button - approveChangelogButton.style.opacity = '1'; // Fully opaque - approveChangelogButton.style.cursor = 'pointer'; // Pointer cursor for enabled state + // Change button text to "Block Changelog" + approveChangelogButton.value = "Block Changelog"; + + // Make sure it calls a new function that sends a block command + approveChangelogButton.onclick = function() { + blockChangelog(); + return false; // Prevent default form submission + }; + + approveChangelogButton.disabled = false; + approveChangelogButton.style.opacity = '1'; + approveChangelogButton.style.cursor = 'pointer'; + } + else if (changelogApprovalValue === 'BLOCKED') + { + // If it’s "BLOCKED", e.g. "Approve Changelog" again: + approveChangelogButton.value = "Approve Changelog"; + approveChangelogButton.onclick = function() { + changelogApproval(); + return false; + }; + approveChangelogButton.disabled = false; } else { - approveChangelogButton.disabled = true; // Disable the button - approveChangelogButton.style.opacity = '0.5'; // Grayed out appearance - approveChangelogButton.style.cursor = 'not-allowed'; // Indicate disabled state + approveChangelogButton.value = "Approve Changelog"; + + // Condition: Enable button only if + // 1. Changelog Check is enabled + // 2. Changelog Approval is neither empty nor "TBD" + if (isChangelogCheckEnabled && changelogApprovalValue && changelogApprovalValue !== 'TBD') + { + approveChangelogButton.disabled = false; // Enable the button + approveChangelogButton.style.opacity = '1'; // Fully opaque + approveChangelogButton.style.cursor = 'pointer'; // Pointer cursor for enabled state + } + else + { + approveChangelogButton.disabled = true; // Disable the button + approveChangelogButton.style.opacity = '0.5'; // Grayed out appearance + approveChangelogButton.style.cursor = 'not-allowed'; // Indicate disabled state + } } } @@ -1778,6 +1809,22 @@ function changelogApproval() document.form.submit(); } +function blockChangelog() +{ + console.log("Blocking Changelog..."); + + if (!confirm("Are you sure you want to block this changelog?")) + { + return; + } + + document.form.action_script.value = 'start_MerlinAUblockchangelog'; + document.form.action_wait.value = 10; + + showLoading(); + document.form.submit(); +} + /**----------------------------------------**/ /** Modified by Martinski W. [2025-Jan-22] **/ /**----------------------------------------**/