feat: Implement command flag management for rclone configurations

- Added functionality to manage command flags and their values in the configuration form.
- Updated the database schema to include a new field for storing command flag values.
- Enhanced backend logic to process and store flag values for non-boolean flags during configuration creation and updates.
- Improved the user interface to dynamically require destination fields based on selected commands.
- Refactored related templates and handlers to support the new command flag management features.
This commit is contained in:
StarFleetCPTN committed 2025-03-23 20:30:02 -07:00
1 parent 0cebfcf1f5
commit 233f1779d8
20 files changed
+457 -239

No files matched your search

+1
View File
@@ -126,6 +126,7 @@ type TransferConfig struct {
// Rclone command fields
CommandID uint `gorm:"default:1" form:"command_id"` // Default to 'copy' command ID (1)
CommandFlags string `form:"command_flags"` // JSON string of selected flags
CommandFlagValues string `form:"command_flag_values"` // JSON string of flag values by ID
DeleteAfterTransfer *bool `gorm:"default:false" form:"delete_after_transfer"`
SkipProcessedFiles *bool `gorm:"default:true" form:"skip_processed_files"`
MaxConcurrentTransfers int `gorm:"default:4" form:"max_concurrent_transfers"` // Number of concurrent file transfers
@@ -78,6 +78,10 @@ func AddRcloneCommandToConfig() *gormigrate.Migration {
return err
}
if err := tx.Exec(`ALTER TABLE transfer_configs ADD COLUMN command_flag_values TEXT DEFAULT NULL`).Error; err != nil {
return err
}
return nil
},
Rollback: func(tx *gorm.DB) error {
@@ -90,6 +94,10 @@ func AddRcloneCommandToConfig() *gormigrate.Migration {
return err
}
if err := tx.Exec(`ALTER TABLE transfer_configs DROP COLUMN command_flag_values`).Error; err != nil {
return err
}
return nil
},
}