Änderung: Bereinigung und Optimierung der Protokollausgaben in mehreren Vue-Komponenten

Änderungen:
- Entfernen von überflüssigen Protokollausgaben in den Methoden `setupSocketEvents` und `handleEvent` in den Komponenten BankView.vue, BranchView.vue, DirectorView.vue, FamilyView.vue, HealthView.vue, HouseView.vue, NobilityView.vue und OverviewView.vue.
- Diese Anpassungen verbessern die Lesbarkeit des Codes und reduzieren die Menge an Konsolenausgaben, was die Wartbarkeit der Anwendung erhöht.
This commit is contained in:
Torsten Schulz (local)
2025-09-12 15:38:45 +02:00
parent 2a3a2b258f
commit b26bc0eb8b
9 changed files with 2 additions and 73 deletions

View File

@@ -133,23 +133,17 @@ export default {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 BankView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
console.log('✅ BankView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ BankView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 BankView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
this.loadBankOverview(); this.loadBankOverview();
break; break;
default:
console.log('⚠️ BankView: Unbekanntes Event:', eventData.event);
} }
}, },
async loadBankOverview() { async loadBankOverview() {

View File

@@ -202,8 +202,6 @@ export default {
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 BranchView: handleEvent aufgerufen mit:', eventData);
console.log('🔄 BranchView: Event-Typ:', eventData.event);
switch (eventData.event) { switch (eventData.event) {
case 'production_ready': case 'production_ready':
this.$refs.productionSection?.loadProductions(); this.$refs.productionSection?.loadProductions();
@@ -229,41 +227,21 @@ export default {
break; break;
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
case 'falukantBranchUpdate': case 'falukantBranchUpdate':
console.log('🔄 BranchView: Lade alle Sektionen für', eventData.event);
console.log('🔄 BranchView: StatusBar ref:', this.$refs.statusBar);
console.log('🔄 BranchView: ProductionSection ref:', this.$refs.productionSection);
console.log('🔄 BranchView: StorageSection ref:', this.$refs.storageSection);
console.log('🔄 BranchView: SaleSection ref:', this.$refs.saleSection);
if (this.$refs.statusBar) { if (this.$refs.statusBar) {
console.log('🔄 BranchView: Rufe StatusBar.fetchStatus() auf...');
this.$refs.statusBar.fetchStatus(); this.$refs.statusBar.fetchStatus();
} else {
console.log('⚠️ BranchView: StatusBar ref nicht verfügbar');
} }
if (this.$refs.productionSection) { if (this.$refs.productionSection) {
console.log('🔄 BranchView: Rufe ProductionSection.loadProductions() auf...');
this.$refs.productionSection.loadProductions(); this.$refs.productionSection.loadProductions();
} else {
console.log('⚠️ BranchView: ProductionSection ref nicht verfügbar');
} }
if (this.$refs.storageSection) { if (this.$refs.storageSection) {
console.log('🔄 BranchView: Rufe StorageSection.loadStorageData() auf...');
this.$refs.storageSection.loadStorageData(); this.$refs.storageSection.loadStorageData();
} else {
console.log('⚠️ BranchView: StorageSection ref nicht verfügbar');
} }
if (this.$refs.saleSection) { if (this.$refs.saleSection) {
console.log('🔄 BranchView: Rufe SaleSection.loadInventory() auf...');
this.$refs.saleSection.loadInventory(); this.$refs.saleSection.loadInventory();
} else {
console.log('⚠️ BranchView: SaleSection ref nicht verfügbar');
} }
console.log('✅ BranchView: Alle Sektionen aktualisiert');
break; break;
case 'knowledge_update': case 'knowledge_update':
this.loadProducts(); this.loadProducts();

View File

@@ -53,18 +53,15 @@ export default {
...mapActions(['createFalukant']), ...mapActions(['createFalukant']),
async createFalukant() { async createFalukant() {
const newUser = await apiClient.post('/api/falukant/user', this.falukant); const newUser = await apiClient.post('/api/falukant/user', this.falukant);
console.log(newUser);
this.$router.push({ name: 'FalukantOverview' }); this.$router.push({ name: 'FalukantOverview' });
}, },
async randomFirstName() { async randomFirstName() {
const randomNameResult = await apiClient.get('/api/falukant/name/randomfirstname/' + this.falukant.gender); const randomNameResult = await apiClient.get('/api/falukant/name/randomfirstname/' + this.falukant.gender);
this.falukant.firstname = randomNameResult.data.name; this.falukant.firstname = randomNameResult.data.name;
console.log(this.falukant, randomNameResult);
}, },
async randomLastName() { async randomLastName() {
const randomNameResult = await apiClient.get('/api/falukant/name/randomlastname'); const randomNameResult = await apiClient.get('/api/falukant/name/randomlastname');
this.falukant.lastname = randomNameResult.data.name; this.falukant.lastname = randomNameResult.data.name;
console.log(this.falukant, randomNameResult);
}, },
}, },
}; };

View File

@@ -107,23 +107,17 @@ export default {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 DirectorView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
console.log('✅ DirectorView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ DirectorView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 DirectorView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
this.loadDirectors(); this.loadDirectors();
break; break;
default:
console.log('⚠️ DirectorView: Unbekanntes Event:', eventData.event);
} }
}, },
async loadDirectors() { async loadDirectors() {

View File

@@ -207,28 +207,21 @@ export default {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 FamilyView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
this.socket.on('familychanged', (data) => { this.socket.on('familychanged', (data) => {
console.log('📨 FamilyView: familychanged empfangen:', data);
this.handleEvent({ event: 'familychanged', ...data }); this.handleEvent({ event: 'familychanged', ...data });
}); });
console.log('✅ FamilyView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ FamilyView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 FamilyView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
case 'familychanged': case 'familychanged':
this.loadFamilyData(); this.loadFamilyData();
break; break;
default:
console.log('⚠️ FamilyView: Unbekanntes Event:', eventData.event);
} }
}, },
async loadFamilyData() { async loadFamilyData() {

View File

@@ -98,23 +98,17 @@ export default {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 HealthView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
console.log('✅ HealthView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ HealthView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 HealthView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
this.loadHealthData(); this.loadHealthData();
break; break;
default:
console.log('⚠️ HealthView: Unbekanntes Event:', eventData.event);
} }
}, },
async loadHealthData() { async loadHealthData() {

View File

@@ -193,28 +193,21 @@ export default {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantHouseUpdate', (data) => { this.socket.on('falukantHouseUpdate', (data) => {
console.log('📨 HouseView: falukantHouseUpdate empfangen:', data);
this.handleEvent({ event: 'falukantHouseUpdate', ...data }); this.handleEvent({ event: 'falukantHouseUpdate', ...data });
}); });
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 HouseView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
console.log('✅ HouseView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ HouseView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 HouseView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
case 'falukantHouseUpdate': case 'falukantHouseUpdate':
this.loadData(); this.loadData();
break; break;
default:
console.log('⚠️ HouseView: Unbekanntes Event:', eventData.event);
} }
} }
}, },

