Allow setting pollInterval
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"git.ohea.xyz/cursorius/tui/queries"
|
"git.ohea.xyz/cursorius/tui/queries"
|
||||||
"github.com/Khan/genqlient/graphql"
|
"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 {
|
if e, ok := m.formList.Items()[2].(createPipelineItem); ok {
|
||||||
pollIntervalStr = e.field.Value()
|
pollIntervalStr = e.field.Value()
|
||||||
}
|
}
|
||||||
var pollInterval *int
|
pollInterval, err := strconv.Atoi(pollIntervalStr)
|
||||||
if pollIntervalStr == "" {
|
if err != nil {
|
||||||
pollInterval = 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -89,6 +90,10 @@ func (m pipelineCreateForm) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, cmd
|
return m, cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Atoi(pollIntervalStr string) {
|
||||||
|
panic("unimplemented")
|
||||||
|
}
|
||||||
|
|
||||||
func (m pipelineCreateForm) View() string {
|
func (m pipelineCreateForm) View() string {
|
||||||
return m.formList.View()
|
return m.formList.View()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user