Skip to content

Commit e7d4955

Browse files
Merge pull request #413 from ExtremeFiretop/ExtremeFiretop-Changelog_Approval
Fix WebUI Changelog Check Approval
2 parents 194f179 + dbf8463 commit e7d4955

File tree

2 files changed

+68
-11
lines changed

2 files changed

+68
-11
lines changed

MerlinAU.asp

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,20 +1229,51 @@ function InitializeFields()
12291229
// Always display the button
12301230
approveChangelogButton.style.display = 'inline-block';
12311231
1232-
// Condition: Enable button only if
1233-
// 1. Changelog Check is enabled
1234-
// 2. Changelog Approval is neither empty nor "TBD"
1235-
if (isChangelogCheckEnabled && changelogApprovalValue && changelogApprovalValue !== 'TBD')
1232+
// Decide whether we want "Approve" or "Block"
1233+
if (changelogApprovalValue === 'APPROVED')
12361234
{
1237-
approveChangelogButton.disabled = false; // Enable the button
1238-
approveChangelogButton.style.opacity = '1'; // Fully opaque
1239-
approveChangelogButton.style.cursor = 'pointer'; // Pointer cursor for enabled state
1235+
// Change button text to "Block Changelog"
1236+
approveChangelogButton.value = "Block Changelog";
1237+
1238+
// Make sure it calls a new function that sends a block command
1239+
approveChangelogButton.onclick = function() {
1240+
blockChangelog();
1241+
return false; // Prevent default form submission
1242+
};
1243+
1244+
approveChangelogButton.disabled = false;
1245+
approveChangelogButton.style.opacity = '1';
1246+
approveChangelogButton.style.cursor = 'pointer';
1247+
}
1248+
else if (changelogApprovalValue === 'BLOCKED')
1249+
{
1250+
// If it’s "BLOCKED", e.g. "Approve Changelog" again:
1251+
approveChangelogButton.value = "Approve Changelog";
1252+
approveChangelogButton.onclick = function() {
1253+
changelogApproval();
1254+
return false;
1255+
};
1256+
approveChangelogButton.disabled = false;
12401257
}
12411258
else
12421259
{
1243-
approveChangelogButton.disabled = true; // Disable the button
1244-
approveChangelogButton.style.opacity = '0.5'; // Grayed out appearance
1245-
approveChangelogButton.style.cursor = 'not-allowed'; // Indicate disabled state
1260+
approveChangelogButton.value = "Approve Changelog";
1261+
1262+
// Condition: Enable button only if
1263+
// 1. Changelog Check is enabled
1264+
// 2. Changelog Approval is neither empty nor "TBD"
1265+
if (isChangelogCheckEnabled && changelogApprovalValue && changelogApprovalValue !== 'TBD')
1266+
{
1267+
approveChangelogButton.disabled = false; // Enable the button
1268+
approveChangelogButton.style.opacity = '1'; // Fully opaque
1269+
approveChangelogButton.style.cursor = 'pointer'; // Pointer cursor for enabled state
1270+
}
1271+
else
1272+
{
1273+
approveChangelogButton.disabled = true; // Disable the button
1274+
approveChangelogButton.style.opacity = '0.5'; // Grayed out appearance
1275+
approveChangelogButton.style.cursor = 'not-allowed'; // Indicate disabled state
1276+
}
12461277
}
12471278
}
12481279
@@ -1778,6 +1809,22 @@ function changelogApproval()
17781809
document.form.submit();
17791810
}
17801811
1812+
function blockChangelog()
1813+
{
1814+
console.log("Blocking Changelog...");
1815+
1816+
if (!confirm("Are you sure you want to block this changelog?"))
1817+
{
1818+
return;
1819+
}
1820+
1821+
document.form.action_script.value = 'start_MerlinAUblockchangelog';
1822+
document.form.action_wait.value = 10;
1823+
1824+
showLoading();
1825+
document.form.submit();
1826+
}
1827+
17811828
/**----------------------------------------**/
17821829
/** Modified by Martinski W. [2025-Jan-22] **/
17831830
/**----------------------------------------**/

MerlinAU.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10395,7 +10395,7 @@ then
1039510395
sleep 1
1039610396
;;
1039710397
"${SCRIPT_NAME}approvechangelog")
10398-
local currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")"
10398+
currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")"
1039910399
if [ "$currApprovalStatus" = "BLOCKED" ]
1040010400
then
1040110401
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED"
@@ -10404,6 +10404,16 @@ then
1040410404
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "BLOCKED"
1040510405
fi
1040610406
;;
10407+
"${SCRIPT_NAME}blockchangelog")
10408+
currApprovalStatus="$(Get_Custom_Setting "FW_New_Update_Changelog_Approval")"
10409+
if [ "$currApprovalStatus" = "APPROVED" ]
10410+
then
10411+
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "BLOCKED"
10412+
elif [ "$currApprovalStatus" = "BLOCKED" ]
10413+
then
10414+
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED"
10415+
fi
10416+
;;
1040710417
"${SCRIPT_NAME}checkupdate" | \
1040810418
"${SCRIPT_NAME}checkupdate_bypassDays")
1040910419
if _AcquireLock_ cliFileLock

0 commit comments

Comments
 (0)