package components import ( "context" "fmt" "github.com/starfleetcptn/gomft/internal/db" "time" ) type JobRunDetailsData struct { JobHistory db.JobHistory Job db.Job Config db.TransferConfig } templ JobRunDetails(ctx context.Context, data JobRunDetailsData) { @LayoutWithContext("Job Run Details", ctx) { @JobRunDetailsContent(ctx, data) } } // JobRunDetailsContent is the same as JobRunDetails but without the layout wrapper // This is used for testing templ JobRunDetailsContent(ctx context.Context, data JobRunDetailsData) {
Back to Dashboard

Job Run Details

{ data.Job.Name }

if data.JobHistory.Status == "completed" { Completed } else if data.JobHistory.Status == "failed" { Failed } else { Running }

Config: { data.Config.Name }

Start Time
{ data.JobHistory.StartTime.Format("Jan 02, 2006 15:04:05") }
End Time
if data.JobHistory.EndTime != nil { { data.JobHistory.EndTime.Format("Jan 02, 2006 15:04:05") } } else { In progress }
Duration
if data.JobHistory.EndTime != nil { { data.JobHistory.EndTime.Sub(data.JobHistory.StartTime).String() } } else { In progress }
Data Transferred
{ formatBytes(data.JobHistory.BytesTransferred) }
Files Transferred
{ fmt.Sprintf("%d files", data.JobHistory.FilesTransferred) }
Job Schedule
{ data.Job.Schedule }

Transfer Configuration

Source Type
{ data.Config.SourceType }
Destination Type
{ data.Config.DestinationType }
Source Path
{ data.Config.SourcePath }
Destination Path
{ data.Config.DestinationPath }
File Pattern
{ data.Config.FilePattern }
if data.JobHistory.Status == "failed" && data.JobHistory.ErrorMessage != "" {

Error Information

{ data.JobHistory.ErrorMessage }
}
View All Jobs Edit Job
} // formatDuration formats a duration in a human-readable way func formatDuration(d time.Duration) string { d = d.Round(time.Second) h := d / time.Hour d -= h * time.Hour m := d / time.Minute d -= m * time.Minute s := d / time.Second if h > 0 { return fmt.Sprintf("%dh %dm %ds", h, m, s) } if m > 0 { return fmt.Sprintf("%dm %ds", m, s) } return fmt.Sprintf("%ds", s) }