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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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