fix: primary node failover
This commit is contained in:
@@ -13,7 +13,8 @@ class ClusterViewModel extends ViewModel {
|
||||
error: null,
|
||||
expandedCards: new Map(),
|
||||
activeTabs: new Map(), // Store active tab for each node
|
||||
lastUpdateTime: null
|
||||
lastUpdateTime: null,
|
||||
onlineNodes: 0
|
||||
});
|
||||
|
||||
// Initialize cluster status after a short delay to allow components to subscribe
|
||||
@@ -39,10 +40,16 @@ class ClusterViewModel extends ViewModel {
|
||||
const response = await window.apiClient.getClusterMembers();
|
||||
console.log('ClusterViewModel: Got response:', response);
|
||||
|
||||
const members = response.members || [];
|
||||
const onlineNodes = Array.isArray(members)
|
||||
? members.filter(m => m && m.status === 'active').length
|
||||
: 0;
|
||||
|
||||
// Use batch update to preserve UI state
|
||||
this.batchUpdate({
|
||||
members: response.members || [],
|
||||
lastUpdateTime: new Date().toISOString()
|
||||
members: members,
|
||||
lastUpdateTime: new Date().toISOString(),
|
||||
onlineNodes: onlineNodes
|
||||
}, { preserveUIState: true });
|
||||
|
||||
// Restore expanded cards and active tabs
|
||||
|
||||
Reference in New Issue
Block a user