Help us shape the future of Go! Take the 2026 Go Developer Survey

messagedetail

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package messagedetail contains the message detail page components for the Kafui application. This package implements the message detail page for viewing individual Kafka messages with formatted content and metadata.

The message detail page is responsible for: - Displaying individual message content with syntax highlighting - Showing message metadata (headers, timestamp, offset, partition) - Providing content formatting for different data types (JSON, Avro, etc.) - Handling message navigation (previous/next) - Supporting content search within the message

Architecture: - message_detail_page.go: Core page model using template system - message_detail_providers.go: Content and data providers for template system - detail_page_test.go: Tests for the message detail functionality

This modular structure separates concerns and improves maintainability while following the established UI patterns in the Kafui application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHelpKeyBindings

func GetHelpKeyBindings() []key.Binding

GetHelpKeyBindings returns this page's bindings, read from the single registry so help cannot disagree with behavior.

Types

type MessageDetailContentProvider

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

MessageDetailContentProvider implements the ContentProvider interface for message detail view

func NewMessageDetailContentProvider

func NewMessageDetailContentProvider(model *Model) *MessageDetailContentProvider

NewMessageDetailContentProvider creates a new content provider for message detail

func (*MessageDetailContentProvider) GetContentSize

func (m *MessageDetailContentProvider) GetContentSize(width int) int

GetContentSize returns the estimated content size for scrollbar calculation

func (*MessageDetailContentProvider) HandleContentUpdate

func (m *MessageDetailContentProvider) HandleContentUpdate(msg tea.Msg) tea.Cmd

HandleContentUpdate handles content updates

func (*MessageDetailContentProvider) InitContent

func (m *MessageDetailContentProvider) InitContent() tea.Cmd

InitContent initializes the content provider. The schema load is started by OnFocus, which the router runs on every activation including the first.

func (*MessageDetailContentProvider) IsInputMode

func (m *MessageDetailContentProvider) IsInputMode() bool

func (*MessageDetailContentProvider) RenderContent

func (m *MessageDetailContentProvider) RenderContent(width, height int) string

RenderContent renders the tab bar and the active tab within exactly width x height, so the template's frame is never pushed out of view.

type MessageDetailHeaderDataProvider

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

MessageDetailHeaderDataProvider implements the HeaderDataProvider interface for message detail

func NewMessageDetailHeaderDataProvider

func NewMessageDetailHeaderDataProvider(model *Model) *MessageDetailHeaderDataProvider

NewMessageDetailHeaderDataProvider creates a new header data provider for message detail

func (*MessageDetailHeaderDataProvider) GetAppName

func (m *MessageDetailHeaderDataProvider) GetAppName() string

GetAppName returns the application name

func (*MessageDetailHeaderDataProvider) GetBrandName

func (m *MessageDetailHeaderDataProvider) GetBrandName() string

GetBrandName returns the brand name

func (*MessageDetailHeaderDataProvider) GetStatusData

func (m *MessageDetailHeaderDataProvider) GetStatusData() map[string]interface{}

GetStatusData returns status information for the header

func (*MessageDetailHeaderDataProvider) HandleHeaderUpdate

func (m *MessageDetailHeaderDataProvider) HandleHeaderUpdate(msg tea.Msg) tea.Cmd

HandleHeaderUpdate handles header updates

func (*MessageDetailHeaderDataProvider) InitHeader

func (m *MessageDetailHeaderDataProvider) InitHeader() tea.Cmd

InitHeader initializes the header provider

type MessageDetailPageModel

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

MessageDetailPageModel wraps the ReusableApp with message detail-specific providers

func NewMessageDetailPage

func NewMessageDetailPage(dataSource api.KafkaDataSource, topicName string, message api.Message) *MessageDetailPageModel

NewModel creates a new message detail page model (alias for compatibility)

func NewMessageDetailPageModel

func NewMessageDetailPageModel(dataSource api.KafkaDataSource, topicName string, message api.Message) *MessageDetailPageModel

NewMessageDetailPageModel creates a new message detail page model using the template system Deprecated: Use NewMessageDetailPageModelWithCommon for new code

func NewMessageDetailPageModelWithCommon

func NewMessageDetailPageModelWithCommon(common *core.Common, topicName string, message api.Message) *MessageDetailPageModel

