Started working on job UI implementation
This commit is contained in:
16
utils/JobInfo.go
Normal file
16
utils/JobInfo.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user