mirror of
https://github.com/coder/coder.git
synced 2025-07-21 01:28:49 +00:00
feat: display current version on coder list (#11450)
* feat: display current version on coder list * fix make gen * update golden
This commit is contained in:
49
cli/list.go
49
cli/list.go
@ -22,17 +22,18 @@ type workspaceListRow struct {
|
||||
codersdk.Workspace `table:"-"`
|
||||
|
||||
// For table format:
|
||||
WorkspaceName string `json:"-" table:"workspace,default_sort"`
|
||||
Template string `json:"-" table:"template"`
|
||||
Status string `json:"-" table:"status"`
|
||||
Healthy string `json:"-" table:"healthy"`
|
||||
LastBuilt string `json:"-" table:"last built"`
|
||||
Outdated bool `json:"-" table:"outdated"`
|
||||
StartsAt string `json:"-" table:"starts at"`
|
||||
StartsNext string `json:"-" table:"starts next"`
|
||||
StopsAfter string `json:"-" table:"stops after"`
|
||||
StopsNext string `json:"-" table:"stops next"`
|
||||
DailyCost string `json:"-" table:"daily cost"`
|
||||
WorkspaceName string `json:"-" table:"workspace,default_sort"`
|
||||
Template string `json:"-" table:"template"`
|
||||
Status string `json:"-" table:"status"`
|
||||
Healthy string `json:"-" table:"healthy"`
|
||||
LastBuilt string `json:"-" table:"last built"`
|
||||
CurrentVersion string `json:"-" table:"current version"`
|
||||
Outdated bool `json:"-" table:"outdated"`
|
||||
StartsAt string `json:"-" table:"starts at"`
|
||||
StartsNext string `json:"-" table:"starts next"`
|
||||
StopsAfter string `json:"-" table:"stops after"`
|
||||
StopsNext string `json:"-" table:"stops next"`
|
||||
DailyCost string `json:"-" table:"daily cost"`
|
||||
}
|
||||
|
||||
func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace) workspaceListRow {
|
||||
@ -46,18 +47,19 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
|
||||
healthy = strconv.FormatBool(workspace.Health.Healthy)
|
||||
}
|
||||
return workspaceListRow{
|
||||
Workspace: workspace,
|
||||
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
|
||||
Template: workspace.TemplateName,
|
||||
Status: status,
|
||||
Healthy: healthy,
|
||||
LastBuilt: durationDisplay(lastBuilt),
|
||||
Outdated: workspace.Outdated,
|
||||
StartsAt: schedRow.StartsAt,
|
||||
StartsNext: schedRow.StartsNext,
|
||||
StopsAfter: schedRow.StopsAfter,
|
||||
StopsNext: schedRow.StopsNext,
|
||||
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
|
||||
Workspace: workspace,
|
||||
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
|
||||
Template: workspace.TemplateName,
|
||||
Status: status,
|
||||
Healthy: healthy,
|
||||
LastBuilt: durationDisplay(lastBuilt),
|
||||
CurrentVersion: workspace.LatestBuild.TemplateVersionName,
|
||||
Outdated: workspace.Outdated,
|
||||
StartsAt: schedRow.StartsAt,
|
||||
StartsNext: schedRow.StartsNext,
|
||||
StopsAfter: schedRow.StopsAfter,
|
||||
StopsNext: schedRow.StopsNext,
|
||||
DailyCost: strconv.Itoa(int(workspace.LatestBuild.DailyCost)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,6 +75,7 @@ func (r *RootCmd) list() *clibase.Cmd {
|
||||
"status",
|
||||
"healthy",
|
||||
"last built",
|
||||
"current version",
|
||||
"outdated",
|
||||
"starts at",
|
||||
"stops after",
|
||||
|
Reference in New Issue
Block a user