types

package
v0.2.0-beta-8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorDuplicateRecord          = "duplicate_record"
	ErrorForbidden                = "forbidden"
	ErrorInternalError            = "internal_error"
	ErrorInvalidRequest           = "invalid_request"
	ErrorInvalidParameter         = "invalid_parameter"
	ErrorMissingRequiredParameter = "missing_required_parameter"
	ErrorNotFound                 = "not_found"
	ErrorTokenExpired             = "token_expired"
	ErrorTooManyRequests          = "too_many_requests"
	ErrorUnauthorized             = "unauthorized"
	ErrorUnknownOrigin            = "unknown_origin"
)
View Source
const DefaultThemeName = "aurora-dark"

Variables

View Source
var AuroraDarkTheme = Theme{
	Name: "Aurora Dark",
	Colors: ColorValue{
		Error:           tcell.GetColor("#ff7f87"),
		Warning:         tcell.GetColor("#ffd479"),
		Notice:          tcell.GetColor("#8fd5ff"),
		WindowColor:     tcell.GetColor("#23283b"),
		ModalColor:      tcell.GetColor("#2c3147"),
		CommandBarColor: tcell.GetColor("#1b1f2d"),
		PrimaryText:     tcell.GetColor("#f8fbff"),
		SecondaryText:   tcell.GetColor("#bac4dd"),
		AccentColor:     tcell.GetColor("#5be7c4"),
		AccentTextColor: tcell.GetColor("#071510"),
		BorderColor:     tcell.GetColor("#6f7ab8"),
		TableHeader:     tcell.GetColor("#2f3650"),
		TableRow:        tcell.GetColor("#262c3f"),
		StatusBarBg:     tcell.GetColor("#1f2435"),
		StatusBarText:   tcell.GetColor("#fefefe"),
	},
	Style: ComponentStyle{
		ButtonStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#ff956b")).
			Foreground(tcell.GetColor("#1b0c05")).Bold(true),
		PlaceholderStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#343b52")).
			Foreground(tcell.GetColor("#9aa7c8")).Italic(true),
		FieldStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#2e3449")).
			Foreground(tcell.GetColor("#f8fbff")),
		ListMainTextStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#23283b")).
			Foreground(tcell.GetColor("#f8fbff")),
		ListSelectedStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#ffd479")).
			Foreground(tcell.GetColor("#3a2a08")).Bold(true),
		ListBorderStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#23283b")).
			Foreground(tcell.GetColor("#6f7ab8")),
		TextAreaStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#23283b")).
			Foreground(tcell.GetColor("#f8fbff")),
		TableHeaderStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#2f3650")).
			Foreground(tcell.GetColor("#fefefe")).Bold(true),
		TableCellStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#262c3f")).
			Foreground(tcell.GetColor("#e4e9fb")),
		TableSelectedStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#5be7c4")).
			Foreground(tcell.GetColor("#071510")).Bold(true),
		StatusBarStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#1f2435")).
			Foreground(tcell.GetColor("#fefefe")).Bold(true),
		PickerCellStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#23283b")).
			Foreground(tcell.GetColor("#f8fbff")),
		PickerSelectedStyle: tcell.StyleDefault.
			Background(tcell.GetColor("#5be7c4")).
			Foreground(tcell.GetColor("#071510")).Bold(true),
	},
}
View Source
var (
	DefualtTerminalTheme = Theme{
		Name: "Terminal",
		Colors: ColorValue{
			Error:           tcell.GetColor("red"),
			Warning:         tcell.GetColor("darkred"),
			Notice:          tcell.GetColor("silver"),
			WindowColor:     tcell.GetColor("#444444"),
			ModalColor:      tcell.GetColor("#111111"),
			CommandBarColor: tcell.GetColor("#333333"),
			PrimaryText:     tcell.ColorWhite,
			SecondaryText:   tcell.GetColor("lightgray"),
			AccentColor:     tcell.GetColor("#00A5FF"),
			AccentTextColor: tcell.ColorBlack,
			BorderColor:     tcell.GetColor("#666666"),
			TableHeader:     tcell.GetColor("#555555"),
			TableRow:        tcell.GetColor("#333333"),
			StatusBarBg:     tcell.GetColor("#222222"),
			StatusBarText:   tcell.ColorWhite,
		},
		Style: ComponentStyle{
			ButtonStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#5500FF")).
				Foreground(tcell.ColorWhite).Bold(true),
			PlaceholderStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#666666")).
				Foreground(tcell.ColorBlack).Italic(true),
			FieldStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#666666")).
				Foreground(tcell.ColorWhite),
			ListMainTextStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#444444")).
				Foreground(tcell.ColorWhite),
			ListSelectedStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#777777")).
				Foreground(tcell.ColorBlack).Bold(true),
			ListBorderStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#444444")).
				Foreground(tcell.GetColor("#AAAAAA")),
			TextAreaStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#444444")).
				Foreground(tcell.ColorWhite),
			TableHeaderStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#555555")).
				Foreground(tcell.ColorWhite).Bold(true),
			TableCellStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#333333")).
				Foreground(tcell.ColorWhite),
			TableSelectedStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#00A5FF")).
				Foreground(tcell.ColorBlack),
			StatusBarStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#222222")).
				Foreground(tcell.ColorWhite).Bold(true),
			PickerCellStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#444444")).
				Foreground(tcell.ColorWhite),
			PickerSelectedStyle: tcell.StyleDefault.
				Background(tcell.GetColor("#00A5FF")).
				Foreground(tcell.ColorBlack).Bold(true),
		},
	}
)

