From 827b8c3a44cec5184c9c5bdfab9cf04e23d473e3 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 8 Sep 2025 16:43:14 +0200 Subject: [PATCH] =?UTF-8?q?Verbesserung:=20Hinzuf=C3=BCgen=20von=20Protoko?= =?UTF-8?q?llausgaben=20zur=20Fehlerdiagnose=20in=20StatusBar.vue=20und=20?= =?UTF-8?q?BranchView.vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ä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. --- .../src/components/falukant/StatusBar.vue | 3 ++ frontend/src/views/falukant/BranchView.vue | 42 +++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/falukant/StatusBar.vue b/frontend/src/components/falukant/StatusBar.vue index bd34c26..29ec93c 100644 --- a/frontend/src/components/falukant/StatusBar.vue +++ b/frontend/src/components/falukant/StatusBar.vue @@ -68,7 +68,9 @@ export default { methods: { async fetchStatus() { try { + console.log('🔄 StatusBar: fetchStatus() startet...'); const response = await apiClient.get("/api/falukant/info"); + console.log('📊 StatusBar: API Response erhalten:', response.data); const { money, character, events } = response.data; const { age, health } = character; const relationship = response.data.character.relationshipsAsCharacter1[0]?.relationshipType?.tr @@ -99,6 +101,7 @@ export default { { key: "events", icon: "📰", value: events || null, image: null }, { key: "children", icon: "👶", value: childrenDisplay }, ]; + console.log('📊 StatusBar: statusItems aktualisiert:', this.statusItems); } catch (error) { console.error("Error fetching status:", error); } diff --git a/frontend/src/views/falukant/BranchView.vue b/frontend/src/views/falukant/BranchView.vue index cc96737..7bad6fa 100644 --- a/frontend/src/views/falukant/BranchView.vue +++ b/frontend/src/views/falukant/BranchView.vue @@ -75,7 +75,7 @@ export default { // Daemon WebSocket deaktiviert - verwende Socket.io this.setupSocketEvents(); - // Live-Socket-Events + // Live-Socket-Events - nur für Events ohne spezielle Behandlung [ "production_ready", "stock_change", @@ -83,8 +83,6 @@ export default { "director_death", "production_started", "selled_items", - "falukantUpdateStatus", - "falukantBranchUpdate", "knowledge_update" ].forEach(eventName => { if (this.socket) { @@ -95,8 +93,10 @@ export default { beforeUnmount() { if (this.socket) { + // Entferne spezielle Event-Listener this.socket.off("falukantBranchUpdate"); this.socket.off("falukantUpdateStatus"); + // Entferne allgemeine Event-Listener this.socket.off("production_ready"); this.socket.off("stock_change"); this.socket.off("price_update"); @@ -247,10 +247,38 @@ export default { case 'falukantBranchUpdate': console.log('🔄 BranchView: Lade alle Sektionen für', eventData.event); console.log('🔄 BranchView: StatusBar ref:', this.$refs.statusBar); - this.$refs.statusBar?.fetchStatus(); - this.$refs.productionSection?.loadProductions(); - this.$refs.storageSection?.loadStorageData(); - this.$refs.saleSection?.loadInventory(); + 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':