views

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Overview

pkg/tui/views/jobcancelview.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelDeploy

func CancelDeploy(ctx context.Context, input DeployCancelInput) (string, error)

func CancelJob

func CancelJob(ctx context.Context, input JobCancelInput) (string, error)

func CreateDeploy

func CreateDeploy(ctx context.Context, input types.DeployInput) (*client.Deploy, error)

func CreateJob

func CreateJob(ctx context.Context, input JobCreateInput) (*clientjob.Job, error)

func DeployCreateConfirm

func DeployCreateConfirm(ctx context.Context, input types.DeployInput) func() (string, error)

func LoadDeployList

func LoadDeployList(ctx context.Context, input DeployListInput, cur client.Cursor) (client.Cursor, []*client.Deploy, error)

func LoadEnvironments

func LoadEnvironments(ctx context.Context, in EnvironmentInput) ([]*client.Environment, error)

func LoadJobListData

func LoadJobListData(ctx context.Context, input JobListInput, cur client.Cursor) (client.Cursor, []*clientjob.Job, error)

func LoadLogData

func LoadLogData(ctx context.Context, in LogInput) (*tui.LogResult, error)

func LoadProjects

func LoadProjects(ctx context.Context, _ ProjectInput) ([]*client.Project, error)

func LoadResourceData

func LoadResourceData(ctx context.Context, in ListResourceInput) ([]resource.Resource, error)

func NonInteractiveLogin

func NonInteractiveLogin(cmd *cobra.Command) error

func RequireConfirmationForCancelDeploy

func RequireConfirmationForCancelDeploy(ctx context.Context, input DeployCancelInput) (string, error)

func RequireConfirmationForCancelJob

func RequireConfirmationForCancelJob(ctx context.Context, input JobCancelInput) (string, error)

func RestartResource

func RestartResource(ctx context.Context, input RestartInput) (string, error)

func SelectWorkspace

func SelectWorkspace(ctx context.Context, input GetWorkspaceInput) (*client.Owner, error)

func WaitForDeploy

func WaitForDeploy(ctx context.Context, serviceID, deployID string) (*client.Deploy, error)

Types

type DeployCancelInput

type DeployCancelInput struct {
	ServiceID string `cli:"arg:0"`
	DeployID  string `cli:"arg:1"`
}

type DeployCancelView

type DeployCancelView struct {
	// contains filtered or unexported fields
}

func NewDeployCancelView

func NewDeployCancelView(ctx context.Context, input DeployCancelInput) *DeployCancelView

func (*DeployCancelView) Init

func (v *DeployCancelView) Init() tea.Cmd

func (*DeployCancelView) Update

func (v *DeployCancelView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DeployCancelView) View

func (v *DeployCancelView) View() string

type DeployCreateView

type DeployCreateView struct {
	// contains filtered or unexported fields
}

func NewDeployCreateView

func NewDeployCreateView(ctx context.Context, input types.DeployInput, logCmd func(d *client.Deploy) tea.Cmd) *DeployCreateView

func (*DeployCreateView) Init

func (v *DeployCreateView) Init() tea.Cmd

func (*DeployCreateView) Update

func (v *DeployCreateView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DeployCreateView) View

func (v *DeployCreateView) View() string

type DeployListInput

type DeployListInput struct {
	ServiceID string `cli:"arg:0"`
}

type DeployListView

type DeployListView struct {
	// contains filtered or unexported fields
}

func NewDeployListView

func NewDeployListView(ctx context.Context, input DeployListInput, generateCommands func(*client.Deploy) tea.Cmd) *DeployListView

func (*DeployListView) Init

func (v *DeployListView) Init() tea.Cmd

func (*DeployListView) Update

func (v *DeployListView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*DeployListView) View

func (v *DeployListView) View() string

type EnvironmentInput

type EnvironmentInput struct {
	ProjectID string `cli:"arg:0"`
}

func (EnvironmentInput) ToParams

type EnvironmentList

type EnvironmentList struct {
	// contains filtered or unexported fields
}

func NewEnvironmentList

func NewEnvironmentList(ctx context.Context, input EnvironmentInput, selectEnvironment OnSelectFuncT[*client.Environment], opts ...tui.TableOption[*client.Environment]) *EnvironmentList