Functions

func IsArray

func IsArray(data []byte) bool

func ListMiddleware

func ListMiddleware[T ListParamParser](next http.Handler) http.Handler

func LogError

func LogError(logger *slog.Logger, msg string, err error, attrs ...any)

func NewGenericError

func NewGenericError(tag string, code string, status int, msg string) *genericError

func ParseId

func ParseId(val string) (string, error)

func ParseJSONBody

func ParseJSONBody(logger *slog.Logger, body io.Reader, obj interface{}) error

func ParseJSONBytes

func ParseJSONBytes(body []byte, obj interface{}) error

func ParseLimit

func ParseLimit(val string) (int, error)

func ParsePage

func ParsePage(val string) (int, error)

func ParseSortBy

func ParseSortBy(val string, listParamParser ListParamParser) (string, error)

func ParseValue

func ParseValue(val string, sortBy string, listParamParser ListParamParser) (interface{}, error)

func SendErrorResponse

func SendErrorResponse(res http.ResponseWriter, err error)

SendErrorResponse sends a JSON error response with the given error

func SendJSONResponse

func SendJSONResponse(res http.ResponseWriter, body interface{})

SendJSONResponse sends a JSON response with the given body

func ValidateStruct

func ValidateStruct(logger *slog.Logger, obj interface{}) error

Types

type AgentAuthenticator

type AgentAuthenticator interface {
	Authenticate(ctx context.Context, clientID, clientSecret string, tenantID string) (string, string, error)
}

AgentAuthenticator validates agent credentials/tenant binding.

type AgentConnection

type AgentConnection interface {
	TenantID() string
	AgentID() string
	SendJob(ctx context.Context, req *bridgeproto.JobRequest) (*bridgeproto.JobResult, error)
	Close() error
}

AgentConnection abstracts an active agent stream (bridge → agent). Exposed for applications that want to provide custom registries.

type AgentRegistry

type AgentRegistry interface {
	Register(ctx context.Context, tenantID string, agentID string, conn AgentConnection) error
	Unregister(ctx context.Context, tenantID string, agentID string)
	Pick(ctx context.Context, tenantID string) (AgentConnection, error)
	Stats() RegistryStats
	ObserveQuery(tenantID, agentID string, latency time.Duration)
}

AgentRegistry tracks agent connections per tenant.

type Auth

type Auth interface {
	IsAuthenticated() bool
	Authenticate(onComplete func(success bool, err error))
	ShowAuthModal()
}

type BridgeAgentCredential

type BridgeAgentCredential struct {
	ClientID     string `mapstructure:"clientID"`
	ClientSecret string `mapstructure:"clientSecret"`
	TenantID     string `mapstructure:"tenantID"`
	AgentID      string `mapstructure:"agentID"`
}

type BridgeConfig

type BridgeConfig struct {
	Mode                    string                  `mapstructure:"mode"` // embedded | remote
	ServerURL               string                  `mapstructure:"serverURL"`
	ClientID                string                  `mapstructure:"clientID"`
	ClientSecret            string                  `mapstructure:"clientSecret"`
	TenantID                string                  `mapstructure:"tenantID"`
	AutoConnectOnRegister   bool                    `mapstructure:"autoConnectOnRegister"`
	CredentialFile          string                  `mapstructure:"credentialFile"`
	TLS                     BridgeTLSConfig         `mapstructure:"tls"`
	Allowed                 []BridgeAgentCredential `mapstructure:"allowedAgents"`
	DefaultTenant           string                  `mapstructure:"defaultTenant"`
	PprofEnabled            bool                    `mapstructure:"pprofEnabled"`
	PprofPath               string                  `mapstructure:"pprofPath"`
	CredentialReloadSeconds int                     `mapstructure:"credentialReloadSeconds"`
	MaxRowsPerQuery         int                     `mapstructure:"maxRowsPerQuery"`
	MaxResultBytes          int64                   `mapstructure:"maxResultBytes"`
	Loki                    *LokiConfig             `mapstructure:"loki"`
}

type BridgeTLSConfig

type BridgeTLSConfig struct {
	InsecureSkipVerify bool `mapstructure:"insecureSkipVerify"`
}

type ColorValue