View File

@@ -82,24 +82,18 @@
methods: { methods: {
setupSocketEvents() { setupSocketEvents() {
if (this.socket) { if (this.socket) {
this.socket.on('falukantUpdateStatus', (data) => { this.socket.on('falukantUpdateStatus', (data) => {
console.log('📨 NobilityView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
console.log('✅ NobilityView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ NobilityView: Socket.io noch nicht verfügbar');
setTimeout(() => this.setupSocketEvents(), 1000); setTimeout(() => this.setupSocketEvents(), 1000);
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 NobilityView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
this.loadNobility(); this.loadNobility();
break; break;
default:
console.log('⚠️ NobilityView: Unbekanntes Event:', eventData.event);
} }
}, },
async loadNobility() { async loadNobility() {

View File

@@ -206,7 +206,6 @@ export default {
watch: { watch: {
socket(newSocket) { socket(newSocket) {
if (newSocket) { if (newSocket) {
console.log('🔌 Socket.io verfügbar - registriere Events');
this.setupSocketEvents(); this.setupSocketEvents();
} }
} }
@@ -231,16 +230,12 @@ export default {
this.socket.on("falukantUserUpdated", this.fetchFalukantUser); this.socket.on("falukantUserUpdated", this.fetchFalukantUser);
this.socket.on("production_ready", this.handleProductionReadyEvent); this.socket.on("production_ready", this.handleProductionReadyEvent);
this.socket.on("falukantUpdateStatus", (data) => { this.socket.on("falukantUpdateStatus", (data) => {
console.log('📨 FalukantOverviewView: falukantUpdateStatus empfangen:', data);
this.handleEvent({ event: 'falukantUpdateStatus', ...data }); this.handleEvent({ event: 'falukantUpdateStatus', ...data });
}); });
this.socket.on("falukantBranchUpdate", (data) => { this.socket.on("falukantBranchUpdate", (data) => {
console.log('📨 FalukantOverviewView: falukantBranchUpdate empfangen:', data);
this.handleEvent({ event: 'falukantBranchUpdate', ...data }); this.handleEvent({ event: 'falukantBranchUpdate', ...data });
}); });
console.log('✅ FalukantOverviewView: Socket.io Events registriert');
} else { } else {
console.log('⚠️ FalukantOverviewView: Socket.io noch nicht verfügbar, versuche es später...');
// Versuche es nach kurzer Verzögerung erneut // Versuche es nach kurzer Verzögerung erneut
setTimeout(() => { setTimeout(() => {
this.setupSocketEvents(); this.setupSocketEvents();
@@ -248,14 +243,11 @@ export default {
} }
}, },
handleEvent(eventData) { handleEvent(eventData) {
console.log('🔄 FalukantOverviewView: handleEvent aufgerufen mit:', eventData);
switch (eventData.event) { switch (eventData.event) {
case 'falukantUpdateStatus': case 'falukantUpdateStatus':
case 'falukantBranchUpdate': case 'falukantBranchUpdate':
this.fetchFalukantUser(); this.fetchFalukantUser();
break; break;
default:
console.log('⚠️ FalukantOverviewView: Unbekanntes Event:', eventData.event);
} }
}, },
getAgeGroup(age) { getAgeGroup(age) {