Clean up excessive console logging and remove duplicate app files

- Remove verbose console.log statements from WebSocket, map, and aircraft managers
- Keep essential error messages and warnings for debugging
- Consolidate app-new.js into app.js to eliminate confusing duplicate files
- Update HTML reference to use clean app.js with incremented cache version
- Significantly reduce console noise for better user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-24 14:55:54 +02:00
commit 776cef1185
7 changed files with 174 additions and 1415 deletions

View file

@ -22,7 +22,6 @@ export class AircraftManager {
for (const [icao, aircraft] of Object.entries(data.aircraft)) {
this.aircraftData.set(icao, aircraft);
}
console.log(`Aircraft data updated: ${this.aircraftData.size} aircraft`);
}
}
@ -57,9 +56,6 @@ export class AircraftManager {
updateAircraftMarker(icao, aircraft) {
const pos = [aircraft.Latitude, aircraft.Longitude];
// Debug: Log coordinate format and values
console.log(`📍 ${icao}: pos=[${pos[0]}, ${pos[1]}], types=[${typeof pos[0]}, ${typeof pos[1]}]`);
console.log(`🔍 Marker check for ${icao}: has=${this.aircraftMarkers.has(icao)}, map_size=${this.aircraftMarkers.size}`);
// Check for invalid coordinates - proper geographic bounds
const isValidLat = pos[0] >= -90 && pos[0] <= 90;
@ -76,7 +72,6 @@ export class AircraftManager {
// Always update position - let Leaflet handle everything
const oldPos = marker.getLatLng();
console.log(`🔄 Updating ${icao}: [${oldPos.lat}, ${oldPos.lng}] -> [${pos[0]}, ${pos[1]}]`);
marker.setLatLng(pos);
// Update rotation using Leaflet's options if available, otherwise skip rotation
@ -100,7 +95,6 @@ export class AircraftManager {
} else {
// Create new marker
console.log(`Creating new marker for ${icao}`);
const icon = this.createAircraftIcon(aircraft);
try {
@ -116,14 +110,12 @@ export class AircraftManager {
this.aircraftMarkers.set(icao, marker);
this.markerCreateCount++;
console.log(`Created marker for ${icao}, total markers: ${this.aircraftMarkers.size}`);
// Force immediate visibility
if (marker._icon) {
marker._icon.style.display = 'block';
marker._icon.style.opacity = '1';
marker._icon.style.visibility = 'visible';
console.log(`Forced visibility for new marker ${icao}`);
}
} catch (error) {
console.error(`Failed to create marker for ${icao}:`, error);
@ -442,8 +434,4 @@ export class AircraftManager {
}
}
// Simple debug method
debugState() {
console.log(`Aircraft: ${this.aircraftData.size}, Markers: ${this.aircraftMarkers.size}`);
}
}

View file

@ -32,7 +32,6 @@ export class MapManager {
// Store origin for reset functionality
this.mapOrigin = origin;
console.log(`🗺️ Map origin: [${origin.latitude}, ${origin.longitude}]`);
this.map = L.map('map').setView([origin.latitude, origin.longitude], 10);
// Dark tile layer
@ -42,7 +41,6 @@ export class MapManager {
maxZoom: 19
}).addTo(this.map);
console.log('Main map initialized');
return this.map;
}
@ -307,7 +305,6 @@ export class MapManager {
createHeatmapOverlay(data) {
// Simplified heatmap implementation
// In production, would use proper heatmap library like Leaflet.heat
console.log('Creating heatmap overlay with data:', data);
}
setSelectedSource(sourceId) {

View file

@ -14,12 +14,10 @@ export class WebSocketManager {
this.websocket = new WebSocket(wsUrl);
this.websocket.onopen = () => {
console.log('WebSocket connected');
this.onStatusChange('connected');
};
this.websocket.onclose = () => {
console.log('WebSocket disconnected');
this.onStatusChange('disconnected');
// Reconnect after 5 seconds
setTimeout(() => this.connect(), 5000);
@ -34,20 +32,6 @@ export class WebSocketManager {
try {
const message = JSON.parse(event.data);
// Debug: Log WebSocket messages to see what we're receiving
if (message.data && message.data.aircraft) {
const aircraftCount = Object.keys(message.data.aircraft).length;
console.log(`📡 WebSocket: ${message.type} with ${aircraftCount} aircraft`);
// Log first few aircraft with coordinates
let count = 0;
for (const [icao, aircraft] of Object.entries(message.data.aircraft)) {
if (count < 3 && aircraft.Latitude && aircraft.Longitude) {
console.log(`📡 ${icao}: lat=${aircraft.Latitude}, lon=${aircraft.Longitude}`);
}
count++;
}
}
this.onMessage(message);
} catch (error) {