type ColorValue struct {
	Error           tcell.Color
	Warning         tcell.Color
	Notice          tcell.Color
	WindowColor     tcell.Color
	ModalColor      tcell.Color
	CommandBarColor tcell.Color
	PrimaryText     tcell.Color
	SecondaryText   tcell.Color
	AccentColor     tcell.Color
	AccentTextColor tcell.Color
	BorderColor     tcell.Color
	TableHeader     tcell.Color
	TableRow        tcell.Color
	StatusBarBg     tcell.Color
	StatusBarText   tcell.Color
}

type ComponentLayout

type ComponentLayout struct {
	SplitSidebar *tview.Flex
	MainMenu     *tview.List
	SubMenuList  *tview.List
	LogList      *tview.TextView
	OutputPanel  *tview.Flex
}

type ComponentStyle

type ComponentStyle struct {
	ButtonStyle         tcell.Style
	PlaceholderStyle    tcell.Style
	FieldStyle          tcell.Style
	ListMainTextStyle   tcell.Style
	ListSelectedStyle   tcell.Style
	ListBorderStyle     tcell.Style
	TextAreaStyle       tcell.Style
	TableHeaderStyle    tcell.Style
	TableCellStyle      tcell.Style
	TableSelectedStyle  tcell.Style
	StatusBarStyle      tcell.Style
	PickerCellStyle     tcell.Style
	PickerSelectedStyle tcell.Style
}

type CreateModalDialogParam

type CreateModalDialogParam struct {
	Title         string
	RootView      tview.Primitive
	Draggable     bool
	Resizeable    bool
	Size          WinSize
	FallbackFocus tview.Primitive
}

type DISConfig

type DISConfig struct {
	LogLevel           slog.Level    `mapstructure:"logLevel"`
	JDBCConfig         *JDBCConfig   `mapstructure:"jdbcConfig"`
	Host               string        `mapstructure:"host"`
	User               string        `mapstructure:"user"`
	Password           string        `mapstructure:"password"`
	MaxIdleConnections int           `mapstructure:"maxIdleConnections"`
	MaxOpenConnections int           `mapstructure:"maxOpenConnections"`
	Bridge             *BridgeConfig `mapstructure:"bridge"`
}

type DISReaderRemote

type DISReaderRemote interface {
	// Tenant is optional when a default was configured; otherwise required.
	StartJDBCRunner(ctx context.Context, tenant string) error
	StopJDBCRunner(ctx context.Context, tenant string) error
	Connect(ctx context.Context, tenant string) error
	Disconnect(ctx context.Context, tenant string) error
	PingBridge(ctx context.Context) error                  // PingBridge checks if the communication with the gRPC bridge server is alive
	PingAgent(ctx context.Context, tenant string) error    // PingAgent checks if the communication with the remote agent is alive
	PingService(ctx context.Context, tenant string) error  // PingService checks if the Java JDBC service is responsive
	PingDatabase(ctx context.Context, tenant string) error // PingDatabase checks if the DIS AS/400 database is reachable via the JDBC service
	UnitService(tenant string) UnitService
	InvoiceService(tenant string) InvoiceService
	PartService(tenant string) PartService
	// UpdateAgentConfig pushes a new AgentConfig to connected agents (optionally filtered by tenant)
	// and updates the server defaults used for future connections. If broadcast is false, only future
	// connections will see the update.
	UpdateAgentConfig(ctx context.Context, cfg *bridgeproto.AgentConfig, tenant string, broadcast bool) error
	// ReadAgentConfig requests a sanitized view of the agent's current configuration.
	ReadAgentConfig(ctx context.Context, tenant string) (*bridgeproto.AgentConfigStatus, error)
}

type DISReaderService

type DISReaderService interface {
	GetConfig() *DISConfig
	GetLogger() *slog.Logger
	SetLogger(logger *slog.Logger)
	Shutdown() error
	AttachShutdownHook()
	Connect(ctx context.Context) error
	Disconnect(ctx context.Context) error
	PingService(ctx context.Context) error  // PingService checks if the Java JDBC service is responsive
	PingDatabase(ctx context.Context) error // PingDatabase checks if the DIS AS/400 database is reachable via the JDBC service
	RunDebugSearch(searchTerm string, opts DebugSearchOptions, progressChan chan<- ProgressStatus, eventChan chan<- TableEvent)
	UnitService() UnitService
	InvoiceService() InvoiceService
	PartService() PartService
}

type DISUIConfig

type DISUIConfig struct {
	AppName     string            `mapstructure:"appName"`
	AppVersion  string            `mapstructure:"appVersion"`
	Theme       string            `mapstructure:"theme"`
	DIS         *DISConfig        `mapstructure:"disConfig"`
	Bridge      *BridgeConfig     `mapstructure:"bridge"`
	DebugSearch DebugSearchConfig `mapstructure:"debugSearch"`
}

type DebugSearchConfig

type DebugSearchConfig struct {
	DefaultOutputMode string `mapstructure:"defaultOutputMode"`
	DefaultOutputPath string `mapstructure:"defaultOutputPath"`
}

type DebugSearchOptions

type DebugSearchOptions struct {
	OutputMode DebugSearchOutputMode
	OutputPath string
}

type DebugSearchOutputMode

