feat: remove state preservation

This commit is contained in:
2025-09-19 21:12:15 +02:00
parent 262b03413a
commit 0aca182de9
6 changed files with 38 additions and 46 deletions

View File

@@ -1,6 +1,6 @@
// View Models for SPORE UI Components
// Cluster View Model with enhanced state preservation
// Cluster View Model
class ClusterViewModel extends ViewModel {
constructor() {
super();
@@ -23,7 +23,7 @@ class ClusterViewModel extends ViewModel {
}, 100);
}
// Update cluster members with state preservation
// Update cluster members
async updateClusterMembers() {
try {
logger.debug('ClusterViewModel: updateClusterMembers called');
@@ -45,12 +45,12 @@ class ClusterViewModel extends ViewModel {
? members.filter(m => m && m.status && m.status.toUpperCase() === 'ACTIVE').length
: 0;
// Use batch update to preserve UI state
// Use batch update
this.batchUpdate({
members: members,
lastUpdateTime: new Date().toISOString(),
onlineNodes: onlineNodes
}, { preserveUIState: true });
});
// Restore expanded cards and active tabs
this.set('expandedCards', currentExpandedCards);
@@ -69,12 +69,12 @@ class ClusterViewModel extends ViewModel {
}
}
// Update primary node display with state preservation
// Update primary node display
async updatePrimaryNodeDisplay() {
try {
const discoveryInfo = await window.apiClient.getDiscoveryInfo();
// Use batch update to preserve UI state
// Use batch update
const updates = {};
if (discoveryInfo.primaryNode) {
@@ -91,7 +91,7 @@ class ClusterViewModel extends ViewModel {
updates.totalNodes = 0;
}
this.batchUpdate(updates, { preserveUIState: true });
this.batchUpdate(updates);
} catch (error) {
console.error('Failed to fetch discovery info:', error);
@@ -208,7 +208,7 @@ class ClusterViewModel extends ViewModel {
}
}
// Node Details View Model with enhanced state preservation
// Node Details View Model
class NodeDetailsViewModel extends ViewModel {
constructor() {
super();
@@ -225,7 +225,7 @@ class NodeDetailsViewModel extends ViewModel {
});
}
// Load node details with state preservation
// Load node details
async loadNodeDetails(ip) {
try {
// Store current UI state
@@ -237,10 +237,10 @@ class NodeDetailsViewModel extends ViewModel {
const nodeStatus = await window.apiClient.getNodeStatus(ip);
// Use batch update to preserve UI state
// Use batch update
this.batchUpdate({
nodeStatus: nodeStatus
}, { preserveUIState: true });
});
// Restore active tab
this.set('activeTab', currentActiveTab);
@@ -262,7 +262,7 @@ class NodeDetailsViewModel extends ViewModel {
}
}
// Load tasks data with state preservation
// Load tasks data
async loadTasksData() {
try {
const ip = this.get('nodeIp');
@@ -276,7 +276,7 @@ class NodeDetailsViewModel extends ViewModel {
}
}
// Load endpoints data with state preservation
// Load endpoints data
async loadEndpointsData() {
try {
const ip = this.get('nodeIp');
@@ -290,7 +290,7 @@ class NodeDetailsViewModel extends ViewModel {
}
}
// Load monitoring resources data with state preservation
// Load monitoring resources data
async loadMonitoringResources() {
try {
const ip = this.get('nodeIp');