mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Implement FileMetadata model to track processed files - Create file metadata handlers for listing, searching, and viewing files - Add file metadata routes and UI components - Support advanced file search with multiple filters - Enhance job execution to capture file metadata during transfers - Implement file hash and duplicate detection logic
188 lines
8.0 KiB
Templ
188 lines
8.0 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-gray-500">
|
|
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-gray-200 rounded-lg p-6 bg-gray-50 shadow-sm">
|
|
<h3 class="text-lg font-medium text-gray-900 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-gray-200 w-14 h-8 rounded-full"></div>
|
|
<div class="dot absolute left-1 top-1 bg-white w-6 h-6 rounded-full transition"
|
|
:class="archiveEnabled ? 'transform translate-x-6 bg-primary-500' : ''"></div>
|
|
</div>
|
|
<div class="ml-3 text-gray-700 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-gray-700 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-gray-400"></i>
|
|
</span>
|
|
<input id="archive_path" name="archive_path" type="text"
|
|
class="pl-10 pr-10 py-2 border border-gray-300 rounded-md focus:ring-primary-500 focus:border-primary-500 block w-full shadow-sm"
|
|
placeholder="Path to archive files"
|
|
x-model="archivePath"
|
|
/>
|
|
</div>
|
|
<p class="mt-1 text-xs text-gray-500">
|
|
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-gray-200 w-14 h-8 rounded-full"></div>
|
|
<div class="dot absolute left-1 top-1 bg-white w-6 h-6 rounded-full transition"
|
|
:class="deleteAfterTransfer ? 'transform translate-x-6 bg-red-500' : ''"></div>
|
|
</div>
|
|
<div class="ml-3 text-gray-700 font-medium">
|
|
Delete source files after transfer
|
|
</div>
|
|
</label>
|
|
<p class="mt-1 ml-14 text-xs text-red-500" x-show="deleteAfterTransfer">
|
|
<i class="fas fa-exclamation-triangle mr-1"></i> Warning: This will permanently delete the original files
|
|
</p>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
templ RcloneFlags() {
|
|
<div>
|
|
<label for="rclone_flags" class="block text-sm font-medium text-gray-700">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-gray-400"></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-gray-500">
|
|
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>
|
|
</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>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
} |