Merge remote-tracking branch 'remotes/stokito/uptime'

This commit is contained in:
Bradley Cicenas
2021-06-10 22:01:45 -04:00
7 changed files with 42 additions and 3 deletions

View File

@@ -79,6 +79,15 @@ var Sorters = map[string]sortMethod{
}
return stateMap[c1state] > stateMap[c2state]
},
"uptime": func(c1, c2 *Container) bool {
// Use secondary sort method if equal values
c1Uptime := c1.GetMeta("uptime")
c2Uptime := c2.GetMeta("uptime")
if c1Uptime == c2Uptime {
return nameSorter(c1, c2)
}
return c1Uptime > c2Uptime
},
}
func SortFields() (fields []string) {