Merge pull request #32628 from aaronlehmann/zero-timestamps
Hide zero-valued timestamps from service JSON
This commit is contained in:
commit
3977d2c440
2 changed files with 4 additions and 4 deletions
|
@ -224,7 +224,7 @@ func (ctx *serviceInspectContext) HasUpdateStatusStarted() bool {
|
|||
}
|
||||
|
||||
func (ctx *serviceInspectContext) UpdateStatusStarted() string {
|
||||
return units.HumanDuration(time.Since(*ctx.Service.UpdateStatus.StartedAt))
|
||||
return units.HumanDuration(time.Since(*ctx.Service.UpdateStatus.StartedAt)) + " ago"
|
||||
}
|
||||
|
||||
func (ctx *serviceInspectContext) UpdateIsCompleted() bool {
|
||||
|
@ -232,7 +232,7 @@ func (ctx *serviceInspectContext) UpdateIsCompleted() bool {
|
|||
}
|
||||
|
||||
func (ctx *serviceInspectContext) UpdateStatusCompleted() string {
|
||||
return units.HumanDuration(time.Since(*ctx.Service.UpdateStatus.CompletedAt))
|
||||
return units.HumanDuration(time.Since(*ctx.Service.UpdateStatus.CompletedAt)) + " ago"
|
||||
}
|
||||
|
||||
func (ctx *serviceInspectContext) UpdateStatusMessage() string {
|
||||
|
|
|
@ -58,12 +58,12 @@ func ServiceFromGRPC(s swarmapi.Service) (types.Service, error) {
|
|||
}
|
||||
|
||||
startedAt, _ := gogotypes.TimestampFromProto(s.UpdateStatus.StartedAt)
|
||||
if !startedAt.IsZero() {
|
||||
if !startedAt.IsZero() && startedAt.Unix() != 0 {
|
||||
service.UpdateStatus.StartedAt = &startedAt
|
||||
}
|
||||
|
||||
completedAt, _ := gogotypes.TimestampFromProto(s.UpdateStatus.CompletedAt)
|
||||
if !completedAt.IsZero() {
|
||||
if !completedAt.IsZero() && completedAt.Unix() != 0 {
|
||||
service.UpdateStatus.CompletedAt = &completedAt
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue