feat: introduce global config dialog
This commit is contained in:
@@ -1031,4 +1031,82 @@ class ClusterFirmwareViewModel extends ViewModel {
|
||||
|
||||
return file && targetNodes && targetNodes.length > 0 && !isUploading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// WiFi Configuration View Model
|
||||
class WiFiConfigViewModel extends ViewModel {
|
||||
constructor() {
|
||||
super();
|
||||
this.set('targetNodes', []);
|
||||
this.set('ssid', '');
|
||||
this.set('password', '');
|
||||
this.set('isConfiguring', false);
|
||||
this.set('configProgress', null);
|
||||
this.set('configResults', []);
|
||||
}
|
||||
|
||||
// Set target nodes (filtered from cluster view)
|
||||
setTargetNodes(nodes) {
|
||||
this.set('targetNodes', nodes);
|
||||
}
|
||||
|
||||
// Set WiFi credentials
|
||||
setCredentials(ssid, password) {
|
||||
this.set('ssid', ssid);
|
||||
this.set('password', password);
|
||||
}
|
||||
|
||||
// Start configuration
|
||||
startConfiguration() {
|
||||
this.set('isConfiguring', true);
|
||||
this.set('configProgress', {
|
||||
current: 0,
|
||||
total: 0,
|
||||
status: 'Preparing...'
|
||||
});
|
||||
this.set('configResults', []);
|
||||
}
|
||||
|
||||
// Update configuration progress
|
||||
updateConfigProgress(current, total, status) {
|
||||
this.set('configProgress', {
|
||||
current,
|
||||
total,
|
||||
status
|
||||
});
|
||||
}
|
||||
|
||||
// Add configuration result
|
||||
addConfigResult(result) {
|
||||
const results = this.get('configResults');
|
||||
results.push(result);
|
||||
this.set('configResults', results);
|
||||
}
|
||||
|
||||
// Complete configuration
|
||||
completeConfiguration() {
|
||||
this.set('isConfiguring', false);
|
||||
this.set('configProgress', null);
|
||||
}
|
||||
|
||||
// Reset configuration state
|
||||
resetConfiguration() {
|
||||
this.set('ssid', '');
|
||||
this.set('password', '');
|
||||
this.set('configProgress', null);
|
||||
this.set('configResults', []);
|
||||
this.set('isConfiguring', false);
|
||||
}
|
||||
|
||||
// Check if apply is enabled
|
||||
isApplyEnabled() {
|
||||
const ssid = this.get('ssid');
|
||||
const password = this.get('password');
|
||||
const targetNodes = this.get('targetNodes');
|
||||
const isConfiguring = this.get('isConfiguring');
|
||||
|
||||
return ssid && password && targetNodes && targetNodes.length > 0 && !isConfiguring;
|
||||
}
|
||||
}
|
||||
|
||||
window.WiFiConfigViewModel = WiFiConfigViewModel;
|
||||
Reference in New Issue
Block a user