Skip to content

Commit 63c658e

Browse files
[CAP-9233] skip version selection step in interactive task navigation (#297)
The interactive flow for `tasks list`, `taskruns list`, `taskruns start`, and `taskruns show` previously required selecting a workflow version before viewing tasks. This removes that step by passing the workflow ID directly to the ListTasks API, which returns tasks from the latest version. GitOrigin-RevId: 139fa2feb5eb71236f3b9bb76e8905c229d91103
1 parent 9c2faac commit 63c658e

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

cmd/tasklist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Tasks are user-defined functions registered with the Render workflow SDK. Each t
2222
release a workflow service, Render creates a new workflow version and registers all tasks
2323
it finds in that version.
2424
25-
In interactive mode, you will be prompted to select a workflow version if not provided.
25+
In interactive mode, you will be prompted to select a workflow if not provided.
2626
2727
Local Development:
2828
When using the --local flag, you don't need to provide a workflow version ID. Instead,

pkg/tui/flows/workflow.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (f *Workflow) TaskRunFlow(ctx context.Context, input *workflowviews.TaskRun
5454
}
5555

5656
func (f *Workflow) TaskListFlow(ctx context.Context, input *workflowviews.TaskListInput) tea.Cmd {
57-
if input.WorkflowVersionID == "" {
57+
if input.WorkflowVersionID == "" && input.WorkflowID == "" {
5858
return f.unspecifiedTask(ctx, func(t *workflows.Task) tea.Cmd {
5959
return f.taskListPalette(ctx, t)
6060
})
@@ -184,9 +184,7 @@ func (f *Workflow) unspecifiedTask(ctx context.Context, action func(t *workflows
184184
}
185185

186186
return f.workflowList(ctx, &workflowviews.WorkflowInput{}, func(ctx context.Context, r resource.Resource) tea.Cmd {
187-
return f.versionList(ctx, &workflowviews.VersionListInput{WorkflowID: r.ID()}, func(v *workflows.WorkflowVersion) tea.Cmd {
188-
return f.taskList(ctx, &workflowviews.TaskListInput{WorkflowVersionID: v.Id}, action)
189-
})
187+
return f.taskList(ctx, &workflowviews.TaskListInput{WorkflowID: r.ID()}, action)
190188
})
191189
}
192190

pkg/tui/views/workflows/loader.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ func (w *WorkflowLoader) ListWorkflows(ctx context.Context, in WorkflowInput) ([
197197
}
198198

199199
func (w *WorkflowLoader) LoadTaskList(ctx context.Context, input TaskListInput, cur client.Cursor) (client.Cursor, []*wfclient.Task, error) {
200-
params := &client.ListTasksParams{
201-
WorkflowVersionId: pointers.From([]string{input.WorkflowVersionID}),
200+
params := &client.ListTasksParams{}
201+
202+
if input.WorkflowVersionID != "" {
203+
params.WorkflowVersionId = pointers.From([]string{input.WorkflowVersionID})
204+
} else if input.WorkflowID != "" {
205+
params.WorkflowId = pointers.From([]string{input.WorkflowID})
202206
}
203207

204208
return w.taskRepo.ListTasks(ctx, params)

pkg/tui/views/workflows/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
type TaskListInput struct {
1111
WorkflowVersionID string `cli:"arg:0"`
12+
WorkflowID string
1213
}
1314

1415
type TaskRunInput struct {

0 commit comments

Comments
 (0)