Removes excessive logging statements
Cleans up the codebase by removing unnecessary console log statements. These logs were primarily used for debugging and are no longer needed in the production code. This reduces noise in the console and improves overall performance.
This commit is contained in:
parent
383eab7524
commit
fafad16926
24 changed files with 4 additions and 275 deletions
|
|
@ -43,7 +43,6 @@ export class CalendarManager {
|
|||
this.eventFilterManager = new EventFilterManager();
|
||||
this.dateCalculator = new DateCalculator(config);
|
||||
this.setupEventListeners();
|
||||
console.log('📋 CalendarManager: Created with proper dependency injection');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -51,23 +50,18 @@ export class CalendarManager {
|
|||
*/
|
||||
public async initialize(): Promise<void> {
|
||||
if (this.isInitialized) {
|
||||
console.warn('CalendarManager is already initialized');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('🚀 CalendarManager: Starting simple initialization');
|
||||
|
||||
try {
|
||||
// Debug: Check calendar type
|
||||
const calendarType = this.config.getCalendarMode();
|
||||
console.log(`🔍 CalendarManager: Initializing ${calendarType} calendar`);
|
||||
|
||||
// Step 1: Load data
|
||||
console.log('📊 Loading event data...');
|
||||
await this.eventManager.loadData();
|
||||
|
||||
// Step 2: Pass data to GridManager and render grid structure
|
||||
console.log('🏗️ Rendering grid...');
|
||||
if (calendarType === 'resource') {
|
||||
const resourceData = this.eventManager.getResourceData();
|
||||
this.gridManager.setResourceData(resourceData);
|
||||
|
|
@ -76,7 +70,6 @@ export class CalendarManager {
|
|||
|
||||
// Step 2b: Trigger event rendering now that data is loaded
|
||||
// Re-emit GRID_RENDERED to trigger EventRendererManager
|
||||
console.log('🎨 Triggering event rendering...');
|
||||
const gridContainer = document.querySelector('swp-calendar-container');
|
||||
if (gridContainer) {
|
||||
const periodRange = this.gridManager.getDisplayDates();
|
||||
|
|
@ -90,19 +83,15 @@ export class CalendarManager {
|
|||
}
|
||||
|
||||
// Step 3: Initialize scroll synchronization
|
||||
console.log('📜 Setting up scroll synchronization...');
|
||||
this.scrollManager.initialize();
|
||||
|
||||
// Step 4: Set initial view and date BEFORE event rendering
|
||||
console.log('⚙️ Setting initial view and date...');
|
||||
this.setView(this.currentView);
|
||||
this.setCurrentDate(this.currentDate);
|
||||
|
||||
// Step 5: Event rendering will be triggered by GRID_RENDERED event
|
||||
console.log('🎨 Event rendering will be triggered automatically by grid events...');
|
||||
|
||||
this.isInitialized = true;
|
||||
console.log('✅ CalendarManager: Simple initialization complete');
|
||||
|
||||
// Emit initialization complete event
|
||||
this.eventBus.emit(CoreEvents.INITIALIZED, {
|
||||
|
|
@ -111,7 +100,6 @@ export class CalendarManager {
|
|||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ CalendarManager initialization failed:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +115,6 @@ export class CalendarManager {
|
|||
const previousView = this.currentView;
|
||||
this.currentView = view;
|
||||
|
||||
console.log(`Changing view from ${previousView} to ${view}`);
|
||||
|
||||
// Emit view change event
|
||||
this.eventBus.emit(CoreEvents.VIEW_CHANGED, {
|
||||
|
|
@ -145,7 +132,6 @@ export class CalendarManager {
|
|||
public setCurrentDate(date: Date): void {
|
||||
// Validate input date
|
||||
if (!date || !(date instanceof Date) || isNaN(date.getTime())) {
|
||||
console.error('CalendarManager.setCurrentDate: Invalid date provided', date);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +142,6 @@ export class CalendarManager {
|
|||
const prevDateStr = previousDate && !isNaN(previousDate.getTime()) ? previousDate.toISOString() : 'Invalid Date';
|
||||
const newDateStr = this.currentDate.toISOString();
|
||||
|
||||
console.log(`Changing date from ${prevDateStr} to ${newDateStr}`);
|
||||
|
||||
// Emit date change event
|
||||
this.eventBus.emit(CoreEvents.DATE_CHANGED, {
|
||||
|
|
@ -235,7 +220,6 @@ export class CalendarManager {
|
|||
* Genindlæs calendar data
|
||||
*/
|
||||
public refresh(): void {
|
||||
console.log('Refreshing calendar...');
|
||||
|
||||
this.eventBus.emit(CoreEvents.REFRESH_REQUESTED, {
|
||||
view: this.currentView,
|
||||
|
|
@ -247,7 +231,6 @@ export class CalendarManager {
|
|||
* Ryd calendar og nulstil til standard tilstand
|
||||
*/
|
||||
public reset(): void {
|
||||
console.log('Resetting calendar...');
|
||||
|
||||
this.currentView = 'week';
|
||||
this.currentDate = new Date();
|
||||
|
|
@ -265,7 +248,6 @@ export class CalendarManager {
|
|||
// Listen for workweek changes only
|
||||
this.eventBus.on(CoreEvents.WORKWEEK_CHANGED, (event: Event) => {
|
||||
const customEvent = event as CustomEvent;
|
||||
console.log('CalendarManager: Workweek changed to', customEvent.detail.workWeekId);
|
||||
this.handleWorkweekChange();
|
||||
|
||||
// Also update week info display since workweek affects date range display
|
||||
|
|
@ -379,7 +361,6 @@ export class CalendarManager {
|
|||
* Handle workweek configuration changes
|
||||
*/
|
||||
private handleWorkweekChange(): void {
|
||||
console.log('CalendarManager: Handling workweek change - forcing full grid rebuild');
|
||||
|
||||
// Force a complete grid rebuild by clearing existing structure
|
||||
const container = document.querySelector('swp-calendar-container');
|
||||
|
|
@ -401,7 +382,6 @@ export class CalendarManager {
|
|||
* Re-render events after grid structure changes
|
||||
*/
|
||||
private rerenderEvents(): void {
|
||||
console.log('CalendarManager: Re-rendering events for new workweek');
|
||||
|
||||
// Get current period data to determine date range
|
||||
const periodData = this.calculateCurrentPeriod();
|
||||
|
|
@ -409,7 +389,6 @@ export class CalendarManager {
|
|||
// Find the grid container to render events in
|
||||
const container = document.querySelector('swp-calendar-container');
|
||||
if (!container) {
|
||||
console.warn('CalendarManager: No container found for event re-rendering');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -426,19 +405,16 @@ export class CalendarManager {
|
|||
*/
|
||||
private updateWeekInfoForWorkweekChange(): void {
|
||||
// Don't do anything here - let GRID_RENDERED event handle it
|
||||
console.log('CalendarManager: Workweek changed - week info will update after grid renders');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update week info based on actual rendered columns
|
||||
*/
|
||||
private updateWeekInfoFromRenderedColumns(): void {
|
||||
console.log('CalendarManager: Updating week info from rendered columns');
|
||||
|
||||
// Get actual dates from rendered columns
|
||||
const columns = document.querySelectorAll('swp-day-column');
|
||||
if (columns.length === 0) {
|
||||
console.warn('CalendarManager: No columns found for week info update');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -450,7 +426,6 @@ export class CalendarManager {
|
|||
const lastDateStr = lastColumn.dataset.date;
|
||||
|
||||
if (!firstDateStr || !lastDateStr) {
|
||||
console.warn('CalendarManager: Column dates not found');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -464,13 +439,6 @@ export class CalendarManager {
|
|||
// Format date range
|
||||
const dateRange = this.dateCalculator.formatDateRange(firstDate, lastDate);
|
||||
|
||||
console.log('CalendarManager: Week info from columns:', {
|
||||
firstDate: firstDateStr,
|
||||
lastDate: lastDateStr,
|
||||
weekNumber,
|
||||
dateRange
|
||||
});
|
||||
|
||||
// Emit week info update
|
||||
this.eventBus.emit(CoreEvents.WEEK_CHANGED, {
|
||||
weekNumber,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ export class DragDropManager {
|
|||
*/
|
||||
public setSnapInterval(minutes: number): void {
|
||||
this.snapIntervalMinutes = minutes;
|
||||
console.log(`DragDropManager: Snap interval set to ${minutes} minutes (${this.snapDistancePx}px)`);
|
||||
}
|
||||
|
||||
private init(): void {
|
||||
|
|
@ -126,10 +125,6 @@ export class DragDropManager {
|
|||
column: this.currentColumn
|
||||
});
|
||||
|
||||
console.log('DragDropManager: Drag started', {
|
||||
eventId: this.draggedEventId,
|
||||
column: this.currentColumn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -156,10 +151,6 @@ export class DragDropManager {
|
|||
mouseOffset: this.mouseOffset
|
||||
});
|
||||
|
||||
console.log(`DragDropManager: Drag moved ${this.snapIntervalMinutes} minutes`, {
|
||||
snappedY,
|
||||
column
|
||||
});
|
||||
}
|
||||
|
||||
// Check for auto-scroll
|
||||
|
|
@ -168,7 +159,6 @@ export class DragDropManager {
|
|||
// Check for column change
|
||||
const newColumn = this.detectColumn(event.clientX, event.clientY);
|
||||
if (newColumn && newColumn !== this.currentColumn) {
|
||||
console.log(`DragDropManager: Column changed from ${this.currentColumn} to ${newColumn}`);
|
||||
this.currentColumn = newColumn;
|
||||
|
||||
this.eventBus.emit('drag:column-change', {
|
||||
|
|
@ -203,11 +193,6 @@ export class DragDropManager {
|
|||
finalY
|
||||
});
|
||||
|
||||
console.log('DragDropManager: Drag ended', {
|
||||
eventId: this.draggedEventId,
|
||||
finalColumn,
|
||||
finalY
|
||||
});
|
||||
|
||||
// Clean up
|
||||
this.draggedEventId = null;
|
||||
|
|
@ -263,7 +248,6 @@ export class DragDropManager {
|
|||
if (!this.scrollContainer) {
|
||||
this.scrollContainer = document.querySelector('swp-scrollable-content') as HTMLElement;
|
||||
if (!this.scrollContainer) {
|
||||
console.warn('DragDropManager: Could not find swp-scrollable-content for auto-scroll');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ export class EventFilterManager {
|
|||
this.searchInput = document.querySelector('swp-search-container input[type="search"]');
|
||||
|
||||
if (!this.searchInput) {
|
||||
console.warn('EventFilterManager: Search input not found');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +112,6 @@ export class EventFilterManager {
|
|||
|
||||
private applyFilter(query: string): void {
|
||||
if (!this.fuse) {
|
||||
console.warn('EventFilterManager: Cannot filter - Fuse not initialized');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ export class EventManager {
|
|||
private events: CalendarEvent[] = [];
|
||||
|
||||
constructor(eventBus: IEventBus) {
|
||||
console.log('EventManager: Constructor called');
|
||||
this.eventBus = eventBus;
|
||||
this.setupEventListeners();
|
||||
console.log('EventManager: Waiting for CALENDAR_INITIALIZED before loading data');
|
||||
}
|
||||
|
||||
private setupEventListeners(): void {
|
||||
|
|
@ -28,17 +26,10 @@ export class EventManager {
|
|||
* Public method to load data - called directly by CalendarManager
|
||||
*/
|
||||
public async loadData(): Promise<void> {
|
||||
console.log('EventManager: Loading data via direct call');
|
||||
await this.loadMockData();
|
||||
console.log(`EventManager: Data loaded successfully - ${this.events.length} events`);
|
||||
|
||||
// Debug: Log first few events
|
||||
if (this.events.length > 0) {
|
||||
console.log('EventManager: First event:', {
|
||||
title: this.events[0].title,
|
||||
start: this.events[0].start,
|
||||
end: this.events[0].end
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +38,6 @@ export class EventManager {
|
|||
const calendarType = calendarConfig.getCalendarMode();
|
||||
let jsonFile: string;
|
||||
|
||||
console.log(`EventManager: Calendar type detected: '${calendarType}'`);
|
||||
|
||||
if (calendarType === 'resource') {
|
||||
jsonFile = '/src/data/mock-resource-events.json';
|
||||
|
|
@ -55,7 +45,6 @@ export class EventManager {
|
|||
jsonFile = '/src/data/mock-events.json';
|
||||
}
|
||||
|
||||
console.log(`EventManager: Loading ${calendarType} calendar data from ${jsonFile}`);
|
||||
|
||||
const response = await fetch(jsonFile);
|
||||
if (!response.ok) {
|
||||
|
|
@ -63,7 +52,6 @@ export class EventManager {
|
|||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(`EventManager: Loaded data for ${calendarType} calendar`);
|
||||
|
||||
// Store raw data for GridManager
|
||||
this.rawData = data;
|
||||
|
|
@ -71,7 +59,6 @@ export class EventManager {
|
|||
// Process data for internal use
|
||||
this.processCalendarData(calendarType, data);
|
||||
} catch (error) {
|
||||
console.error('EventManager: Failed to load mock events:', error);
|
||||
this.events = []; // Fallback to empty array
|
||||
}
|
||||
}
|
||||
|
|
@ -87,17 +74,14 @@ export class EventManager {
|
|||
resourceEmployeeId: resource.employeeId
|
||||
}))
|
||||
);
|
||||
console.log(`EventManager: Processed ${this.events.length} events from ${resourceData.resources.length} resources`);
|
||||
} else {
|
||||
this.events = data as CalendarEvent[];
|
||||
console.log(`EventManager: Processed ${this.events.length} date events`);
|
||||
}
|
||||
}
|
||||
|
||||
private syncEvents(): void {
|
||||
// Events are synced during initialization
|
||||
// This method maintained for internal state management only
|
||||
console.log(`EventManager: Internal sync - ${this.events.length} events in memory`);
|
||||
}
|
||||
|
||||
public getEvents(): CalendarEvent[] {
|
||||
|
|
@ -122,7 +106,6 @@ export class EventManager {
|
|||
* Get events for a specific time period
|
||||
*/
|
||||
public getEventsForPeriod(startDate: Date, endDate: Date): CalendarEvent[] {
|
||||
console.log(`EventManager.getEventsForPeriod: Checking ${this.events.length} events for period ${startDate.toDateString()} - ${endDate.toDateString()}`);
|
||||
return this.events.filter(event => {
|
||||
const eventStart = new Date(event.start);
|
||||
const eventEnd = new Date(event.end);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ export class GridManager {
|
|||
private eventCleanup: (() => void)[] = [];
|
||||
|
||||
constructor() {
|
||||
console.log('🏗️ GridManager: Constructor called with Strategy Pattern');
|
||||
|
||||
// Default to week view strategy
|
||||
this.currentStrategy = new WeekViewStrategy();
|
||||
|
|
@ -34,12 +33,10 @@ export class GridManager {
|
|||
this.findElements();
|
||||
this.subscribeToEvents();
|
||||
|
||||
console.log('GridManager: Initialized with strategy pattern');
|
||||
}
|
||||
|
||||
private findElements(): void {
|
||||
this.container = document.querySelector('swp-calendar-container');
|
||||
console.log('GridManager: Found container:', !!this.container);
|
||||
}
|
||||
|
||||
private subscribeToEvents(): void {
|
||||
|
|
@ -69,7 +66,6 @@ export class GridManager {
|
|||
* Switch to a different view strategy
|
||||
*/
|
||||
public switchViewStrategy(view: CalendarView): void {
|
||||
console.log(`GridManager: Switching to ${view} strategy`);
|
||||
|
||||
// Clean up current strategy
|
||||
this.currentStrategy.destroy();
|
||||
|
|
@ -84,7 +80,6 @@ export class GridManager {
|
|||
this.currentStrategy = new MonthViewStrategy();
|
||||
break;
|
||||
default:
|
||||
console.warn(`GridManager: Unknown view type ${view}, defaulting to week`);
|
||||
this.currentStrategy = new WeekViewStrategy();
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +92,6 @@ export class GridManager {
|
|||
*/
|
||||
public setResourceData(resourceData: ResourceCalendarData | null): void {
|
||||
this.resourceData = resourceData;
|
||||
console.log('GridManager: Updated resource data');
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
@ -106,11 +100,9 @@ export class GridManager {
|
|||
*/
|
||||
public async render(): Promise<void> {
|
||||
if (!this.container) {
|
||||
console.warn('GridManager: No container found, cannot render');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`🎨 GridManager: Rendering ${this.currentDate.toDateString()} using ${this.currentStrategy.constructor.name}`);
|
||||
|
||||
// Create context for strategy
|
||||
const context: ViewContext = {
|
||||
|
|
@ -128,7 +120,6 @@ export class GridManager {
|
|||
// Get period range from current strategy
|
||||
const periodRange = this.currentStrategy.getPeriodRange(this.currentDate);
|
||||
|
||||
console.log(`GridManager: Emitting GRID_RENDERED for main container with period ${periodRange.startDate.toDateString()} - ${periodRange.endDate.toDateString()}`);
|
||||
|
||||
// Emit grid rendered event with explicit date range
|
||||
eventBus.emit(CoreEvents.GRID_RENDERED, {
|
||||
|
|
@ -140,7 +131,6 @@ export class GridManager {
|
|||
columnCount: layoutConfig.columnCount
|
||||
});
|
||||
|
||||
console.log(`✅ Grid rendered with ${layoutConfig.columnCount} columns`);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -208,7 +198,6 @@ export class GridManager {
|
|||
* Clean up all resources
|
||||
*/
|
||||
public destroy(): void {
|
||||
console.log('GridManager: Cleaning up');
|
||||
|
||||
// Clean up event listeners
|
||||
this.eventCleanup.forEach(cleanup => cleanup());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export class NavigationManager {
|
|||
private animationQueue: number = 0;
|
||||
|
||||
constructor(eventBus: IEventBus, eventRenderer: EventRenderingService) {
|
||||
console.log('🧭 NavigationManager: Constructor called');
|
||||
this.eventBus = eventBus;
|
||||
this.dateCalculator = new DateCalculator(calendarConfig);
|
||||
this.navigationRenderer = new NavigationRenderer(eventBus, calendarConfig, eventRenderer);
|
||||
|
|
@ -30,13 +29,11 @@ export class NavigationManager {
|
|||
private init(): void {
|
||||
this.setupEventListeners();
|
||||
// Don't update week info immediately - wait for DOM to be ready
|
||||
console.log('NavigationManager: Waiting for CALENDAR_INITIALIZED before updating DOM');
|
||||
}
|
||||
|
||||
private setupEventListeners(): void {
|
||||
// Initial DOM update when calendar is initialized
|
||||
this.eventBus.on(CoreEvents.INITIALIZED, () => {
|
||||
console.log('NavigationManager: Received CALENDAR_INITIALIZED, updating week info');
|
||||
this.updateWeekInfo();
|
||||
});
|
||||
|
||||
|
|
@ -75,13 +72,11 @@ export class NavigationManager {
|
|||
|
||||
// Validate date before processing
|
||||
if (!dateFromEvent) {
|
||||
console.warn('NavigationManager: No currentDate provided in DATE_CHANGED event', customEvent.detail);
|
||||
return;
|
||||
}
|
||||
|
||||
const targetDate = new Date(dateFromEvent);
|
||||
if (isNaN(targetDate.getTime())) {
|
||||
console.warn('NavigationManager: Invalid currentDate in DATE_CHANGED event', dateFromEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -146,19 +141,15 @@ export class NavigationManager {
|
|||
const currentGrid = container?.querySelector('swp-grid-container:not([data-prerendered])');
|
||||
|
||||
if (!container || !currentGrid) {
|
||||
console.warn('NavigationManager: Required DOM elements not found');
|
||||
return;
|
||||
}
|
||||
|
||||
console.group(`🎬 NAVIGATION ANIMATION: ${direction} to ${targetWeek.toDateString()}`);
|
||||
console.log('1. Creating new container with events...');
|
||||
|
||||
let newGrid: HTMLElement;
|
||||
|
||||
// Always create a fresh container for consistent behavior
|
||||
newGrid = this.navigationRenderer.renderContainer(container as HTMLElement, targetWeek);
|
||||
|
||||
console.log('2. Starting slide animation...');
|
||||
|
||||
// Clear any existing transforms before animation
|
||||
newGrid.style.transform = '';
|
||||
|
|
@ -185,7 +176,6 @@ export class NavigationManager {
|
|||
|
||||
// Handle animation completion
|
||||
slideInAnimation.addEventListener('finish', () => {
|
||||
console.log('3. Animation finished, cleaning up...');
|
||||
|
||||
// Cleanup: Remove all old grids except the new one
|
||||
const allGrids = container.querySelectorAll('swp-grid-container');
|
||||
|
|
@ -215,8 +205,6 @@ export class NavigationManager {
|
|||
weekStart: this.currentWeek
|
||||
});
|
||||
|
||||
console.log('✅ Animation completed successfully');
|
||||
console.groupEnd();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ export class ViewManager {
|
|||
const previousView = this.currentView;
|
||||
this.currentView = newView;
|
||||
|
||||
console.log(`ViewManager: Changing view from ${previousView} to ${newView}`);
|
||||
|
||||
this.updateViewButtons();
|
||||
|
||||
|
|
@ -105,7 +104,6 @@ export class ViewManager {
|
|||
}
|
||||
|
||||
private changeWorkweek(workweekId: string): void {
|
||||
console.log(`ViewManager: Changing workweek to ${workweekId}`);
|
||||
|
||||
// Update the calendar config
|
||||
calendarConfig.setWorkWeek(workweekId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue