Allow setting pollInterval

This commit is contained in:
2023-02-24 19:11:16 -07:00
parent 804286551d
commit 88f29bfa6d
+9 -4
View File
@@ -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()
}