func (*EnvironmentList) Init

func (pl *EnvironmentList) Init() tea.Cmd

func (*EnvironmentList) Update

func (pl *EnvironmentList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*EnvironmentList) View

func (pl *EnvironmentList) View() string

type FooterModel

type FooterModel struct {
	// contains filtered or unexported fields
}

func (*FooterModel) Init

func (f *FooterModel) Init() tea.Cmd

func (*FooterModel) SetHeight

func (f *FooterModel) SetHeight(height int)

func (*FooterModel) SetWidth

func (f *FooterModel) SetWidth(width int)

func (*FooterModel) Update

func (f *FooterModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FooterModel) View

func (f *FooterModel) View() string

type GetWorkspaceInput

type GetWorkspaceInput struct {
	IDOrName string
}

type JobCancelInput

type JobCancelInput struct {
	ServiceID string `cli:"arg:0"`
	JobID     string `cli:"arg:1"`
}

type JobCancelView

type JobCancelView struct {
	// contains filtered or unexported fields
}

func NewJobCancelView

func NewJobCancelView(ctx context.Context, input JobCancelInput) *JobCancelView

func (*JobCancelView) Init

func (v *JobCancelView) Init() tea.Cmd

func (*JobCancelView) Update

func (v *JobCancelView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*JobCancelView) View

func (v *JobCancelView) View() string

type JobCreateInput

type JobCreateInput struct {
	ServiceID    string  `cli:"arg:0"`
	StartCommand *string `cli:"start-command"`
	PlanID       *string `cli:"plan-id"`
}

type JobCreateView

type JobCreateView struct {
	// contains filtered or unexported fields
}

func NewJobCreateView

func NewJobCreateView(
	ctx context.Context,
	input *JobCreateInput,
	cobraCmd *cobra.Command,
	createJob func(ctx context.Context, input JobCreateInput) (*clientjob.Job, error),
	action func(j *clientjob.Job) tea.Cmd,
) *JobCreateView

func (*JobCreateView) Init

func (v *JobCreateView) Init() tea.Cmd

func (*JobCreateView) Update

func (v *JobCreateView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*JobCreateView) View

func (v *JobCreateView) View() string

type JobListInput

type JobListInput struct {
	ServiceID string `cli:"arg:0"`
}

type JobListView

type JobListView struct {
	// contains filtered or unexported fields
}

func NewJobListView

func NewJobListView(ctx context.Context, input *JobListInput, generateCommands func(*clientjob.Job) tea.Cmd) *JobListView

func (*JobListView) Init

func (v *JobListView) Init() tea.Cmd

func (*JobListView) Update

func (v *JobListView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*JobListView) View

func (v *JobListView) View() string

type ListResourceInput

type ListResourceInput struct {
	Project         *client.Project
	EnvironmentIDs  []string `cli:"environment-ids"`
	IncludePreviews bool     `cli:"include-previews"`
}

func DefaultListResourceInput

func DefaultListResourceInput(ctx context.Context) (ListResourceInput, error)

func (ListResourceInput) ToParams

type ListWorkspaceInput

type ListWorkspaceInput struct{}

type LogInput

type LogInput struct {
	ResourceIDs []string `cli:"resources"`
	Instance    []string `cli:"instance"`
	Text        []string `cli:"text"`
	Level       []string `cli:"level"`
	Type        []string `cli:"type"`

	StartTime *command.TimeOrRelative `cli:"start"`
	EndTime   *command.TimeOrRelative `cli:"end"`

	Host       []string `cli:"host"`
	StatusCode []string `cli:"status-code"`
	Method     []string `cli:"method"`
	Path       []string `cli:"path"`

	Limit     int    `cli:"limit"`
	Direction string `cli:"direction"`
	Tail      bool   `cli:"tail"`

	ListResourceInput ListResourceInput
}

func (LogInput) ToParam

func (l LogInput) ToParam() (*client.ListLogsParams, error)

type LoginView

type LoginView struct {
	// contains filtered or unexported fields
}

func NewLoginView

func NewLoginView(ctx context.Context) *LoginView

func (*LoginView) Init

func (l *LoginView) Init() tea.Cmd

