cleanup: wrap console.log calls behind window.DASHCADDY_DEBUG flag
Wrapped 22 console.log calls across 6 files with a debug() helper that only logs when window.DASHCADDY_DEBUG is true in the browser console. Files: - tour-manager.js: 10 calls - theme-adapter.js: 4 calls - keyboard-shortcuts.js: 4 calls - tooltip-definitions.js: 2 calls - progress-tracker.js: 1 call - live-events.js: 1 call console.error and console.warn calls preserved — those indicate real issues worth seeing in production.
This commit is contained in:
@@ -6,6 +6,10 @@
|
|||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const debug = (...args) => {
|
||||||
|
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||||
|
};
|
||||||
|
|
||||||
// All modal selectors that can be closed with Escape
|
// All modal selectors that can be closed with Escape
|
||||||
const MODAL_SELECTORS = [
|
const MODAL_SELECTORS = [
|
||||||
'#app-selector-modal',
|
'#app-selector-modal',
|
||||||
@@ -39,9 +43,9 @@
|
|||||||
// Add global keyboard listener
|
// Add global keyboard listener
|
||||||
document.addEventListener('keydown', handleKeyDown);
|
document.addEventListener('keydown', handleKeyDown);
|
||||||
|
|
||||||
console.log('[Keyboard Shortcuts] Initialized');
|
debug('[Keyboard Shortcuts] Initialized');
|
||||||
console.log('[Keyboard Shortcuts] Press Ctrl+K to open quick search');
|
debug('[Keyboard Shortcuts] Press Ctrl+K to open quick search');
|
||||||
console.log('[Keyboard Shortcuts] Press Escape to close modals');
|
debug('[Keyboard Shortcuts] Press Escape to close modals');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Keyboard Shortcuts] Failed to initialize:', e.message);
|
console.warn('[Keyboard Shortcuts] Failed to initialize:', e.message);
|
||||||
}
|
}
|
||||||
@@ -599,7 +603,7 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('[Keyboard Shortcuts] Unknown action:', action);
|
debug('[Keyboard Shortcuts] Unknown action:', action);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Keyboard Shortcuts] Error executing action:', e.message);
|
console.warn('[Keyboard Shortcuts] Error executing action:', e.message);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
es.addEventListener('connected', () => {
|
es.addEventListener('connected', () => {
|
||||||
reconnectDelay = 1000; // reset backoff
|
reconnectDelay = 1000; // reset backoff
|
||||||
console.log('[SSE] Connected to event stream');
|
debug('[SSE] Connected to event stream');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Health status changes → update card dots/badges in real time
|
// Health status changes → update card dots/badges in real time
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
(function(window) {
|
(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const debug = (...args) => {
|
||||||
|
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProgressTracker class
|
* ProgressTracker class
|
||||||
* Manages persistent storage of onboarding progress
|
* Manages persistent storage of onboarding progress
|
||||||
@@ -308,6 +312,6 @@
|
|||||||
// Export to global scope
|
// Export to global scope
|
||||||
window.ProgressTracker = ProgressTracker;
|
window.ProgressTracker = ProgressTracker;
|
||||||
|
|
||||||
console.log('[ProgressTracker] Module loaded');
|
debug('[ProgressTracker] Module loaded');
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
(function(window) {
|
(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const debug = (...args) => {
|
||||||
|
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme configuration mapping for Driver.js
|
* Theme configuration mapping for Driver.js
|
||||||
* Maps dashboard themes to Driver.js styling
|
* Maps dashboard themes to Driver.js styling
|
||||||
@@ -170,7 +174,7 @@
|
|||||||
attributeFilter: ['class']
|
attributeFilter: ['class']
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('[ThemeAdapter] Theme change listener initialized');
|
debug('[ThemeAdapter] Theme change listener initialized');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,7 +184,7 @@
|
|||||||
* @param {string} oldTheme - Old theme name
|
* @param {string} oldTheme - Old theme name
|
||||||
*/
|
*/
|
||||||
_notifyThemeChange(newTheme, oldTheme) {
|
_notifyThemeChange(newTheme, oldTheme) {
|
||||||
console.log(`[ThemeAdapter] Theme changed: ${oldTheme} → ${newTheme}`);
|
debug(`[ThemeAdapter] Theme changed: ${oldTheme} → ${newTheme}`);
|
||||||
|
|
||||||
this.themeChangeCallbacks.forEach(callback => {
|
this.themeChangeCallbacks.forEach(callback => {
|
||||||
try {
|
try {
|
||||||
@@ -207,7 +211,7 @@
|
|||||||
// Note: Driver.js v1.0+ uses CSS variables, so we inject a style element
|
// Note: Driver.js v1.0+ uses CSS variables, so we inject a style element
|
||||||
this._injectDriverStyles(themeConfig);
|
this._injectDriverStyles(themeConfig);
|
||||||
|
|
||||||
console.log('[ThemeAdapter] Theme applied to driver:', this.currentTheme);
|
debug('[ThemeAdapter] Theme applied to driver:', this.currentTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -302,6 +306,6 @@
|
|||||||
// Export to global scope
|
// Export to global scope
|
||||||
window.ThemeAdapter = ThemeAdapter;
|
window.ThemeAdapter = ThemeAdapter;
|
||||||
|
|
||||||
console.log('[ThemeAdapter] Module loaded');
|
debug('[ThemeAdapter] Module loaded');
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
(function(window) {
|
(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const debug = (...args) => {
|
||||||
|
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a tooltip definition
|
* Validate a tooltip definition
|
||||||
* @param {Object} tooltip - The tooltip definition to validate
|
* @param {Object} tooltip - The tooltip definition to validate
|
||||||
@@ -160,7 +164,7 @@
|
|||||||
TooltipError
|
TooltipError
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('[TooltipDefinitions] Validation module loaded');
|
debug('[TooltipDefinitions] Validation module loaded');
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
@@ -534,5 +538,5 @@ window.TooltipDefinitions = {
|
|||||||
getNewFeatureTooltips
|
getNewFeatureTooltips
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('[TooltipDefinitions] Definitions loaded:', TOOLTIP_DEFINITIONS.length, 'tooltips');
|
debug('[TooltipDefinitions] Definitions loaded:', TOOLTIP_DEFINITIONS.length, 'tooltips');
|
||||||
|
|
||||||
|
|||||||
+14
-10
@@ -6,6 +6,10 @@
|
|||||||
(function(window) {
|
(function(window) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const debug = (...args) => {
|
||||||
|
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||||
|
};
|
||||||
|
|
||||||
class TourManager {
|
class TourManager {
|
||||||
constructor(progressTracker, themeAdapter, dnsTemplateSelector) {
|
constructor(progressTracker, themeAdapter, dnsTemplateSelector) {
|
||||||
this.progressTracker = progressTracker;
|
this.progressTracker = progressTracker;
|
||||||
@@ -92,7 +96,7 @@
|
|||||||
const activeTooltips = allTooltips.filter(t => !completedIds.includes(t.id));
|
const activeTooltips = allTooltips.filter(t => !completedIds.includes(t.id));
|
||||||
|
|
||||||
if (activeTooltips.length === 0) {
|
if (activeTooltips.length === 0) {
|
||||||
console.log('[TourManager] No tooltips to show');
|
debug('[TourManager] No tooltips to show');
|
||||||
this.progressTracker.markTourCompleted();
|
this.progressTracker.markTourCompleted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -131,7 +135,7 @@
|
|||||||
// Add custom handlers for DNS tooltip
|
// Add custom handlers for DNS tooltip
|
||||||
if (tooltip.id === 'dns-priority' && this.dnsTemplateSelector) {
|
if (tooltip.id === 'dns-priority' && this.dnsTemplateSelector) {
|
||||||
step.popover.onSetupNowClick = () => {
|
step.popover.onSetupNowClick = () => {
|
||||||
console.log('[TourManager] Opening DNS template selector');
|
debug('[TourManager] Opening DNS template selector');
|
||||||
this.dnsTemplateSelector.showTemplateSelector();
|
this.dnsTemplateSelector.showTemplateSelector();
|
||||||
// Mark tooltip as completed and move to next
|
// Mark tooltip as completed and move to next
|
||||||
this.progressTracker.markTooltipCompleted(tooltip.id);
|
this.progressTracker.markTooltipCompleted(tooltip.id);
|
||||||
@@ -141,7 +145,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
step.popover.onLaterClick = () => {
|
step.popover.onLaterClick = () => {
|
||||||
console.log('[TourManager] DNS setup deferred');
|
debug('[TourManager] DNS setup deferred');
|
||||||
this.progressTracker.markDnsSetupDeferred();
|
this.progressTracker.markDnsSetupDeferred();
|
||||||
// Mark tooltip as completed and move to next
|
// Mark tooltip as completed and move to next
|
||||||
this.progressTracker.markTooltipCompleted(tooltip.id);
|
this.progressTracker.markTooltipCompleted(tooltip.id);
|
||||||
@@ -232,11 +236,11 @@
|
|||||||
const newFeatureTooltips = window.TooltipDefinitions.getNewFeatureTooltips();
|
const newFeatureTooltips = window.TooltipDefinitions.getNewFeatureTooltips();
|
||||||
|
|
||||||
if (newFeatureTooltips.length === 0) {
|
if (newFeatureTooltips.length === 0) {
|
||||||
console.log('[TourManager] No new features to show');
|
debug('[TourManager] No new features to show');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[TourManager] Showing ${newFeatureTooltips.length} new features`);
|
debug(`[TourManager] Showing ${newFeatureTooltips.length} new features`);
|
||||||
|
|
||||||
// Convert to Driver.js steps
|
// Convert to Driver.js steps
|
||||||
const steps = newFeatureTooltips.map((tooltip, index) => {
|
const steps = newFeatureTooltips.map((tooltip, index) => {
|
||||||
@@ -280,7 +284,7 @@
|
|||||||
clearTimeout(resizeTimeout);
|
clearTimeout(resizeTimeout);
|
||||||
resizeTimeout = setTimeout(() => {
|
resizeTimeout = setTimeout(() => {
|
||||||
if (this.isActive && this.driver) {
|
if (this.isActive && this.driver) {
|
||||||
console.log('[TourManager] Window resized, repositioning tooltip');
|
debug('[TourManager] Window resized, repositioning tooltip');
|
||||||
this.driver.refresh();
|
this.driver.refresh();
|
||||||
}
|
}
|
||||||
}, 150); // Debounce for 150ms
|
}, 150); // Debounce for 150ms
|
||||||
@@ -289,7 +293,7 @@
|
|||||||
// Layout change handler (for theme changes, DOM mutations)
|
// Layout change handler (for theme changes, DOM mutations)
|
||||||
this.layoutChangeHandler = () => {
|
this.layoutChangeHandler = () => {
|
||||||
if (this.isActive && this.driver) {
|
if (this.isActive && this.driver) {
|
||||||
console.log('[TourManager] Layout changed, repositioning tooltip');
|
debug('[TourManager] Layout changed, repositioning tooltip');
|
||||||
// Small delay to allow layout to settle
|
// Small delay to allow layout to settle
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.driver) {
|
if (this.driver) {
|
||||||
@@ -347,7 +351,7 @@
|
|||||||
onTourComplete() {
|
onTourComplete() {
|
||||||
this.progressTracker.markTourCompleted();
|
this.progressTracker.markTourCompleted();
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
console.log('[TourManager] Tour completed');
|
debug('[TourManager] Tour completed');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -355,12 +359,12 @@
|
|||||||
*/
|
*/
|
||||||
onTourSkip() {
|
onTourSkip() {
|
||||||
// Save current progress but don't mark as completed
|
// Save current progress but don't mark as completed
|
||||||
console.log('[TourManager] Tour skipped');
|
debug('[TourManager] Tour skipped');
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.TourManager = TourManager;
|
window.TourManager = TourManager;
|
||||||
console.log('[TourManager] Module loaded');
|
debug('[TourManager] Module loaded');
|
||||||
|
|
||||||
})(window);
|
})(window);
|
||||||
|
|||||||
Reference in New Issue
Block a user