Skip to content

Commit 151b971

Browse files
authored
Merge pull request cli#11755 from cli/babakks/polish-agent-task-view
`gh agent-task view`: polish and fix some issues
2 parents 0c3171c + 6f69840 commit 151b971

7 files changed

Lines changed: 542 additions & 303 deletions

File tree

pkg/cmd/agent-task/capi/sessions.go

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,22 @@ var ErrSessionNotFound = errors.New("not found")
2727

2828
// session is an in-flight agent task
2929
type session struct {
30-
ID string `json:"id"`
31-
Name string `json:"name"`
32-
UserID int64 `json:"user_id"`
33-
AgentID int64 `json:"agent_id"`
34-
Logs string `json:"logs"`
35-
State string `json:"state"`
36-
OwnerID uint64 `json:"owner_id"`
37-
RepoID uint64 `json:"repo_id"`
38-
ResourceType string `json:"resource_type"`
39-
ResourceID int64 `json:"resource_id"`
40-
LastUpdatedAt time.Time `json:"last_updated_at,omitempty"`
41-
CreatedAt time.Time `json:"created_at,omitempty"`
42-
CompletedAt time.Time `json:"completed_at,omitempty"`
43-
EventURL string `json:"event_url"`
44-
EventType string `json:"event_type"`
30+
ID string `json:"id"`
31+
Name string `json:"name"`
32+
UserID int64 `json:"user_id"`
33+
AgentID int64 `json:"agent_id"`
34+
Logs string `json:"logs"`
35+
State string `json:"state"`
36+
OwnerID uint64 `json:"owner_id"`
37+
RepoID uint64 `json:"repo_id"`
38+
ResourceType string `json:"resource_type"`
39+
ResourceID int64 `json:"resource_id"`
40+
LastUpdatedAt time.Time `json:"last_updated_at,omitempty"`
41+
CreatedAt time.Time `json:"created_at,omitempty"`
42+
CompletedAt time.Time `json:"completed_at,omitempty"`
43+
EventURL string `json:"event_url"`
44+
EventType string `json:"event_type"`
45+
PremiumRequests float64 `json:"premium_requests"`
4546
}
4647

4748
// A shim of a full pull request because looking up by node ID
@@ -66,21 +67,22 @@ type sessionPullRequest struct {
6667

6768
// Session is a hydrated in-flight agent task
6869
type Session struct {
69-
ID string
70-
Name string
71-
UserID int64
72-
AgentID int64
73-
Logs string
74-
State string
75-
OwnerID uint64
76-
RepoID uint64
77-
ResourceType string
78-
ResourceID int64
79-
LastUpdatedAt time.Time
80-
CreatedAt time.Time
81-
CompletedAt time.Time
82-
EventURL string
83-
EventType string
70+
ID string
71+
Name string
72+
UserID int64
73+
AgentID int64
74+
Logs string
75+
State string
76+
OwnerID uint64
77+
RepoID uint64
78+
ResourceType string
79+
ResourceID int64
80+
LastUpdatedAt time.Time
81+
CreatedAt time.Time
82+
CompletedAt time.Time
83+
EventURL string
84+
EventType string
85+
PremiumRequests float64
8486

8587
PullRequest *api.PullRequest
8688
User *api.GitHubUser
@@ -475,20 +477,21 @@ func generateUserNodeID(userID int64) string {
475477

476478
func fromAPISession(s session) *Session {
477479
return &Session{
478-
ID: s.ID,
479-
Name: s.Name,
480-
UserID: s.UserID,
481-
AgentID: s.AgentID,
482-
Logs: s.Logs,
483-
State: s.State,
484-
OwnerID: s.OwnerID,
485-
RepoID: s.RepoID,
486-
ResourceType: s.ResourceType,
487-
ResourceID: s.ResourceID,
488-
LastUpdatedAt: s.LastUpdatedAt,
489-
CreatedAt: s.CreatedAt,
490-
CompletedAt: s.CompletedAt,
491-
EventURL: s.EventURL,
492-
EventType: s.EventType,
480+
ID: s.ID,
481+
Name: s.Name,
482+
UserID: s.UserID,
483+
AgentID: s.AgentID,
484+
Logs: s.Logs,
485+
State: s.State,
486+
OwnerID: s.OwnerID,
487+
RepoID: s.RepoID,
488+
ResourceType: s.ResourceType,
489+
ResourceID: s.ResourceID,
490+
LastUpdatedAt: s.LastUpdatedAt,
491+
CreatedAt: s.CreatedAt,
492+
CompletedAt: s.CompletedAt,
493+
EventURL: s.EventURL,
494+
EventType: s.EventType,
495+
PremiumRequests: s.PremiumRequests,
493496
}
494497
}

0 commit comments

Comments
 (0)