Skip to content

Commit 5987449

Browse files
virtual-servers-select-all-count
Signed-off-by: NAYANA.R <nayana.r7813@gmail.com>
1 parent cd241b2 commit 5987449

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

mcpgateway/static/admin.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9880,6 +9880,19 @@ function initToolSelect(
98809880
} else {
98819881
warnBox.textContent = "";
98829882
}
9883+
9884+
// Update the Select All button text to show count
9885+
// Re-query the button by ID to ensure we get the current button (not a stale reference)
9886+
if (selectBtnId) {
9887+
const currentSelectBtn = document.getElementById(selectBtnId);
9888+
if (currentSelectBtn) {
9889+
if (count > 0) {
9890+
currentSelectBtn.textContent = `Select All (${count})`;
9891+
} else {
9892+
currentSelectBtn.textContent = "Select All";
9893+
}
9894+
}
9895+
}
98839896
} catch (error) {
98849897
console.error("Error updating tool select:", error);
98859898
}
@@ -10010,16 +10023,11 @@ function initToolSelect(
1001010023
allToolIds.forEach((id) => editSel.add(String(id)));
1001110024

1001210025
update();
10013-
10014-
newSelectBtn.textContent = `✓ All ${allToolIds.length} tools selected`;
10015-
setTimeout(() => {
10016-
newSelectBtn.textContent = originalText;
10017-
}, 2000);
1001810026
} catch (error) {
1001910027
console.error("Error in Select All:", error);
1002010028
alert("Failed to select all tools. Please try again.");
1002110029
newSelectBtn.disabled = false;
10022-
newSelectBtn.textContent = originalText;
10030+
update(); // Reset button text via update()
1002310031
} finally {
1002410032
newSelectBtn.disabled = false;
1002510033
}

0 commit comments

Comments
 (0)