Skip to content

Commit 7fbe33f

Browse files
authored
Improve error logging and enhance save button method
Refactor error handling and update save button content method documentation.
1 parent 611df72 commit 7fbe33f

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

config/var/www/admin/control-panel/external-services/external-services.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export class ExternalServicesManager {
6161
this.maxConcurrentRequests = 6;
6262
this.activeRequests = 0;
6363
this.requestQueue = [];
64+
this.inFlightRequests = {};
6465

6566
// Notification timing configuration
6667
this.notificationDurationMs = DEFAULT_NOTIFICATION_DURATION_MS;
@@ -579,7 +580,7 @@ export class ExternalServicesManager {
579580
const areAllCategoryServicesEnabled = () => categoryCheckboxes.every(cb => cb.checked);
580581
const toggleTextEl = toggleBtn.querySelector(".toggle-all-text");
581582
if (!toggleTextEl) {
582-
console.error(`Settings UI component missing for category: ${category}. Skipping toggle-all wiring for this category section.`);
583+
console.error(`Toggle button text element (.toggle-all-text) not found for category: ${category}. This indicates a UI rendering issue. Please check the createSettingsCategoryHeader method.`);
583584
return categorySection;
584585
}
585586
const updateToggleButtonState = () => {
@@ -722,10 +723,14 @@ export class ExternalServicesManager {
722723
}
723724

724725
/**
725-
* Update save button icon + text consistently.
726-
* @param {HTMLElement} saveButton - Save button element
727-
* @param {string} iconClass - Icon class to apply
728-
* @param {string} text - Button label text
726+
* Updates the save button's rendered content by replacing both its icon and label text.
727+
* Use this method for non-default/transient UI states (for example: saving, saved, or error feedback)
728+
* when the button should communicate progress or result to the user.
729+
* Use `resetSaveButtonContent` when returning the button to its default idle "Save Changes" state.
730+
*
731+
* @param {HTMLElement} saveButton - Save button element to update.
732+
* @param {string} iconClass - Full icon class string to apply to the `<i>` element (for example, "fas fa-save").
733+
* @param {string} text - Visible button label text to render after the icon.
729734
*/
730735
setSaveButtonContent(saveButton, iconClass, text) {
731736
saveButton.textContent = "";
@@ -1079,9 +1084,6 @@ export class ExternalServicesManager {
10791084
* @param {Function} requestFn - Async function that performs the actual request
10801085
* @returns {Promise} Resolves when request completes
10811086
*/
1082-
// NOTE: constructor initializes all stateful request-management fields, including:
1083-
// this.inFlightRequests = {};
1084-
// Constructor must include: this.inFlightRequests = {};
10851087
async queueRequest(requestFn) {
10861088
return new Promise((resolve, reject) => {
10871089
const executeRequest = async () => {

0 commit comments

Comments
 (0)