func (*LoginView) Update

func (l *LoginView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*LoginView) View

func (l *LoginView) View() string

type LogsView

type LogsView struct {
	// contains filtered or unexported fields
}

func NewLogsView

func NewLogsView(
	ctx context.Context,
	logsCmd *cobra.Command,
	interactiveLogsCommand func(ctx context.Context, input LogInput, breadcrumb string) tea.Cmd,
	input LogInput,
	loadLogFunc func(ctx context.Context, in LogInput) (*tui.LogResult, error),
	opts ...tui.TableOption[resource.Resource],
) *LogsView

func (*LogsView) Init

func (v *LogsView) Init() tea.Cmd

func (*LogsView) Update

func (v *LogsView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*LogsView) View

func (v *LogsView) View() string

type OnSelectFunc

type OnSelectFunc func(context.Context, *client.Project) tea.Cmd

type OnSelectFuncT

type OnSelectFuncT[T any] func(context.Context, T) tea.Cmd

type PSQLInput

type PSQLInput struct {
	PostgresID     string `cli:"arg:0"`
	Project        *client.Project
	EnvironmentIDs []string
	Tool           PSQLTool

	Args []string
}

type PSQLTool

type PSQLTool string
const PGCLI PSQLTool = "pgcli"
const PSQL PSQLTool = "psql"

type PSQLView

type PSQLView struct {
	// contains filtered or unexported fields
}

func NewPSQLView

func NewPSQLView(ctx context.Context, input *PSQLInput, opts ...tui.TableOption[*postgres.Model]) *PSQLView

func (*PSQLView) Init

func (v *PSQLView) Init() tea.Cmd

func (*PSQLView) Update

func (v *PSQLView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*PSQLView) View

func (v *PSQLView) View() string

type PaletteCommand

type PaletteCommand struct {
	Name        string
	Description string
	Action      func(ctx context.Context, args []string) tea.Cmd
}

type PaletteView

type PaletteView struct {
	// contains filtered or unexported fields
}

func NewPaletteView

func NewPaletteView(ctx context.Context, commands []PaletteCommand) *PaletteView

func (*PaletteView) Init

func (pv *PaletteView) Init() tea.Cmd

func (*PaletteView) Update

func (pv *PaletteView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*PaletteView) View

func (pv *PaletteView) View() string

type PostgresInput

type PostgresInput struct {
	EnvironmentIDs []string
}

type PostgresList

type PostgresList struct {
	// contains filtered or unexported fields
}

func NewPostgresList

func NewPostgresList(ctx context.Context, selectFunc OnSelectFuncT[*postgres.Model], input PostgresInput, opts ...tui.TableOption[*postgres.Model]) *PostgresList

func (*PostgresList) Init

func (pl *PostgresList) Init() tea.Cmd

func (*PostgresList) Update

func (pl *PostgresList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*PostgresList) View

func (pl *PostgresList) View() string

type ProjectFilterView

type ProjectFilterView struct {
	// contains filtered or unexported fields
}

func (*ProjectFilterView) Init

func (v *ProjectFilterView) Init() tea.Cmd

func (*ProjectFilterView) Update

func (v *ProjectFilterView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ProjectFilterView) View

func (v *ProjectFilterView) View() string

type ProjectInput

type ProjectInput struct{}

type ProjectList

type ProjectList struct {
	// contains filtered or unexported fields
}

func NewProjectFilterView

func NewProjectFilterView(ctx context.Context, onSelect func(context.Context, *client.Project) tea.Cmd) *ProjectList

func NewProjectList

func NewProjectList(ctx context.Context, selectEnvironment OnSelectFunc, opts ...tui.TableOption[*client.Project]) *ProjectList

func (*ProjectList) Init

func (pl *ProjectList) Init() tea.Cmd

func (*ProjectList) Update

func (pl *ProjectList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ProjectList) View

func (pl *ProjectList) View() string

type RedisCLIInput

type RedisCLIInput struct {
	RedisID        string `cli:"arg:0"`
	Project        *client.Project
	EnvironmentIDs []string

	Args []string
}

type RedisCLIView

type RedisCLIView struct {
	// contains filtered or unexported fields
}

func NewRedisCLIView

