Verbesserung: Hinzufügen von Protokollausgaben zur Fehlerdiagnose in StatusBar.vue und BranchView.vue

Änderungen:
- In der StatusBar.vue wurden Protokollausgaben hinzugefügt, um den Start und die Ergebnisse des fetchStatus-Aufrufs zu dokumentieren.
- In der BranchView.vue wurden Protokollausgaben hinzugefügt, um den Status der Aktualisierung der verschiedenen Sektionen zu verfolgen und sicherzustellen, dass die Referenzen verfügbar sind.

Diese Anpassungen erhöhen die Nachvollziehbarkeit der Eventverarbeitung und erleichtern die Fehlersuche.
This commit is contained in:
Torsten Schulz (local)
2025-09-08 16:43:14 +02:00
parent 5e2a091380
commit 827b8c3a44
2 changed files with 38 additions and 7 deletions

View File

@@ -68,7 +68,9 @@ export default {
methods: { methods: {
async fetchStatus() { async fetchStatus() {
try { try {
console.log('🔄 StatusBar: fetchStatus() startet...');
const response = await apiClient.get("/api/falukant/info"); const response = await apiClient.get("/api/falukant/info");
console.log('📊 StatusBar: API Response erhalten:', response.data);
const { money, character, events } = response.data; const { money, character, events } = response.data;
const { age, health } = character; const { age, health } = character;
const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr
@@ -99,6 +101,7 @@ export default {
{ key: "events", icon: "📰", value: events || null, image: null }, { key: "events", icon: "📰", value: events || null, image: null },
{ key: "children", icon: "👶", value: childrenDisplay }, { key: "children", icon: "👶", value: childrenDisplay },
]; ];
console.log('📊 StatusBar: statusItems aktualisiert:', this.statusItems);
} catch (error) { } catch (error) {
console.error("Error fetching status:", error); console.error("Error fetching status:", error);
} }

View File

@@ -75,7 +75,7 @@ export default {
// Daemon WebSocket deaktiviert - verwende Socket.io // Daemon WebSocket deaktiviert - verwende Socket.io
this.setupSocketEvents(); this.setupSocketEvents();
// Live-Socket-Events // Live-Socket-Events - nur für Events ohne spezielle Behandlung
[ [
"production_ready", "production_ready",
"stock_change", "stock_change",
@@ -83,8 +83,6 @@ export default {
"director_death", "director_death",
"production_started", "production_started",
"selled_items", "selled_items",
"falukantUpdateStatus",
"falukantBranchUpdate",
"knowledge_update" "knowledge_update"
].forEach(eventName => { ].forEach(eventName => {
if (this.socket) { if (this.socket) {
@@ -95,8 +93,10 @@ export default {
beforeUnmount() { beforeUnmount() {
if (this.socket) { if (this.socket) {
// Entferne spezielle Event-Listener
this.socket.off("falukantBranchUpdate"); this.socket.off("falukantBranchUpdate");
this.socket.off("falukantUpdateStatus"); this.socket.off("falukantUpdateStatus");
// Entferne allgemeine Event-Listener
this.socket.off("production_ready"); this.socket.off("production_ready");
this.socket.off("stock_change"); this.socket.off("stock_change");
this.socket.off("price_update"); this.socket.off("price_update");
@@ -247,10 +247,38 @@ export default {
case 'falukantBranchUpdate': case 'falukantBranchUpdate':
console.log('🔄 BranchView: Lade alle Sektionen für', eventData.event); console.log('🔄 BranchView: Lade alle Sektionen für', eventData.event);
console.log('🔄 BranchView: StatusBar ref:', this.$refs.statusBar); console.log('🔄 BranchView: StatusBar ref:', this.$refs.statusBar);
this.$refs.statusBar?.fetchStatus(); console.log('🔄 BranchView: ProductionSection ref:', this.$refs.productionSection);
this.$refs.productionSection?.loadProductions(); console.log('🔄 BranchView: StorageSection ref:', this.$refs.storageSection);
this.$refs.storageSection?.loadStorageData(); console.log('🔄 BranchView: SaleSection ref:', this.$refs.saleSection);
this.$refs.saleSection?.loadInventory();
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'); console.log('✅ BranchView: Alle Sektionen aktualisiert');
break; break;
case 'knowledge_update': case 'knowledge_update':