NewMessageDetailPageModelWithCommon creates a new message detail page model using the Common context pattern

func (*MessageDetailPageModel) ContextActions added in v0.1.35

func (m *MessageDetailPageModel) ContextActions() []menu.Entry

ContextActions implements core.ActionProvider. Export, and copying the key or the value separately, have no direct keys — `c` copies the focused pane.

func (*MessageDetailPageModel) GetCommon

func (m *MessageDetailPageModel) GetCommon() *core.Common

GetCommon returns the shared context

func (*MessageDetailPageModel) GetDetailModel

func (m *MessageDetailPageModel) GetDetailModel() *Model

GetDetailModel returns the underlying detail model (for compatibility)

func (*MessageDetailPageModel) GetHelp

func (m *MessageDetailPageModel) GetHelp() []key.Binding

GetHelp implements the Page interface

func (*MessageDetailPageModel) GetID

func (m *MessageDetailPageModel) GetID() string

GetID implements the Page interface

func (*MessageDetailPageModel) GetMessage

func (m *MessageDetailPageModel) GetMessage() api.Message

GetMessage returns the current message (for compatibility)

func (*MessageDetailPageModel) GetTitle

func (m *MessageDetailPageModel) GetTitle() string

GetTitle implements the Page interface

func (*MessageDetailPageModel) GetTopicName

func (m *MessageDetailPageModel) GetTopicName() string

GetTopicName returns the topic name (for compatibility)

func (*MessageDetailPageModel) HandleNavigation

func (m *MessageDetailPageModel) HandleNavigation(msg tea.Msg) (core.Page, tea.Cmd)

HandleNavigation implements the Page interface. Esc is the shell's: it unwinds and navigates back, and only reaches this page while the search prompt is open, where it must close the prompt rather than leave the page.

func (*MessageDetailPageModel) Init

func (m *MessageDetailPageModel) Init() tea.Cmd

Init implements the Page interface

func (*MessageDetailPageModel) IsInputMode added in v0.1.35

func (m *MessageDetailPageModel) IsInputMode() bool

IsInputMode implements core.InputModeReporter.

func (*MessageDetailPageModel) KeyScope added in v0.1.35

func (m *MessageDetailPageModel) KeyScope() keys.Scope

KeyScope implements core.KeyScoper.

func (*MessageDetailPageModel) OnBlur

func (m *MessageDetailPageModel) OnBlur() tea.Cmd

OnBlur implements the Page interface

func (*MessageDetailPageModel) OnFocus

func (m *MessageDetailPageModel) OnFocus() tea.Cmd

OnFocus implements the Page interface

func (*MessageDetailPageModel) SetDimensions

func (m *MessageDetailPageModel) SetDimensions(width, height int)

SetDimensions implements the Page interface

func (*MessageDetailPageModel) Update

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

Update implements the Page interface

func (*MessageDetailPageModel) View

func (m *MessageDetailPageModel) View() string

View implements the Page interface

type MessageDisplayFormat

type MessageDisplayFormat struct {
	ValueFormat string // "raw", "json", "pretty", "hex"
	KeyFormat   string
	WrapLines   bool
	ShowBytes   bool
}

MessageDisplayFormat represents how the message should be displayed

type MessageInfoSection

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

MessageInfoSection implements SidebarSection for message information

func NewMessageInfoSection

func NewMessageInfoSection(model *Model) *MessageInfoSection

NewMessageInfoSection creates a new message info sidebar section

func (*MessageInfoSection) GetTitle

func (m *MessageInfoSection) GetTitle() string

GetTitle returns the section title

func (*MessageInfoSection) HandleSectionUpdate

func (m *MessageInfoSection) HandleSectionUpdate(msg tea.Msg) tea.Cmd

HandleSectionUpdate handles section updates

func (*MessageInfoSection) InitSection

func (m *MessageInfoSection) InitSection() tea.Cmd

InitSection initializes the section

func (*MessageInfoSection) RefreshSection

func (m *MessageInfoSection) RefreshSection() tea.Cmd

RefreshSection refreshes the section data

func (*MessageInfoSection) RenderItems

func (m *MessageInfoSection) RenderItems(maxItems, width int) []providers.SidebarItem

RenderItems returns the items to display in this section

type Model

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

Model represents the detail page state for viewing individual messages (kept for compatibility)