func NewRedisCLIView(ctx context.Context, input *RedisCLIInput, opts ...tui.TableOption[*redis.Model]) *RedisCLIView

func (*RedisCLIView) Init

func (v *RedisCLIView) Init() tea.Cmd

func (*RedisCLIView) Update

func (v *RedisCLIView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*RedisCLIView) View

func (v *RedisCLIView) View() string

type RedisInput

type RedisInput struct {
	EnvironmentIDs []string
}

type RedisList

type RedisList struct {
	// contains filtered or unexported fields
}

func NewRedisList

func NewRedisList(ctx context.Context, selectFunc OnSelectFuncT[*redis.Model], input RedisInput, opts ...tui.TableOption[*redis.Model]) *RedisList

func (*RedisList) Init

func (pl *RedisList) Init() tea.Cmd

func (*RedisList) Update

func (pl *RedisList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*RedisList) View

func (pl *RedisList) View() string

type ResourceView

type ResourceView struct {
	// contains filtered or unexported fields
}

func NewResourceView

func NewResourceView(ctx context.Context, input ListResourceInput, onSelect func(r resource.Resource) tea.Cmd, opts ...tui.TableOption[resource.Resource]) *ResourceView

func (*ResourceView) Init

func (v *ResourceView) Init() tea.Cmd

func (*ResourceView) Update

func (v *ResourceView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ResourceView) View

func (v *ResourceView) View() string

type ResourceWithPaletteView

type ResourceWithPaletteView struct {
	// contains filtered or unexported fields
}

func NewResourceWithPaletteView

func NewResourceWithPaletteView(ctx context.Context, input ListResourceInput, commandsForResource func(r resource.Resource) tea.Cmd, opts ...tui.TableOption[resource.Resource]) *ResourceWithPaletteView

func (*ResourceWithPaletteView) Init

func (v *ResourceWithPaletteView) Init() tea.Cmd

func (*ResourceWithPaletteView) Update

func (v *ResourceWithPaletteView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ResourceWithPaletteView) View

func (v *ResourceWithPaletteView) View() string

type RestartInput

type RestartInput struct {
	ResourceID string `cli:"arg:0"`
}

type RestartView

type RestartView struct {
	// contains filtered or unexported fields
}

func NewRestartView

func NewRestartView(ctx context.Context, input RestartInput, logCmd func() tea.Cmd) *RestartView

func (*RestartView) Init

func (v *RestartView) Init() tea.Cmd

func (*RestartView) Update

func (v *RestartView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*RestartView) View

func (v *RestartView) View() string

type SSHInput

type SSHInput struct {
	ServiceID      string `cli:"arg:0"`
	Project        *client.Project
	EnvironmentIDs []string

	Args []string
}

type SSHView

type SSHView struct {
	// contains filtered or unexported fields
}

func NewSSHView

func NewSSHView(ctx context.Context, input *SSHInput, opts ...tui.TableOption[*service.Model]) *SSHView

func (*SSHView) Init

func (v *SSHView) Init() tea.Cmd

func (*SSHView) Update

func (v *SSHView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*SSHView) View

func (v *SSHView) View() string

type ServiceInput

type ServiceInput struct {
	Project         *client.Project
	EnvironmentIDs  []string
	IncludePreviews bool
	Types           []client.ServiceType
}

type ServiceList

type ServiceList struct {
	// contains filtered or unexported fields
}

func NewServiceList

func NewServiceList(ctx context.Context, in ServiceInput, selectFunc OnSelectFuncT[resource.Resource], opts ...tui.TableOption[*service.Model]) *ServiceList

func (*ServiceList) Init

func (pl *ServiceList) Init() tea.Cmd

func (*ServiceList) Update

func (pl *ServiceList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ServiceList) View

func (pl *ServiceList) View() string

type WorkspaceView

type WorkspaceView struct {
	// contains filtered or unexported fields
}

func NewWorkspaceView

func NewWorkspaceView(ctx context.Context, input ListWorkspaceInput) *WorkspaceView

func (*WorkspaceView) Init

func (v *WorkspaceView) Init() tea.Cmd

func (*WorkspaceView) Update

func (v *WorkspaceView) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*WorkspaceView) View

func (v *WorkspaceView) View() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL