mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
committed by
GitHub
parent
616e1d7e9a
commit
dfac0745f3
@ -2,6 +2,7 @@ package cli
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
@ -24,6 +25,7 @@ type workspaceListRow struct {
|
|||||||
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"`
|
||||||
|
Healthy string `json:"-" table:"healthy"`
|
||||||
LastBuilt string `json:"-" table:"last built"`
|
LastBuilt string `json:"-" table:"last built"`
|
||||||
Outdated bool `json:"-" table:"outdated"`
|
Outdated bool `json:"-" table:"outdated"`
|
||||||
StartsAt string `json:"-" table:"starts at"`
|
StartsAt string `json:"-" table:"starts at"`
|
||||||
@ -51,12 +53,17 @@ func workspaceListRowFromWorkspace(now time.Time, usersByID map[uuid.UUID]coders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
healthy := ""
|
||||||
|
if status == "Starting" || status == "Started" {
|
||||||
|
healthy = strconv.FormatBool(workspace.Health.Healthy)
|
||||||
|
}
|
||||||
user := usersByID[workspace.OwnerID]
|
user := usersByID[workspace.OwnerID]
|
||||||
return workspaceListRow{
|
return workspaceListRow{
|
||||||
Workspace: workspace,
|
Workspace: workspace,
|
||||||
WorkspaceName: user.Username + "/" + workspace.Name,
|
WorkspaceName: user.Username + "/" + workspace.Name,
|
||||||
Template: workspace.TemplateName,
|
Template: workspace.TemplateName,
|
||||||
Status: status,
|
Status: status,
|
||||||
|
Healthy: healthy,
|
||||||
LastBuilt: durationDisplay(lastBuilt),
|
LastBuilt: durationDisplay(lastBuilt),
|
||||||
Outdated: workspace.Outdated,
|
Outdated: workspace.Outdated,
|
||||||
StartsAt: autostartDisplay,
|
StartsAt: autostartDisplay,
|
||||||
|
5
cli/testdata/coder_list_--help.golden
vendored
5
cli/testdata/coder_list_--help.golden
vendored
@ -8,9 +8,10 @@ Aliases: ls
|
|||||||
-a, --all bool
|
-a, --all bool
|
||||||
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,last built,outdated,starts at,stops after)
|
-c, --column string-array (default: workspace,template,status,healthy,last built,outdated,starts at,stops after)
|
||||||
Columns to display in table output. Available columns: workspace,
|
Columns to display in table output. Available columns: workspace,
|
||||||
template, status, last built, outdated, starts at, stops after.
|
template, status, healthy, last built, outdated, starts at, stops
|
||||||
|
after.
|
||||||
|
|
||||||
-o, --output string (default: table)
|
-o, --output string (default: table)
|
||||||
Output format. Available formats: table, json.
|
Output format. Available formats: table, json.
|
||||||
|
@ -27,11 +27,11 @@ Specifies whether all workspaces will be listed or not.
|
|||||||
### -c, --column
|
### -c, --column
|
||||||
|
|
||||||
| | |
|
| | |
|
||||||
| ------- | -------------------------------------------------------------------------------- |
|
| ------- | ---------------------------------------------------------------------------------------- |
|
||||||
| Type | <code>string-array</code> |
|
| Type | <code>string-array</code> |
|
||||||
| Default | <code>workspace,template,status,last built,outdated,starts at,stops after</code> |
|
| Default | <code>workspace,template,status,healthy,last built,outdated,starts at,stops after</code> |
|
||||||
|
|
||||||
Columns to display in table output. Available columns: workspace, template, status, last built, outdated, starts at, stops after.
|
Columns to display in table output. Available columns: workspace, template, status, healthy, last built, outdated, starts at, stops after.
|
||||||
|
|
||||||
### -o, --output
|
### -o, --output
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user