type DebugSearchOutputMode string
const (
	DebugSearchOutputSQLite DebugSearchOutputMode = "sqlite"
	DebugSearchOutputCSV    DebugSearchOutputMode = "csv"
)

type DuplicateRecordError

type DuplicateRecordError struct {
	Type string      `json:"type"`
	Key  interface{} `json:"key"`
	// contains filtered or unexported fields
}

DuplicateRecordError type

func NewDuplicateRecordError

func NewDuplicateRecordError(recordType string, recordKey interface{}, reason string) *DuplicateRecordError

func (DuplicateRecordError) Error

func (err DuplicateRecordError) Error() string

func (DuplicateRecordError) GetStatus

func (err DuplicateRecordError) GetStatus() int

func (DuplicateRecordError) GetTag

func (err DuplicateRecordError) GetTag() string

type Error

type Error interface {
	GetTag() string
	GetStatus() int
}

type Filter

type Filter struct {
	Field    string      // lower-case logical field name
	Operator string      // SQL operator, e.g. "=", "LIKE", ">", "<", "IN", "NOT IN"
	Value    interface{} // the value to compare against
	Column   string      // the SQL column name - to be added by parser
}

Filter represents a dynamic WHERE clause filter.

func ParseFilter

func ParseFilter(filter Filter, listParamParser ListParamParser) (Filter, error)

type ForbiddenError

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

ForbiddenError type

func NewForbiddenError

func NewForbiddenError(msg string) *ForbiddenError

func (ForbiddenError) Error

func (err ForbiddenError) Error() string

func (ForbiddenError) GetStatus

func (err ForbiddenError) GetStatus() int

func (ForbiddenError) GetTag

func (err ForbiddenError) GetTag() string

type GetDefaultSortByFunc

type GetDefaultSortByFunc func() string

type GetSupportedSortBys

type GetSupportedSortBys func() []string

type InternalError

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

InternalError type

func NewInternalError

func NewInternalError(msg string) *InternalError

func (InternalError) Error

func (err InternalError) Error() string

func (InternalError) GetStatus

func (err InternalError) GetStatus() int

func (InternalError) GetTag

func (err InternalError) GetTag() string

type InvalidParameterError

type InvalidParameterError struct {
	Parameter string `json:"parameter"`
	// contains filtered or unexported fields
}

InvalidParameterError type

func NewInvalidParameterError

func NewInvalidParameterError(paramName string, msg string) *InvalidParameterError

func (*InvalidParameterError) Error

func (err *InvalidParameterError) Error() string

func (InvalidParameterError) GetStatus

func (err InvalidParameterError) GetStatus() int

func (InvalidParameterError) GetTag

func (err InvalidParameterError) GetTag() string

type InvalidRequestError

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

InvalidRequestError type

func NewInvalidRequestError

func NewInvalidRequestError(msg string) *InvalidRequestError

func (InvalidRequestError) Error

func (err InvalidRequestError) Error() string

func (InvalidRequestError) GetStatus

func (err InvalidRequestError) GetStatus() int

func (InvalidRequestError) GetTag

func (err InvalidRequestError) GetTag() string

type InvoiceItemSpec

type InvoiceItemSpec struct {
	DocumentNumber       string     `json:"documentNumber"`
	LineID               string     `json:"lineId"`
	Division             string     `json:"division"`
	OrderSource          string     `json:"orderSource"`
	CustomerNumber       string     `json:"customerNumber"`
	VendorCode           string     `json:"vendorCode"`
	PartNumber           string     `json:"partNumber"`
	PostingDate          time.Time  `json:"postingDate"`
	FormatType           string     `json:"formatType"`
	ExceptionCode        string     `json:"exceptionCode"`
	Classification       string     `json:"classification"`
	Description          string     `json:"description"`
	PriceCode            string     `json:"priceCode"`
	Cost                 float64    `json:"cost"`
	Location             string     `json:"location"`
	Quantity             float64    `json:"quantity"`
	Price                float64    `json:"price"`
	TaxCode              string     `json:"taxCode"`
	DiscountRate         float64    `json:"discountRate"`
	Memo                 *string    `json:"memo,omitempty"`
	Rebill               bool       `json:"rebill"`
	Posted               bool       `json:"posted"`
	Stocked              bool       `json:"stocked"`
	Warranty             bool       `json:"warranty"`
	SerializedWarranty   bool       `json:"serializedWarranty"`
	SerialNumber         *string    `json:"serialNumber,omitempty"`
	AuditDivision        *string    `json:"auditDivision,omitempty"`
	AuditVendorCode      *string    `json:"auditVendorCode,omitempty"`
	AuditPostingDate     *time.Time `json:"auditPostingDate,omitempty"`
	AlternateDivision    *string    `json:"alternateDivision,omitempty"`
	AlternatePostingDate *time.Time `json:"alternatePostingDate,omitempty"`
	DiscountIndicator    *string    `json:"discountIndicator,omitempty"`
	ExtendedDescription  *string    `json:"extendedDescription,omitempty"`
	ProcessCode          *string    `json:"processCode,omitempty"`
	DemandCode           *string    `json:"demandCode,omitempty"`
	SeasonalCode         *string    `json:"seasonalCode,omitempty"`
	FreightTaxCode       *string    `json:"freightTaxCode,omitempty"`
	OriginFlag           *string    `json:"originFlag,omitempty"`
	UserField1           *string    `json:"userField1,omitempty"`
	UserField2           *string    `json:"userField2,omitempty"`
}

