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() {
|
||||
'use strict';
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
|
||||
// All modal selectors that can be closed with Escape
|
||||
const MODAL_SELECTORS = [
|
||||
'#app-selector-modal',
|
||||
@@ -39,9 +43,9 @@
|
||||
// Add global keyboard listener
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
|
||||
console.log('[Keyboard Shortcuts] Initialized');
|
||||
console.log('[Keyboard Shortcuts] Press Ctrl+K to open quick search');
|
||||
console.log('[Keyboard Shortcuts] Press Escape to close modals');
|
||||
debug('[Keyboard Shortcuts] Initialized');
|
||||
debug('[Keyboard Shortcuts] Press Ctrl+K to open quick search');
|
||||
debug('[Keyboard Shortcuts] Press Escape to close modals');
|
||||
} catch (e) {
|
||||
console.warn('[Keyboard Shortcuts] Failed to initialize:', e.message);
|
||||
}
|
||||
@@ -599,7 +603,7 @@
|
||||
}
|
||||
break;
|
||||
default:
|
||||
console.log('[Keyboard Shortcuts] Unknown action:', action);
|
||||
debug('[Keyboard Shortcuts] Unknown action:', action);
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[Keyboard Shortcuts] Error executing action:', e.message);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
es.addEventListener('connected', () => {
|
||||
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
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
(function(window) {
|
||||
'use strict';
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
|
||||
/**
|
||||
* ProgressTracker class
|
||||
* Manages persistent storage of onboarding progress
|
||||
@@ -308,6 +312,6 @@
|
||||
// Export to global scope
|
||||
window.ProgressTracker = ProgressTracker;
|
||||
|
||||
console.log('[ProgressTracker] Module loaded');
|
||||
debug('[ProgressTracker] Module loaded');
|
||||
|
||||
})(window);
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
(function(window) {
|
||||
'use strict';
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Theme configuration mapping for Driver.js
|
||||
* Maps dashboard themes to Driver.js styling
|
||||
@@ -170,7 +174,7 @@
|
||||
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
|
||||
*/
|
||||
_notifyThemeChange(newTheme, oldTheme) {
|
||||
console.log(`[ThemeAdapter] Theme changed: ${oldTheme} → ${newTheme}`);
|
||||
debug(`[ThemeAdapter] Theme changed: ${oldTheme} → ${newTheme}`);
|
||||
|
||||
this.themeChangeCallbacks.forEach(callback => {
|
||||
try {
|
||||
@@ -207,7 +211,7 @@
|
||||
// Note: Driver.js v1.0+ uses CSS variables, so we inject a style element
|
||||
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
|
||||
window.ThemeAdapter = ThemeAdapter;
|
||||
|
||||
console.log('[ThemeAdapter] Module loaded');
|
||||
debug('[ThemeAdapter] Module loaded');
|
||||
|
||||
})(window);
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
(function(window) {
|
||||
'use strict';
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate a tooltip definition
|
||||
* @param {Object} tooltip - The tooltip definition to validate
|
||||
@@ -160,7 +164,7 @@
|
||||
TooltipError
|
||||
};
|
||||
|
||||
console.log('[TooltipDefinitions] Validation module loaded');
|
||||
debug('[TooltipDefinitions] Validation module loaded');
|
||||
|
||||
})(window);
|
||||
|
||||
@@ -534,5 +538,5 @@ window.TooltipDefinitions = {
|
||||
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) {
|
||||
'use strict';
|
||||
|
||||
const debug = (...args) => {
|
||||
if (window.DASHCADDY_DEBUG) { console.log(...args); }
|
||||
};
|
||||
|
||||
class TourManager {
|
||||
constructor(progressTracker, themeAdapter, dnsTemplateSelector) {
|
||||
this.progressTracker = progressTracker;
|
||||
@@ -92,7 +96,7 @@
|
||||
const activeTooltips = allTooltips.filter(t => !completedIds.includes(t.id));
|
||||
|
||||
if (activeTooltips.length === 0) {
|
||||
console.log('[TourManager] No tooltips to show');
|
||||
debug('[TourManager] No tooltips to show');
|
||||
this.progressTracker.markTourCompleted();
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +135,7 @@
|
||||
// Add custom handlers for DNS tooltip
|
||||
if (tooltip.id === 'dns-priority' && this.dnsTemplateSelector) {
|
||||
step.popover.onSetupNowClick = () => {
|
||||
console.log('[TourManager] Opening DNS template selector');
|
||||
debug('[TourManager] Opening DNS template selector');
|
||||
this.dnsTemplateSelector.showTemplateSelector();
|
||||
// Mark tooltip as completed and move to next
|
||||
this.progressTracker.markTooltipCompleted(tooltip.id);
|
||||
@@ -141,7 +145,7 @@
|
||||
};
|
||||
|
||||
step.popover.onLaterClick = () => {
|
||||
console.log('[TourManager] DNS setup deferred');
|
||||
debug('[TourManager] DNS setup deferred');
|
||||
this.progressTracker.markDnsSetupDeferred();
|
||||
// Mark tooltip as completed and move to next
|
||||
this.progressTracker.markTooltipCompleted(tooltip.id);
|
||||
@@ -232,11 +236,11 @@
|
||||
const newFeatureTooltips = window.TooltipDefinitions.getNewFeatureTooltips();
|
||||
|
||||
if (newFeatureTooltips.length === 0) {
|
||||
console.log('[TourManager] No new features to show');
|
||||
debug('[TourManager] No new features to show');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`[TourManager] Showing ${newFeatureTooltips.length} new features`);
|
||||
debug(`[TourManager] Showing ${newFeatureTooltips.length} new features`);
|
||||
|
||||
// Convert to Driver.js steps
|
||||
const steps = newFeatureTooltips.map((tooltip, index) => {
|
||||
@@ -280,7 +284,7 @@
|
||||
clearTimeout(resizeTimeout);
|
||||
resizeTimeout = setTimeout(() => {
|
||||
if (this.isActive && this.driver) {
|
||||
console.log('[TourManager] Window resized, repositioning tooltip');
|
||||
debug('[TourManager] Window resized, repositioning tooltip');
|
||||
this.driver.refresh();
|
||||
}
|
||||
}, 150); // Debounce for 150ms
|
||||
@@ -289,7 +293,7 @@
|
||||
// Layout change handler (for theme changes, DOM mutations)
|
||||
this.layoutChangeHandler = () => {
|
||||
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
|
||||
setTimeout(() => {
|
||||
if (this.driver) {
|
||||
@@ -347,7 +351,7 @@
|
||||
onTourComplete() {
|
||||
this.progressTracker.markTourCompleted();
|
||||
this.isActive = false;
|
||||
console.log('[TourManager] Tour completed');
|
||||
debug('[TourManager] Tour completed');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -355,12 +359,12 @@
|
||||
*/
|
||||
onTourSkip() {
|
||||
// Save current progress but don't mark as completed
|
||||
console.log('[TourManager] Tour skipped');
|
||||
debug('[TourManager] Tour skipped');
|
||||
this.isActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
window.TourManager = TourManager;
|
||||
console.log('[TourManager] Module loaded');
|
||||
debug('[TourManager] Module loaded');
|
||||
|
||||
})(window);
|
||||
|
||||
Reference in New Issue
Block a user