From 88f29bfa6d37c8c54562ee64f1733e6f885f6a59 Mon Sep 17 00:00:00 2001 From: restitux Date: Fri, 24 Feb 2023 19:11:16 -0700 Subject: [PATCH] Allow setting pollInterval --- widget/pipelineCreate.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/widget/pipelineCreate.go b/widget/pipelineCreate.go index 802e11a..29ab3c3 100644 --- a/widget/pipelineCreate.go +++ b/widget/pipelineCreate.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "strconv" "git.ohea.xyz/cursorius/tui/queries" "github.com/Khan/genqlient/graphql" @@ -48,12 +49,12 @@ func (m pipelineCreateForm) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if e, ok := m.formList.Items()[2].(createPipelineItem); ok { pollIntervalStr = e.field.Value() } - var pollInterval *int - if pollIntervalStr == "" { - pollInterval = nil + pollInterval, err := strconv.Atoi(pollIntervalStr) + if err != nil { + pollInterval = 0 } - _, err := queries.CreatePipeline(context.Background(), m.client, name, url, pollInterval, nil) + _, err = queries.CreatePipeline(context.Background(), m.client, name, url, &pollInterval, nil) if err != nil { return err } @@ -89,6 +90,10 @@ func (m pipelineCreateForm) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, cmd } +func Atoi(pollIntervalStr string) { + panic("unimplemented") +} + func (m pipelineCreateForm) View() string { return m.formList.View() }