mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Separate built-in authentication options for source and destination in configuration forms. - Update UI components to reflect changes in authentication handling for Google Drive and Google Photos. - Implement path validation for local directories in the configuration forms, enhancing user experience. - Revise README to clarify supported source and destination types, including updated terminology for Google Drive. - Introduce new API endpoint for path validation, improving error handling and user feedback.
227 lines
10 KiB
Templ
227 lines
10 KiB
Templ
package common
|
|
|
|
templ NameField() {
|
|
<div class="space-y-6">
|
|
<div class="sm:col-span-4">
|
|
<label for="name" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Name</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-tag text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<input type="text" name="name" id="name" x-model="name" required
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500"
|
|
placeholder="Transfer configuration name" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ FilePatternFields() {
|
|
<div class="space-y-6">
|
|
<div class="sm:col-span-4">
|
|
<label for="file_pattern" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">File
|
|
Pattern</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-filter text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<input type="text" name="file_pattern" id="file_pattern" x-model="filePattern"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500"
|
|
placeholder="*.txt, *.csv" />
|
|
</div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Glob pattern for files to transfer. Leave empty to transfer all files.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="sm:col-span-4">
|
|
<label for="output_pattern"
|
|
class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Output Pattern</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-file-export text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<input type="text" name="output_pattern" id="output_pattern" x-model="outputPattern"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500"
|
|
placeholder="${filename}" />
|
|
</div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Pattern for output filename. Use variables like ${`filename`}, ${`timestamp`}, ${`date`}
|
|
</p>
|
|
<div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Pattern for filenames. Available variables:<br />
|
|
${`filename`} - Original filename without extension (e.g., "report")<br />
|
|
${`ext`} - Original file extension (e.g., "csv")<br />
|
|
${`date:format`} - Current date using Go's time format:<br />
|
|
• 2006-01-02 → YYYY-MM-DD<br />
|
|
• 20060102 → YYYYMMDD<br />
|
|
• 2006-01-02 15:04:05 → YYYY-MM-DD_HH:MM:SS<br />
|
|
Example: ${`filename`}_${`date:2006-01-02`}_${`ext`} → "report_2023-03-01.csv"
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ ArchiveOptions() {
|
|
<div class="border border-secondary-200 dark:border-secondary-700 rounded-lg p-6 bg-secondary-50 dark:bg-secondary-800/50 shadow-sm">
|
|
<h3 class="text-lg font-medium text-secondary-900 dark:text-secondary-100 mb-4">Archive & Delete Options</h3>
|
|
|
|
<div class="mb-4">
|
|
<label for="archive_enabled" class="flex items-center cursor-pointer">
|
|
<div class="relative">
|
|
<input id="archive_enabled" name="archive_enabled" type="checkbox" x-model="archiveEnabled"
|
|
class="sr-only"
|
|
:value="archiveEnabled ? 'true' : 'false'"
|
|
/>
|
|
<div class="block bg-secondary-200 dark:bg-secondary-700 w-14 h-8 rounded-full"></div>
|
|
<div class="dot absolute left-1 top-1 bg-white dark:bg-secondary-100 w-6 h-6 rounded-full transition"
|
|
:class="archiveEnabled ? 'transform translate-x-6 bg-primary-500' : ''"></div>
|
|
</div>
|
|
<div class="ml-3 text-secondary-700 dark:text-secondary-300 font-medium">
|
|
Enable archiving
|
|
</div>
|
|
</label>
|
|
</div>
|
|
|
|
<div class="mb-4" x-show="archiveEnabled">
|
|
<label for="archive_path" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Archive Path</label>
|
|
<div class="relative">
|
|
<span class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-folder text-secondary-400 dark:text-secondary-600"></i>
|
|
</span>
|
|
<input id="archive_path" name="archive_path" type="text"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500"
|
|
placeholder="Path to archive files"
|
|
x-model="archivePath"
|
|
/>
|
|
</div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Files will be moved here after successful transfer
|
|
</p>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="delete_after_transfer" class="flex items-center cursor-pointer">
|
|
<div class="relative">
|
|
<input id="delete_after_transfer" name="delete_after_transfer" type="checkbox" x-model="deleteAfterTransfer"
|
|
class="sr-only"
|
|
:value="deleteAfterTransfer ? 'true' : 'false'"
|
|
/>
|
|
<div class="block bg-secondary-200 dark:bg-secondary-700 w-14 h-8 rounded-full"></div>
|
|
<div class="dot absolute left-1 top-1 bg-white dark:bg-secondary-100 w-6 h-6 rounded-full transition"
|
|
:class="deleteAfterTransfer ? 'transform translate-x-6 bg-red-500' : ''"></div>
|
|
</div>
|
|
<div class="ml-3 text-secondary-700 dark:text-secondary-300 font-medium">
|
|
Delete source files after transfer
|
|
</div>
|
|
</label>
|
|
<p class="mt-1 ml-14 text-xs text-red-500 dark:text-red-400" x-show="deleteAfterTransfer">
|
|
<i class="fas fa-exclamation-triangle mr-1"></i> Warning: This will permanently delete the original files
|
|
</p>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="skip_processed_files" class="flex items-center cursor-pointer">
|
|
<div class="relative">
|
|
<input id="skip_processed_files" name="skip_processed_files" type="checkbox" x-model="skipProcessedFiles"
|
|
class="sr-only"
|
|
:value="skipProcessedFiles ? 'true' : 'false'"
|
|
/>
|
|
<div class="block bg-secondary-200 dark:bg-secondary-700 w-14 h-8 rounded-full"></div>
|
|
<div class="dot absolute left-1 top-1 bg-white dark:bg-secondary-100 w-6 h-6 rounded-full transition"
|
|
:class="skipProcessedFiles ? 'transform translate-x-6 bg-primary-500' : ''"></div>
|
|
</div>
|
|
<div class="ml-3 text-secondary-700 dark:text-secondary-300 font-medium">
|
|
Skip files that have already been processed
|
|
</div>
|
|
</label>
|
|
<p class="mt-1 ml-14 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Files with the same hash that have been successfully processed before will be skipped
|
|
</p>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="max_concurrent_transfers" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Concurrent Transfers</label>
|
|
<div class="flex items-center">
|
|
<input type="range" id="max_concurrent_transfers" name="max_concurrent_transfers"
|
|
class="form-range w-2/3 h-2 bg-secondary-200 dark:bg-secondary-700 rounded-lg appearance-none cursor-pointer"
|
|
min="1" max="32" step="1"
|
|
x-model="maxConcurrentTransfers"
|
|
/>
|
|
<span class="ml-4 text-secondary-700 dark:text-secondary-300" x-text="maxConcurrentTransfers"></span>
|
|
</div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Number of files to transfer simultaneously (higher values may improve performance but increase resource usage)
|
|
</p>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ RcloneFlags() {
|
|
<div>
|
|
<label for="rclone_flags" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300">Rclone Flags</label>
|
|
<div class="mt-1 relative rounded-md shadow-sm">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-flag text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<input type="text" name="rclone_flags" id="rclone_flags" x-model="rcloneFlags"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500"
|
|
placeholder="--transfers 4 --checkers 8" />
|
|
</div>
|
|
<p class="mt-1 text-xs text-secondary-500 dark:text-secondary-400">
|
|
Optional: Additional rclone flags for fine-tuning the transfer.
|
|
</p>
|
|
</div>
|
|
}
|
|
|
|
templ SourceSelection() {
|
|
<div class="sm:col-span-3">
|
|
<label for="source_type" class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Source
|
|
Type</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-server text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<select id="source_type" name="source_type" x-model="sourceType"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500">
|
|
<option value="local">Local</option>
|
|
<option value="sftp">SFTP</option>
|
|
<option value="ftp">FTP</option>
|
|
<option value="s3">S3</option>
|
|
<option value="minio">MinIO</option>
|
|
<option value="smb">SMB</option>
|
|
<option value="nextcloud">NextCloud</option>
|
|
<option value="webdav">WebDAV</option>
|
|
<option value="gdrive">Google Drive</option>
|
|
<option value="gphotos">Google Photos</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ DestinationSelection() {
|
|
<div class="sm:col-span-3">
|
|
<label for="destination_type"
|
|
class="block text-sm font-medium text-secondary-700 dark:text-secondary-300 mb-1">Destination Type</label>
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<i class="fas fa-server text-secondary-400 dark:text-secondary-600"></i>
|
|
</div>
|
|
<select id="destination_type" name="destination_type" x-model="destinationType"
|
|
class="form-input pl-10 w-full rounded-lg border-secondary-300 dark:border-secondary-700 dark:bg-secondary-800 dark:text-secondary-100 focus:ring-primary-500 focus:border-primary-500">
|
|
<option value="local">Local</option>
|
|
<option value="sftp">SFTP</option>
|
|
<option value="ftp">FTP</option>
|
|
<option value="s3">S3</option>
|
|
<option value="minio">MinIO</option>
|
|
<option value="smb">SMB</option>
|
|
<option value="nextcloud">NextCloud</option>
|
|
<option value="webdav">WebDAV</option>
|
|
<option value="gdrive">Google Drive</option>
|
|
<option value="gphotos">Google Photos</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
} |