package components import ( "context" "fmt" "github.com/starfleetcptn/gomft/internal/db" "os/exec" "strconv" "strings" ) type DashboardData struct { RecentJobs []db.JobHistory ActiveTransfers int CompletedToday int FailedTransfers int Configs map[uint]db.TransferConfig RcloneVersion string } // GetRcloneVersion executes the rclone --version command and returns the version string func GetRcloneVersion() string { cmd := exec.Command("rclone", "--version") output, err := cmd.Output() if err != nil { return "Unknown" } // Parse the version from output (typically first line contains "rclone v1.XX.X") outputStr := string(output) lines := strings.Split(outputStr, "\n") if len(lines) > 0 { parts := strings.Split(lines[0], " ") for _, part := range parts { if strings.HasPrefix(part, "v") { return part } } } return "Unknown" } templ Dashboard(ctx context.Context, data DashboardData) { @LayoutWithContext("Dashboard", ctx) {

Dashboard

Active Transfers

{ strconv.Itoa(data.ActiveTransfers) }
Currently in progress

Completed Today

{ strconv.Itoa(data.CompletedToday) }
Successfully completed

Failed Transfers

{ strconv.Itoa(data.FailedTransfers) }
Require attention

Recent Jobs

if len(data.RecentJobs) == 0 {

No recent jobs found

Get started by creating your first job.

Create your first job
} else {
    for _, job := range data.RecentJobs {
  • if job.Status == "completed" { } else if job.Status == "failed" { } else { }

    { getConfigNameForHistory(job, data.Configs) }

    Started: { job.StartTime.Format("Jan 02, 2006 15:04:05") }

    View
  • }
}

Quick Actions

Create New Config Create New Job View Transfer History

System Status

Server Online
Scheduler Running
Database Connected
Rclone if data.RcloneVersion != "" { { data.RcloneVersion } } else { Unknown }
} }