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: {
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);
}

View File

@@ -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':