InvoiceItemSpec is the exported representation of a FILEC.IAH row.

type InvoiceListParamParser

type InvoiceListParamParser struct{}

InvoiceListParamParser implements ListParamParser for invoices.

func (InvoiceListParamParser) GetAllowedFilterColumns

func (InvoiceListParamParser) GetAllowedFilterColumns() map[string]string

func (InvoiceListParamParser) GetAllowedSortByColumns

func (InvoiceListParamParser) GetAllowedSortByColumns() map[string]string

func (InvoiceListParamParser) GetDefaultSortBy

func (InvoiceListParamParser) GetDefaultSortBy() string

func (InvoiceListParamParser) ParseValue

func (InvoiceListParamParser) ParseValue(val string, field string) (interface{}, error)

type InvoiceService

type InvoiceService interface {
	GetItem(ctx context.Context, documentNumber string, lineID string) (*InvoiceItemSpec, error)
	ListItems(ctx context.Context, lp ListParams) ([]*InvoiceItemSpec, error)
	GetWholeGoodsInvoice(ctx context.Context, invoiceNumber string, lineItemNumber string) (*WholeGoodsInvoiceSpec, error)
	ListWholeGoodsInvoices(ctx context.Context, lp ListParams) ([]*WholeGoodsInvoiceSpec, error)
}

InvoiceService describes operations available for DIS invoice data.

type JDBCConfig

type JDBCConfig struct {
	JavaPath string `mapstructure:"javaPath"`
	JDBCPort string `mapstructure:"jdbcPort"`
	JarPath  string `mapstructure:"jarPath"`
	ClassDir string `mapstructure:"classDir"`
}

type JDBCResult

type JDBCResult struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type LatencyAgg

type LatencyAgg struct {
	Count int64
	Sum   float64
	Max   float64
}

type ListParamParser

type ListParamParser interface {
	GetDefaultSortBy() string
	GetAllowedSortByColumns() map[string]string
	GetAllowedFilterColumns() map[string]string
	ParseValue(val string, sortBy string) (interface{}, error)
}

type ListParams

type ListParams struct {
	Page        int
	Limit       int
	Query       string
	SortBy      string
	SortOrder   SortOrder
	AfterId     string
	BeforeId    string
	AfterValue  interface{}
	BeforeValue interface{}
	// dynamic filters to apply in WHERE clauses
	Filters []Filter
}

func BuildListParams

func BuildListParams[T ListParamParser](raw RawListParams) (ListParams, error)

BuildListParams parses raw string inputs into ListParams. T must implement ListParamParser.

func GetListParamsFromContext

func GetListParamsFromContext(context context.Context) ListParams

func (ListParams) UseCursorPagination

func (lp ListParams) UseCursorPagination() bool

type LokiConfig

type LokiConfig struct {
	URL        string            `mapstructure:"url"`
	TenantID   string            `mapstructure:"tenantID"`
	APIKey     string            `mapstructure:"apiKey"`
	AuthHeader string            `mapstructure:"authHeader"`
	Labels     map[string]string `mapstructure:"labels"`
	MinLevel   slog.Level        `mapstructure:"minLevel"`
}
type MenuDefinition struct {
	Title string
	Items []MenuItem
}
type MenuItem struct {
	MainText      string // The main text of the list item.
	SecondaryText string // A secondary text to be shown underneath the main text.
	Shortcut      rune   // The key to select the list item directly, 0 if there is no shortcut.
	Selected      func() // The optional function which is called when the item is selected.
}

type MissingRequiredParameterError

type MissingRequiredParameterError struct {
	Parameter string `json:"parameter"`
	// contains filtered or unexported fields
}

MissingRequiredParameterError type

func NewMissingRequiredParameterError

func NewMissingRequiredParameterError(parameterName string) *MissingRequiredParameterError

func (MissingRequiredParameterError) Error

func (err MissingRequiredParameterError) Error() string

func (MissingRequiredParameterError) GetStatus

func (err MissingRequiredParameterError) GetStatus() int

func (MissingRequiredParameterError) GetTag

func (err MissingRequiredParameterError) GetTag() string

type PanelDefinition

type PanelDefinition struct {
	// Name is the title or identifier for the panel.
	Name string
	// View is the tview primitive to render as the output panel.
	View tview.Primitive
}

PanelDefinition describes a named UI panel (view) for the output area.

type PartInventorySpec

