Merge pull request #8898 from bitsf/tag_retention_fix

tag retention fix duration and show trigger
This commit is contained in:
Daniel Jiang 2019-08-30 13:57:34 +08:00 committed by GitHub
commit fb56951259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -184,7 +184,7 @@ func (r *DefaultAPIController) TriggerRetentionExec(policyID int64, trigger stri
exec := &Execution{
PolicyID: policyID,
StartTime: time.Now(),
StartTime: time.Now().Truncate(time.Second),
Trigger: trigger,
DryRun: dryRun,
}

View File

@ -132,7 +132,7 @@ func (d *DefaultManager) GetPolicy(id int64) (*policy.Metadata, error) {
func (d *DefaultManager) CreateExecution(execution *Execution) (int64, error) {
exec := &models.RetentionExecution{}
exec.PolicyID = execution.PolicyID
exec.StartTime = time.Now()
exec.StartTime = execution.StartTime
exec.DryRun = execution.DryRun
exec.Trigger = execution.Trigger
return dao.CreateExecution(exec)
@ -160,6 +160,7 @@ func (d *DefaultManager) ListExecutions(policyID int64, query *q.Query) ([]*Exec
e1.Status = e.Status
e1.StartTime = e.StartTime
e1.EndTime = e.EndTime
e1.Trigger = e.Trigger
e1.DryRun = e.DryRun
execs1 = append(execs1, e1)
}
@ -183,6 +184,7 @@ func (d *DefaultManager) GetExecution(eid int64) (*Execution, error) {
e1.Status = e.Status
e1.StartTime = e.StartTime
e1.EndTime = e.EndTime
e1.Trigger = e.Trigger
e1.DryRun = e.DryRun
return e1, nil
}