Allow setting pollInterval
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user