6
6
"strconv"
7
7
"time"
8
8
9
+ "github.com/google/uuid"
9
10
"golang.org/x/xerrors"
10
11
11
12
"github.com/coder/coder/v2/cli/cliui"
@@ -22,19 +23,21 @@ type workspaceListRow struct {
22
23
codersdk.Workspace `table:"-"`
23
24
24
25
// For table format:
25
- Favorite bool `json:"-" table:"favorite"`
26
- WorkspaceName string `json:"-" table:"workspace,default_sort"`
27
- Template string `json:"-" table:"template"`
28
- Status string `json:"-" table:"status"`
29
- Healthy string `json:"-" table:"healthy"`
30
- LastBuilt string `json:"-" table:"last built"`
31
- CurrentVersion string `json:"-" table:"current version"`
32
- Outdated bool `json:"-" table:"outdated"`
33
- StartsAt string `json:"-" table:"starts at"`
34
- StartsNext string `json:"-" table:"starts next"`
35
- StopsAfter string `json:"-" table:"stops after"`
36
- StopsNext string `json:"-" table:"stops next"`
37
- DailyCost string `json:"-" table:"daily cost"`
26
+ Favorite bool `json:"-" table:"favorite"`
27
+ WorkspaceName string `json:"-" table:"workspace,default_sort"`
28
+ OrganizationID uuid.UUID `json:"-" table:"organization id"`
29
+ OrganizationName string `json:"-" table:"organization name"`
30
+ Template string `json:"-" table:"template"`
31
+ Status string `json:"-" table:"status"`
32
+ Healthy string `json:"-" table:"healthy"`
33
+ LastBuilt string `json:"-" table:"last built"`
34
+ CurrentVersion string `json:"-" table:"current version"`
35
+ Outdated bool `json:"-" table:"outdated"`
36
+ StartsAt string `json:"-" table:"starts at"`
37
+ StartsNext string `json:"-" table:"starts next"`
38
+ StopsAfter string `json:"-" table:"stops after"`
39
+ StopsNext string `json:"-" table:"stops next"`
40
+ DailyCost string `json:"-" table:"daily cost"`
38
41
}
39
42
40
43
func workspaceListRowFromWorkspace (now time.Time , workspace codersdk.Workspace ) workspaceListRow {
@@ -53,20 +56,22 @@ func workspaceListRowFromWorkspace(now time.Time, workspace codersdk.Workspace)
53
56
}
54
57
workspaceName := favIco + " " + workspace .OwnerName + "/" + workspace .Name
55
58
return workspaceListRow {
56
- Favorite : workspace .Favorite ,
57
- Workspace : workspace ,
58
- WorkspaceName : workspaceName ,
59
- Template : workspace .TemplateName ,
60
- Status : status ,
61
- Healthy : healthy ,
62
- LastBuilt : durationDisplay (lastBuilt ),
63
- CurrentVersion : workspace .LatestBuild .TemplateVersionName ,
64
- Outdated : workspace .Outdated ,
65
- StartsAt : schedRow .StartsAt ,
66
- StartsNext : schedRow .StartsNext ,
67
- StopsAfter : schedRow .StopsAfter ,
68
- StopsNext : schedRow .StopsNext ,
69
- DailyCost : strconv .Itoa (int (workspace .LatestBuild .DailyCost )),
59
+ Favorite : workspace .Favorite ,
60
+ Workspace : workspace ,
61
+ WorkspaceName : workspaceName ,
62
+ OrganizationID : workspace .OrganizationID ,
63
+ OrganizationName : workspace .OrganizationName ,
64
+ Template : workspace .TemplateName ,
65
+ Status : status ,
66
+ Healthy : healthy ,
67
+ LastBuilt : durationDisplay (lastBuilt ),
68
+ CurrentVersion : workspace .LatestBuild .TemplateVersionName ,
69
+ Outdated : workspace .Outdated ,
70
+ StartsAt : schedRow .StartsAt ,
71
+ StartsNext : schedRow .StartsNext ,
72
+ StopsAfter : schedRow .StopsAfter ,
73
+ StopsNext : schedRow .StopsNext ,
74
+ DailyCost : strconv .Itoa (int (workspace .LatestBuild .DailyCost )),
70
75
}
71
76
}
72
77
0 commit comments