- Notifications
You must be signed in to change notification settings - Fork1.1k
feat(cli): show workspace health in list#8541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -2,6 +2,7 @@ package cli | ||
| import ( | ||
| "fmt" | ||
| "strconv" | ||
| "time" | ||
| "github.com/google/uuid" | ||
| @@ -24,6 +25,7 @@ type workspaceListRow struct { | ||
| 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"` | ||
| @@ -51,12 +53,17 @@ func workspaceListRowFromWorkspace(now time.Time, usersByID map[uuid.UUID]coders | ||
| } | ||
| } | ||
| healthy := "" | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Technically, it could be covered with unit tests. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Testing an individual column feels a bit overkill, I think this would be a good fit for a golden-file type test (we could do that for multiple commands). Essentially, set up a server, some workspace and agents, a list of commands to run, and generate a golden file for each command. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I'm fine with leaving it as is. | ||
| if status == "Starting" || status == "Started" { | ||
| healthy = strconv.FormatBool(workspace.Health.Healthy) | ||
| } | ||
| user := usersByID[workspace.OwnerID] | ||
| return workspaceListRow{ | ||
| Workspace: workspace, | ||
| WorkspaceName: user.Username + "/" + workspace.Name, | ||
| Template: workspace.TemplateName, | ||
| Status: status, | ||
| Healthy: healthy, | ||
| LastBuilt: durationDisplay(lastBuilt), | ||
| Outdated: workspace.Outdated, | ||
| StartsAt: autostartDisplay, | ||