editor

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package editor provides modal editing components for hosts, triggers, and macros.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Label    string
	Value    string
	ReadOnly bool
	Input    textinput.Model
}

Field represents an editable field.

type MacroDeleteMsg

type MacroDeleteMsg struct {
	MacroID string
	Macro   string
	HostID  string
}

MacroDeleteMsg is sent when a macro should be deleted.

type MacroEditedMsg

type MacroEditedMsg struct {
	MacroID  string
	Macro    string
	NewValue string
	HostID   string
}

MacroEditedMsg is sent when a macro value is edited.

type MacroItem

type MacroItem struct {
	Macro    zabbix.HostMacro
	Selected bool
	Editing  bool
}

MacroItem represents a macro in the macro list.

type Model

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

Model represents the editor modal component.

func New

func New(styles *theme.Styles) Model

New creates a new editor model.

func (Model) ConfirmAction

func (m Model) ConfirmAction() string

ConfirmAction returns the pending confirmation action.

func (*Model) Hide

func (m *Model) Hide()

Hide hides the editor.

func (Model) Host

func (m Model) Host() *zabbix.Host

Host returns the host being edited.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (Model) IsConfirming

func (m Model) IsConfirming() bool

IsConfirming returns true if a confirmation is pending.

func (Model) SelectedMacro

func (m Model) SelectedMacro() *zabbix.HostMacro

SelectedMacro returns the currently selected macro.

func (Model) SelectedTrigger

func (m Model) SelectedTrigger() *zabbix.Trigger

SelectedTrigger returns the currently selected trigger.

func (*Model) SetScreenSize

func (m *Model) SetScreenSize(width, height int)

SetScreenSize sets the screen dimensions for centering.

func (*Model) SetStyles added in v0.5.0

func (m *Model) SetStyles(styles *theme.Styles)

SetStyles updates the component's styles (for runtime theme changes).

func (*Model) ShowHostMacros

func (m *Model) ShowHostMacros(host *zabbix.Host, macros []zabbix.HostMacro)

ShowHostMacros opens the host macros editor.

func (*Model) ShowHostTriggers

func (m *Model) ShowHostTriggers(host *zabbix.Host, triggers []zabbix.Trigger, selectTriggerID string)

ShowHostTriggers opens the host triggers editor. If selectTriggerID is non-empty, the cursor will be positioned on that trigger.

func (Model) Type

func (m Model) Type() Type

Type returns the current editor type.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

func (Model) Visible

func (m Model) Visible() bool

Visible returns true if the editor is visible.

type TriggerItem

type TriggerItem struct {
	Trigger  zabbix.Trigger
	Selected bool
}

TriggerItem represents a trigger in the trigger list.

type TriggerToggleMsg

type TriggerToggleMsg struct {
	TriggerID string
	Enable    bool
	HostID    string
}

TriggerToggleMsg is sent when a trigger should be enabled/disabled.

type Type

type Type int

Type represents the type of editor.

const (
	TypeNone Type = iota
	TypeHost
	TypeTrigger
	TypeMacro
	TypeHostTriggers // List of triggers for a host
	TypeHostMacros   // List of macros for a host
)

Type constants.

Jump to

Keyboard shortcuts

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