feat: firmware upload on the cluster view
This commit is contained in:
@@ -958,4 +958,77 @@ class MonitoringViewModel extends ViewModel {
|
||||
async refresh() {
|
||||
await this.loadClusterData();
|
||||
}
|
||||
}
|
||||
|
||||
// Cluster Firmware Upload View Model
|
||||
class ClusterFirmwareViewModel extends ViewModel {
|
||||
constructor() {
|
||||
super();
|
||||
this.setMultiple({
|
||||
selectedFile: null,
|
||||
targetNodes: [],
|
||||
uploadProgress: null,
|
||||
uploadResults: [],
|
||||
isUploading: false
|
||||
});
|
||||
}
|
||||
|
||||
// Set selected file
|
||||
setSelectedFile(file) {
|
||||
this.set('selectedFile', file);
|
||||
}
|
||||
|
||||
// Set target nodes (filtered from cluster view)
|
||||
setTargetNodes(nodes) {
|
||||
this.set('targetNodes', nodes);
|
||||
}
|
||||
|
||||
// Start upload
|
||||
startUpload() {
|
||||
this.set('isUploading', true);
|
||||
this.set('uploadProgress', {
|
||||
current: 0,
|
||||
total: 0,
|
||||
status: 'Preparing...'
|
||||
});
|
||||
this.set('uploadResults', []);
|
||||
}
|
||||
|
||||
// Update upload progress
|
||||
updateUploadProgress(current, total, status) {
|
||||
this.set('uploadProgress', {
|
||||
current,
|
||||
total,
|
||||
status
|
||||
});
|
||||
}
|
||||
|
||||
// Add upload result
|
||||
addUploadResult(result) {
|
||||
const results = this.get('uploadResults');
|
||||
results.push(result);
|
||||
this.set('uploadResults', results);
|
||||
}
|
||||
|
||||
// Complete upload
|
||||
completeUpload() {
|
||||
this.set('isUploading', false);
|
||||
}
|
||||
|
||||
// Reset upload state
|
||||
resetUploadState() {
|
||||
this.set('selectedFile', null);
|
||||
this.set('uploadProgress', null);
|
||||
this.set('uploadResults', []);
|
||||
this.set('isUploading', false);
|
||||
}
|
||||
|
||||
// Check if deploy is enabled
|
||||
isDeployEnabled() {
|
||||
const file = this.get('selectedFile');
|
||||
const targetNodes = this.get('targetNodes');
|
||||
const isUploading = this.get('isUploading');
|
||||
|
||||
return file && targetNodes && targetNodes.length > 0 && !isUploading;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user