Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 57 additions & 10 deletions MerlinAU.asp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down Expand Up @@ -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] **/
/**----------------------------------------**/
Expand Down
12 changes: 11 additions & 1 deletion MerlinAU.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix, with the "local" it didn't work correctly.

if [ "$currApprovalStatus" = "BLOCKED" ]
then
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "APPROVED"
Expand All @@ -10404,6 +10404,16 @@ then
Update_Custom_Settings "FW_New_Update_Changelog_Approval" "BLOCKED"
fi
;;
"${SCRIPT_NAME}blockchangelog")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Net-new logic for review.

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
Expand Down