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 ¶
- func GetHelpKeyBindings() []key.Binding
- type MessageDetailContentProvider
- func (m *MessageDetailContentProvider) GetContentSize(width int) int
- func (m *MessageDetailContentProvider) HandleContentUpdate(msg tea.Msg) tea.Cmd
- func (m *MessageDetailContentProvider) InitContent() tea.Cmd
- func (m *MessageDetailContentProvider) IsInputMode() bool
- func (m *MessageDetailContentProvider) RenderContent(width, height int) string
- type MessageDetailHeaderDataProvider
- func (m *MessageDetailHeaderDataProvider) GetAppName() string
- func (m *MessageDetailHeaderDataProvider) GetBrandName() string
- func (m *MessageDetailHeaderDataProvider) GetStatusData() map[string]interface{}
- func (m *MessageDetailHeaderDataProvider) HandleHeaderUpdate(msg tea.Msg) tea.Cmd
- func (m *MessageDetailHeaderDataProvider) InitHeader() tea.Cmd
- type MessageDetailPageModel
- func NewMessageDetailPage(dataSource api.KafkaDataSource, topicName string, message api.Message) *MessageDetailPageModel
- func NewMessageDetailPageModel(dataSource api.KafkaDataSource, topicName string, message api.Message) *MessageDetailPageModel
- func NewMessageDetailPageModelWithCommon(common *core.Common, topicName string, message api.Message) *MessageDetailPageModel
- func (m *MessageDetailPageModel) ContextActions() []menu.Entry
- func (m *MessageDetailPageModel) GetCommon() *core.Common
- func (m *MessageDetailPageModel) GetDetailModel() *Model
- func (m *MessageDetailPageModel) GetHelp() []key.Binding
- func (m *MessageDetailPageModel) GetID() string
- func (m *MessageDetailPageModel) GetMessage() api.Message
- func (m *MessageDetailPageModel) GetTitle() string
- func (m *MessageDetailPageModel) GetTopicName() string
- func (m *MessageDetailPageModel) HandleNavigation(msg tea.Msg) (core.Page, tea.Cmd)
- func (m *MessageDetailPageModel) Init() tea.Cmd
- func (m *MessageDetailPageModel) IsInputMode() bool
- func (m *MessageDetailPageModel) KeyScope() keys.Scope
- func (m *MessageDetailPageModel) OnBlur() tea.Cmd
- func (m *MessageDetailPageModel) OnFocus() tea.Cmd
- func (m *MessageDetailPageModel) SetDimensions(width, height int)
- func (m *MessageDetailPageModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *MessageDetailPageModel) View() string
- type MessageDisplayFormat
- type MessageInfoSection
- func (m *MessageInfoSection) GetTitle() string
- func (m *MessageInfoSection) HandleSectionUpdate(msg tea.Msg) tea.Cmd
- func (m *MessageInfoSection) InitSection() tea.Cmd
- func (m *MessageInfoSection) RefreshSection() tea.Cmd
- func (m *MessageInfoSection) RenderItems(maxItems, width int) []providers.SidebarItem
- type Model
- func (m *Model) CopyContent() error
- func (m *Model) CopyContentWithFeedback() string
- func (m *Model) GetFormattedKey() string
- func (m *Model) GetFormattedValue() string
- func (m *Model) GetID() string
- func (m *Model) GetMessageInfo() map[string]string
- func (m *Model) GetSchemaInfo() *api.MessageSchemaInfo
- func (m *Model) GetTitle() string
- func (m *Model) LoadSchemaInfoAsync() tea.Cmd
- func (m *Model) OnBlur() tea.Cmd
- func (m *Model) OnFocus() tea.Cmd
- func (m *Model) ReloadSchemaInfoAsync() tea.Cmd
- func (m *Model) SetDimensions(width, height int)
- func (m *Model) SwitchFocus()
- func (m *Model) ToggleDisplayFormat()
- func (m *Model) ToggleHeaders()
- func (m *Model) ToggleMetadata()
- type SchemaInfoSection
- func (s *SchemaInfoSection) GetTitle() string
- func (s *SchemaInfoSection) HandleSectionUpdate(msg tea.Msg) tea.Cmd
- func (s *SchemaInfoSection) InitSection() tea.Cmd
- func (s *SchemaInfoSection) RefreshSection() tea.Cmd
- func (s *SchemaInfoSection) RenderItems(maxItems, width int) []providers.SidebarItem
- type SchemaLoadedMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHelpKeyBindings ¶
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 ¶
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) 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 (*Model) CopyContent ¶
CopyContent copies the content of the focused viewport to clipboard
func (*Model) CopyContentWithFeedback ¶
CopyContentWithFeedback copies content and returns a status message
func (*Model) GetFormattedKey ¶
GetFormattedKey returns the formatted message key
func (*Model) GetFormattedValue ¶
GetFormattedValue returns the formatted message value
func (*Model) GetMessageInfo ¶
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) LoadSchemaInfoAsync ¶
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 ¶
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) ReloadSchemaInfoAsync ¶ added in v0.1.36
ReloadSchemaInfoAsync re-fetches schema information on explicit request, even when an earlier load already ran.
func (*Model) SetDimensions ¶
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) 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.