type PartInventorySpec struct {
	Division            string  `json:"division"`
	VendorCode          string  `json:"vendorCode"`
	PartNumber          string  `json:"partNumber"`
	Description         string  `json:"description"`
	BinLocation         string  `json:"binLocation"`
	QuickCode           string  `json:"quickCode"`
	ItemClass           string  `json:"itemClass"`
	ActiveFlag          string  `json:"activeFlag"`
	TaxCode             string  `json:"taxCode"`
	DateAddedYYYYMM     int32   `json:"dateAddedYYYYMM"`
	DateLastCountYYYYMM int32   `json:"dateLastCountYYYYMM"`
	DateLastSaleYYYYMM  int32   `json:"dateLastSaleYYYYMM"`
	UnitWeight          float64 `json:"unitWeight"`
	BackorderFlag       string  `json:"backorderFlag"`
	PackQty             int32   `json:"packQty"`
	OrderMultiplier     int32   `json:"orderMultiplier"`
	JobCode             int32   `json:"jobCode"`
	OnHandQty           int32   `json:"onHandQty"`
	ReservedSA          int32   `json:"reservedSA"`
	ReservedWO          int32   `json:"reservedWO"`
	AvailableQty        int32   `json:"availableQty"`
	ReturnableFlag      string  `json:"returnableFlag"`
	DateLastPriceUpdate int32   `json:"dateLastPriceUpdate"`
	AvgCost             float64 `json:"avgCost"`
	Price1Basis         string  `json:"price1Basis"`
	Price1Value         float64 `json:"price1Value"`
	Price2Basis         string  `json:"price2Basis"`
	Price2Value         float64 `json:"price2Value"`
	Price3Basis         string  `json:"price3Basis"`
	Price3Value         float64 `json:"price3Value"`
	Price4Basis         string  `json:"price4Basis"`
	Price4Value         float64 `json:"price4Value"`
	DeliverCode         string  `json:"deliverCode"`
	OrderCode           string  `json:"orderCode"`
	MinQty              int32   `json:"minQty"`
	MaxQty              int32   `json:"maxQty"`
	OrderQty            int32   `json:"orderQty"`
	LastReceiptDate     int32   `json:"lastReceiptDate"`
	LastReceiptQty      int32   `json:"lastReceiptQty"`
	StockFlag           string  `json:"stockFlag"`
	OpenOnSales         int32   `json:"openOnSales"`
	OpenOnPO            int32   `json:"openOnPO"`
	OpenOnRO            int32   `json:"openOnRO"`
	OpenOnReq           int32   `json:"openOnReq"`
	Peak12MoUsage       int32   `json:"peak12MoUsage"`
	MonthlyUsage        []int32 `json:"monthlyUsage"`
	MonthlyPurchases    []int32 `json:"monthlyPurchases"`
	YearUsageQty        []int32 `json:"yearUsageQty"`
	YearUsageValue      []int64 `json:"yearUsageValue"`
	Comment             string  `json:"comment"`
	CycleCountCode      string  `json:"cycleCountCode"`
	CorePartNumber      string  `json:"corePartNumber"`
	CoreQty             int32   `json:"coreQty"`
	CorePrice           float64 `json:"corePrice"`
	Sup1Vendor          string  `json:"sup1Vendor"`
	Sup1Part            string  `json:"sup1Part"`
	Sup1Price           float64 `json:"sup1Price"`
	Sup2Vendor          string  `json:"sup2Vendor"`
	Sup2Part            string  `json:"sup2Part"`
	Sup2Price           float64 `json:"sup2Price"`
	Sup3Vendor          string  `json:"sup3Vendor"`
	Sup3Part            string  `json:"sup3Part"`
	Sup3Price           float64 `json:"sup3Price"`
	RebuildIndicator    string  `json:"rebuildIndicator"`
	RebuildVendor       string  `json:"rebuildVendor"`
	RebuildPart         string  `json:"rebuildPart"`
	RebuildQtyFactor    int32   `json:"rebuildQtyFactor"`
	PriceScheduleCode   string  `json:"priceScheduleCode"`
	AutoPricingRule     string  `json:"autoPricingRule"`
	AutoPricingClass    string  `json:"autoPricingClass"`
	AutoPricingSource   string  `json:"autoPricingSource"`
	AutoPricingQtyBrk   int32   `json:"autoPricingQtyBrk"`
	AltAvailQty         float64 `json:"altAvailQty"`
	AltOnHandQty        float64 `json:"altOnHandQty"`
	AltUomUnits         int32   `json:"altUomUnits"`
	AltUomCode          string  `json:"altUomCode"`
	AltUomMultiple      int32   `json:"altUomMultiple"`
	AltUomBackorderFlag string  `json:"altUomBackorderFlag"`
	AltUomFreightFlag   string  `json:"altUomFreightFlag"`
	Message1            int32   `json:"message1"`
	Message2            int32   `json:"message2"`
	Message3            int32   `json:"message3"`
}

PartInventorySpec represents a fully decoded parts master record.

type PartListParamParser

type PartListParamParser struct{}

PartListParamParser validates filters, sorts, and cursor fields for parts endpoints.

func (PartListParamParser) GetAllowedFilterColumns

func (PartListParamParser) GetAllowedFilterColumns() map[string]string

