mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat(cli): show workspace favorite status in list output (#11878)
This commit is contained in:
@ -22,6 +22,7 @@ type workspaceListRow struct {
|
|||||||
codersdk.Workspace `table:"-"`
|
codersdk.Workspace `table:"-"`
|
||||||
|
|
||||||
// For table format:
|
// For table format:
|
||||||
|
Favorite bool `json:"-" table:"favorite"`
|
||||||
WorkspaceName string `json:"-" table:"workspace,default_sort"`
|
WorkspaceName string `json:"-" table:"workspace,default_sort"`
|
||||||
Template string `json:"-" table:"template"`
|
Template string `json:"-" table:"template"`
|
||||||
Status string `json:"-" table:"status"`
|
Status string `json:"-" table:"status"`
|
||||||
@ -46,9 +47,15 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
|
|||||||
if status == "Starting" || status == "Started" {
|
if status == "Starting" || status == "Started" {
|
||||||
healthy = strconv.FormatBool(workspace.Health.Healthy)
|
healthy = strconv.FormatBool(workspace.Health.Healthy)
|
||||||
}
|
}
|
||||||
|
favIco := " "
|
||||||
|
if workspace.Favorite {
|
||||||
|
favIco = "★"
|
||||||
|
}
|
||||||
|
workspaceName := favIco + " " + workspace.OwnerName + "/" + workspace.Name
|
||||||
return workspaceListRow{
|
return workspaceListRow{
|
||||||
|
Favorite: workspace.Favorite,
|
||||||
Workspace: workspace,
|
Workspace: workspace,
|
||||||
WorkspaceName: workspace.OwnerName + "/" + workspace.Name,
|
WorkspaceName: workspaceName,
|
||||||
Template: workspace.TemplateName,
|
Template: workspace.TemplateName,
|
||||||
Status: status,
|
Status: status,
|
||||||
Healthy: healthy,
|
Healthy: healthy,
|
||||||
|
6
cli/testdata/coder_list_--help.golden
vendored
6
cli/testdata/coder_list_--help.golden
vendored
@ -12,9 +12,9 @@ OPTIONS:
|
|||||||
Specifies whether all workspaces will be listed or not.
|
Specifies whether all workspaces will be listed or not.
|
||||||
|
|
||||||
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
|
-c, --column string-array (default: workspace,template,status,healthy,last built,current version,outdated,starts at,stops after)
|
||||||
Columns to display in table output. Available columns: workspace,
|
Columns to display in table output. Available columns: favorite,
|
||||||
template, status, healthy, last built, current version, outdated,
|
workspace, template, status, healthy, last built, current version,
|
||||||
starts at, starts next, stops after, stops next, daily cost.
|
outdated, starts at, starts next, stops after, stops next, daily cost.
|
||||||
|
|
||||||
-o, --output string (default: table)
|
-o, --output string (default: table)
|
||||||
Output format. Available formats: table, json.
|
Output format. Available formats: table, json.
|
||||||
|
2
docs/cli/list.md
generated
2
docs/cli/list.md
generated
@ -31,7 +31,7 @@ Specifies whether all workspaces will be listed or not.
|
|||||||
| Type | <code>string-array</code> |
|
| Type | <code>string-array</code> |
|
||||||
| Default | <code>workspace,template,status,healthy,last built,current version,outdated,starts at,stops after</code> |
|
| Default | <code>workspace,template,status,healthy,last built,current version,outdated,starts at,stops after</code> |
|
||||||
|
|
||||||
Columns to display in table output. Available columns: workspace, template, status, healthy, last built, current version, outdated, starts at, starts next, stops after, stops next, daily cost.
|
Columns to display in table output. Available columns: favorite, workspace, template, status, healthy, last built, current version, outdated, starts at, starts next, stops after, stops next, daily cost.
|
||||||
|
|
||||||
### -o, --output
|
### -o, --output
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user