func NewModel

func NewModel(dataSource api.KafkaDataSource, topicName string, message api.Message) *Model

NewModel creates a new detail page model (kept for compatibility)

func (*Model) CopyContent

func (m *Model) CopyContent() error

CopyContent copies the content of the focused viewport to clipboard

func (*Model) CopyContentWithFeedback

func (m *Model) CopyContentWithFeedback() string

CopyContentWithFeedback copies content and returns a status message

func (*Model) GetFormattedKey

func (m *Model) GetFormattedKey() string

GetFormattedKey returns the formatted message key

func (*Model) GetFormattedValue

func (m *Model) GetFormattedValue() string

GetFormattedValue returns the formatted message value

func (*Model) GetID

func (m *Model) GetID() string

GetID returns the page ID

func (*Model) GetMessageInfo

func (m *Model) GetMessageInfo() map[string]string

GetMessageInfo returns formatted message information

func (*Model) GetSchemaInfo

func (m *Model) GetSchemaInfo() *api.MessageSchemaInfo

GetSchemaInfo returns the schema information loaded so far, or nil. It never fetches: it is called from View, and a schema-registry lookup there would block rendering. Loading goes through LoadSchemaInfoAsync.

func (*Model) GetTitle

func (m *Model) GetTitle() string

GetTitle returns the page title

func (*Model) LoadSchemaInfoAsync

func (m *Model) LoadSchemaInfoAsync() tea.Cmd

LoadSchemaInfoAsync fetches the message's schema information in a tea.Cmd. The result comes back as a SchemaLoadedMsg and is applied in Update, so the cmd goroutine never touches the model. A load runs at most once per page (successful or not) unless ReloadSchemaInfoAsync asks again.

func (*Model) OnBlur

func (m *Model) OnBlur() tea.Cmd

OnBlur handles focus loss. A load still in flight reports to whichever page is current when it finishes, so forget it; the next OnFocus starts another.

func (*Model) OnFocus

func (m *Model) OnFocus() tea.Cmd

OnFocus handles focus gain

func (*Model) ReloadSchemaInfoAsync added in v0.1.36

func (m *Model) ReloadSchemaInfoAsync() tea.Cmd

ReloadSchemaInfoAsync re-fetches schema information on explicit request, even when an earlier load already ran.

func (*Model) SetDimensions

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

SetDimensions sets the model dimensions

func (*Model) SwitchFocus

func (m *Model) SwitchFocus()

SwitchFocus switches focus between key and value viewports

func (*Model) ToggleDisplayFormat

func (m *Model) ToggleDisplayFormat()

ToggleDisplayFormat cycles through display formats

func (*Model) ToggleHeaders

func (m *Model) ToggleHeaders()

ToggleHeaders toggles header display

func (*Model) ToggleMetadata

func (m *Model) ToggleMetadata()

ToggleMetadata toggles metadata display

type SchemaInfoSection

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

SchemaInfoSection implements SidebarSection for schema information

func NewSchemaInfoSection

func NewSchemaInfoSection(model *Model) *SchemaInfoSection

NewSchemaInfoSection creates a new schema info sidebar section

func (*SchemaInfoSection) GetTitle

func (s *SchemaInfoSection) GetTitle() string

GetTitle returns the section title

func (*SchemaInfoSection) HandleSectionUpdate

func (s *SchemaInfoSection) HandleSectionUpdate(msg tea.Msg) tea.Cmd

HandleSectionUpdate handles section updates

func (*SchemaInfoSection) InitSection

func (s *SchemaInfoSection) InitSection() tea.Cmd

InitSection initializes the section

func (*SchemaInfoSection) RefreshSection

func (s *SchemaInfoSection) RefreshSection() tea.Cmd

RefreshSection refreshes the section data

func (*SchemaInfoSection) RenderItems

func (s *SchemaInfoSection) RenderItems(maxItems, width int) []providers.SidebarItem

RenderItems returns the items to display in this section

type SchemaLoadedMsg

type SchemaLoadedMsg struct {
	KeySchemaID   string
	ValueSchemaID string
	Info          *api.MessageSchemaInfo
	Err           error
	Success       bool
}

SchemaLoadedMsg carries the result of LoadSchemaInfoAsync.

Jump to

Keyboard shortcuts

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