Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cmd/ctrlc/root/ui/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,17 @@ func fetchDeployments(ctx context.Context, client *api.ClientWithResponses, work
if item.Deployment.Description != nil {
desc = *item.Deployment.Description
}
// Get system names (now plural)
systemNames := ""
if len(item.Systems) > 0 {
systemNames = item.Systems[0].Name
for i := 1; i < len(item.Systems); i++ {
systemNames += ", " + item.Systems[i].Name
}
}
rows = append(rows, tableRow{
id: item.Deployment.Id,
cols: []string{item.Deployment.Name, item.System.Name, item.Deployment.Slug, desc},
cols: []string{item.Deployment.Name, systemNames, item.Deployment.Slug, desc},
rawItem: item,
})
}
Expand Down Expand Up @@ -292,9 +300,17 @@ func fetchDeploymentsForResource(client *api.ClientWithResponses, workspaceID st
if dep.Description != nil {
desc = *dep.Description
}
// Join system IDs (now plural)
systemIds := ""
if len(dep.SystemIds) > 0 {
systemIds = dep.SystemIds[0]
for i := 1; i < len(dep.SystemIds); i++ {
systemIds += ", " + dep.SystemIds[i]
}
}
rows = append(rows, tableRow{
id: dep.Id,
cols: []string{dep.Name, dep.Slug, dep.SystemId, desc},
cols: []string{dep.Name, dep.Slug, systemIds, desc},
Comment on lines +303 to +313
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Displaying raw system IDs may not be user-friendly.

In fetchDeployments (line 111), the column shows system names, but here in fetchDeploymentsForResource it shows raw system IDs. This inconsistency may confuse users. Consider resolving the IDs to names if the API response includes that information, or at minimum note this as a known limitation.

🤖 Prompt for AI Agents
In `@cmd/ctrlc/root/ui/fetcher.go` around lines 303 - 313, The deployment rows are
showing raw dep.SystemIds which is inconsistent with fetchDeployments that shows
system names; update fetchDeploymentsForResource to display system names instead
of IDs by resolving dep.SystemIds to names (either use dep.SystemNames if the
API already returns it, or look up names via the existing systems map/context
used elsewhere in this file) and then join those names into the systemIds string
used in the tableRow cols; if name resolution isn't possible, at minimum change
the displayed label (or add a note) to indicate these are IDs so users aren't
confused.

rawItem: dep,
})
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ctrlc/root/ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (m Model) handleDrillDown() (tea.Model, tea.Cmd) {
switch frame.resource {
case resourceTypeDeployments:
if frame.drillKind == "" {
depItem, ok := row.rawItem.(api.DeploymentAndSystem)
depItem, ok := row.rawItem.(api.DeploymentAndSystems)
if !ok {
return m, nil
}
Expand Down
Loading