func (PartListParamParser) GetAllowedSortByColumns

func (PartListParamParser) GetAllowedSortByColumns() map[string]string

func (PartListParamParser) GetDefaultSortBy

func (PartListParamParser) GetDefaultSortBy() string

func (PartListParamParser) ParseValue

func (PartListParamParser) ParseValue(val string, column string) (interface{}, error)

type PartService

type PartService interface {
	GetPart(ctx context.Context, division, partNumber string) (*PartInventorySpec, error)
	ListParts(ctx context.Context, lp ListParams) ([]*PartInventorySpec, error)
}

PartService exposes accessors for DIS parts/inventory records.

type ProgressStatus

type ProgressStatus struct {
	RunID            string
	TotalQueries     int
	CompletedQueries int
	PercentComplete  float64
}

type RawListParams

type RawListParams struct {
	PageParam        string
	LimitParam       string
	QueryParam       string
	SortByParam      string
	SortOrderParam   string
	AfterIdParam     string
	BeforeIdParam    string
	AfterValueParam  string
	BeforeValueParam string
	// Pre-parsed filters for programmatic usage
	FilterObjects []Filter
}

RawListParams holds raw string inputs for building ListParams in a type-safe manner.

type RecordNotFoundError

type RecordNotFoundError struct {
	Type string      `json:"type"`
	Key  interface{} `json:"key"`
	// contains filtered or unexported fields
}

RecordNotFoundError type

func NewRecordNotFoundError

func NewRecordNotFoundError(recordType string, recordKey interface{}) *RecordNotFoundError

func (RecordNotFoundError) Error

func (err RecordNotFoundError) Error() string

func (RecordNotFoundError) GetStatus

func (err RecordNotFoundError) GetStatus() int

func (RecordNotFoundError) GetTag

func (err RecordNotFoundError) GetTag() string

type RegistryKey

type RegistryKey struct {
	Tenant string
	Agent  string
}

type RegistryStats

type RegistryStats struct {
	TotalAgents int
	Tenants     map[string]int
	QueryCounts map[RegistryKey]int64
	Latency     map[RegistryKey]LatencyAgg
}

RegistryStats is a snapshot of connected agents per tenant.

type ResultRow

type ResultRow map[string]interface{}

ResultRow is a map representing a row from a JDBC query result.

type SortOrder

type SortOrder int
const (
	SortOrderAsc  SortOrder = iota
	SortOrderDesc SortOrder = iota
)

func ParseSortOrder

func ParseSortOrder(val string) (SortOrder, error)

func (SortOrder) String

func (so SortOrder) String() string

type TableEvent

type TableEvent struct {
	TableName   string
	EventType   string // "table_created" or "row_inserted"
	RowCount    int
	ColumnCount int
	SampleRow   map[string]interface{}
}

type Theme

type Theme struct {
	Name   string
	Colors ColorValue
	Style  ComponentStyle
}

func ResolveTheme

func ResolveTheme(name string) *Theme

ResolveTheme returns a clone of a known theme by name, falling back to the default terminal theme.

type TokenExpiredError

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

TokenExpiredError type

func NewTokenExpiredError

func NewTokenExpiredError() *TokenExpiredError

func (TokenExpiredError) Error

func (err TokenExpiredError) Error() string

func (TokenExpiredError) GetStatus

func (err TokenExpiredError) GetStatus() int

func (TokenExpiredError) GetTag

func (err TokenExpiredError) GetTag() string

type TooManyRequestsError

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

TooManyRequestsError type

func NewTooManyRequestsError

func NewTooManyRequestsError() *TooManyRequestsError

func (TooManyRequestsError) Error

func (err TooManyRequestsError) Error() string

func (TooManyRequestsError) GetStatus

func (err TooManyRequestsError) GetStatus() int

func (TooManyRequestsError) GetTag

func (err TooManyRequestsError) GetTag() string

type UI

type UI interface {
	SetFocus(p tview.Primitive)
	Run() error
	QuitApplication()

	GetLayout() *ComponentLayout
	GetDIS() DISReaderService
	GetTheme() *Theme
	GetApp() *tview.Application
	GetWinMan() *winman.Manager
	GetAuth() Auth
	GetConfig() *DISUIConfig
	RunPendingAction()
	SetPendingAction(f func())
	GetLogger() *slog.Logger
	AttachToDISLogger() error

	CreateModalDialog(param CreateModalDialogParam) *winman.WindowBase
	CloseModalDialog(wnd *winman.WindowBase, focus tview.Primitive)
	ClearOutputPanel()
	SetOutputPanel(pd PanelDefinition)
}

type UnauthorizedError

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

UnauthorizedError type

func NewUnauthorizedError

func NewUnauthorizedError(msg string) *UnauthorizedError

func (UnauthorizedError) Error

func (err UnauthorizedError) Error() string

func (UnauthorizedError) GetStatus

func (err UnauthorizedError) GetStatus() int

func (UnauthorizedError) GetTag

func (err UnauthorizedError) GetTag() string

