Started working on job UI implementation

This commit is contained in:
2018-04-28 19:44:44 +02:00
parent 3983894a27
commit 59633707c1
6 changed files with 61 additions and 1 deletions

16
utils/JobInfo.go Normal file
View File

@ -0,0 +1,16 @@
package utils
import "time"
// JobInfo gives you information about a background job.
type JobInfo struct {
Name string
LastStarted time.Time
LastFinished time.Time
}
// IsRunning tells you whether the given job is running or not.
func (job *JobInfo) IsRunning() bool {
now := time.Now()
return job.LastStarted.After(job.LastFinished) && !now.After(job.LastFinished)
}