package components import ( "context" "fmt" "github.com/starfleetcptn/gomft/internal/db" ) // Dialog component for confirmation dialogs - copied from admin_tools.templ templ JobDialog(id string, title string, message string, confirmClass string, confirmText string, action string, jobID uint, jobName string) { } script hideJobDialog(id string) { document.getElementById(id).classList.add("hidden"); } script showJobDialog(id string) { document.getElementById(id).classList.remove("hidden"); } script triggerJobDelete(dialogId string, jobID uint, jobName string) { // Hide the dialog document.getElementById(dialogId).classList.add("hidden"); // Add debugging info console.log(`Job deletion triggered for: ${jobName} (ID: ${jobID})`); // Store data in a way that's accessible to event handlers window.lastDeletedJob = { id: jobID, name: jobName }; // Add custom marker to track this deletion window.currentlyDeletingJob = true; } type JobsData struct { Jobs []db.Job ConfigCount map[uint]int // Maps job ID to number of configs } templ Jobs(ctx context.Context, data JobsData) { @LayoutWithContext("Transfer Jobs", ctx) {

Transfer Jobs

New Job
if len(data.Jobs) == 0 {

No jobs

Get started by creating a new transfer job.

} else {
    for _, job := range data.Jobs {
  • if job.Name != "" { { job.Name } } else { { job.Config.Name } }

    if job.GetEnabled() { Active } else { Inactive }
    Edit @JobDialog( fmt.Sprintf("delete-job-dialog-%d", job.ID), "Delete Job", fmt.Sprintf("Are you sure you want to delete the job '%s'? This cannot be undone.", determineJobName(job)), "btn-danger", "Delete", "delete", job.ID, determineJobName(job), )

    Configs: if count, ok := data.ConfigCount[job.ID]; ok && count > 1 { { fmt.Sprintf("%d configurations", count) } } else if job.ConfigID > 0 { { job.Config.Name } } else { { "None" } }

    Schedule: { job.Schedule }

    if job.LastRun != nil {

    Last Run: { job.LastRun.Format("2006-01-02 15:04:05") }

    }
    if job.NextRun != nil {

    Next Run: { job.NextRun.Format("2006-01-02 15:04:05") }

    }
  • }
}

Transfer jobs run according to their schedule and transfer files between configured sources and destinations

} } // Helper function to determine the job name (reuse this logic to keep it consistent) func determineJobName(job db.Job) string { if job.Name != "" { return job.Name } return job.Config.Name }