type UnitListParamParser

type UnitListParamParser struct{}

UnitListParamParser satisfies service.ListParamParser for units.

func (UnitListParamParser) GetAllowedFilterColumns

func (UnitListParamParser) GetAllowedFilterColumns() map[string]string

func (UnitListParamParser) GetAllowedSortByColumns

func (UnitListParamParser) GetAllowedSortByColumns() map[string]string

func (UnitListParamParser) GetDefaultSortBy

func (UnitListParamParser) GetDefaultSortBy() string

func (UnitListParamParser) ParseValue

func (UnitListParamParser) ParseValue(val string, sortBy string) (interface{}, error)

type UnitService

type UnitService interface {
	GetByUnitNumber(ctx context.Context, unitNum string) (*UnitSpec, error)
	ListUnits(ctx context.Context, lp ListParams) ([]*UnitSpec, error)
}

type UnitSpec

type UnitSpec struct {
	UnitID        string     `json:"unitId" validate:"required"`
	Year          string     `json:"year"`
	Make          string     `json:"make"`
	Model         string     `json:"model"`
	Description   string     `json:"description"`
	Serial        *string    `json:"serial,omitempty"`
	Engine        *string    `json:"engine,omitempty"`
	Status        string     `json:"status"`
	ProductCode   *string    `json:"productCode,omitempty"`
	New           bool       `json:"new"`
	Color         *string    `json:"color,omitempty"`
	HorsePower    *int       `json:"horsePower,omitempty"`
	EngineHours   *float64   `json:"engineHours,omitempty"`
	Location      string     `json:"location"`
	Account       string     `json:"account"`
	CreatedAt     time.Time  `json:"createdAt"`
	SoldAt        *time.Time `json:"soldAt,omitempty"`
	InvoiceNumber *string    `json:"invoiceNumber,omitempty"`
	SoldTo        *string    `json:"soldTo,omitempty"`
	RevenueAmount *float64   `json:"revenueAmount,omitempty"`
	Cost          float64    `json:"cost,omitempty"`
	SoldBy        *string    `json:"soldBy,omitempty"`
	SoldByName    *string    `json:"soldByName,omitempty"`
}

type UnknownOriginError

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

UnknownOriginError type

func NewUnknownOriginError

func NewUnknownOriginError(origin string) *UnknownOriginError

func (UnknownOriginError) Error

func (err UnknownOriginError) Error() string

func (UnknownOriginError) GetStatus

func (err UnknownOriginError) GetStatus() int

func (UnknownOriginError) GetTag

func (err UnknownOriginError) GetTag() string

type ViewModule

type ViewModule interface {
	// Name is the display text for the main menu.
	Name() string
	// Shortcut is the rune key to activate this module.
	Shortcut() rune
	// Init is called once after UI and Logger are ready.
	Init(ui UI)
	// Activate is called when the user selects this module.
	Activate()
	// SubMenu returns a MenuDefinition for this module's submenu.
	SubMenu() MenuDefinition
	// OutputPanel returns a PanelDefinition describing the name and view
	// to display in the main output area when this module is active.
	OutputPanel() PanelDefinition
}

ViewModule represents a pluggable UI component.

type WholeGoodsInvoiceListParamParser

type WholeGoodsInvoiceListParamParser struct{}

WholeGoodsInvoiceListParamParser validates filters/sorts for FILEC.CUSINV reads.

func (WholeGoodsInvoiceListParamParser) GetAllowedFilterColumns

func (WholeGoodsInvoiceListParamParser) GetAllowedFilterColumns() map[string]string

func (WholeGoodsInvoiceListParamParser) GetAllowedSortByColumns

func (WholeGoodsInvoiceListParamParser) GetAllowedSortByColumns() map[string]string

func (WholeGoodsInvoiceListParamParser) GetDefaultSortBy

func (WholeGoodsInvoiceListParamParser) GetDefaultSortBy() string

func (WholeGoodsInvoiceListParamParser) ParseValue

func (WholeGoodsInvoiceListParamParser) ParseValue(val string, field string) (interface{}, error)

type WholeGoodsInvoiceSpec

type WholeGoodsInvoiceSpec struct {
	Division            string    `json:"division"`
	LegacyDS9YA         *int      `json:"ds9ya,omitempty"`
	LineItemNumber      int       `json:"lineItemNumber"`
	InvoiceNumber       string    `json:"invoiceNumber"`
	LegacyDSYGA         *string   `json:"dsyga,omitempty"`
	InvoiceDate         time.Time `json:"invoiceDate"`
	LineItemPrice       float64   `json:"lineItemPrice"`
	LineItemDescription string    `json:"lineItemDescription"`
	LegacyDSWVA         *int      `json:"dswva,omitempty"`
	SoldBy              string    `json:"soldBy"`
}

WholeGoodsInvoiceSpec represents FILEC.CUSINV rows (whole goods invoices).

type WinSize

type WinSize struct {
	X      int
	Y      int
	Width  int
	Height int
}

Jump to

Keyboard shortcuts

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