dashboard

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package dashboard provides the interactive terminal dashboard UI.

Index

Constants

View Source
const (
	StatusClean    = status.StatusClean
	StatusModified = status.StatusModified
	StatusAhead    = status.StatusAhead
	StatusBehind   = status.StatusBehind
	StatusDiverged = status.StatusDiverged
	StatusError    = status.StatusError
	StatusLoading  = status.StatusLoading
)

Variables

This section is empty.

Functions

func CountWorkspaceIssues

func CountWorkspaceIssues(statuses []RepoStatus) int

CountWorkspaceIssues counts how many repos have uncommitted/unpushed changes.

func FetchAction

func FetchAction(repoPath, repoName string) tea.Cmd

FetchAction creates a fetch command for a single repo.

func Icon

func Icon(s RepoStatus) string

Icon returns the status icon for display.

func PullAction

func PullAction(repoPath, repoName string) tea.Cmd

PullAction creates a pull command for a single repo.

func StatusText

func StatusText(s RepoStatus) string

StatusText returns a short status description for display.

Types

type ActionCompleteMsg

type ActionCompleteMsg struct {
	Action    ActionType
	Workspace string
	Repo      string
	Success   bool
	Error     error
	Output    string
}

ActionCompleteMsg is sent when an action completes.

type ActionStartMsg

type ActionStartMsg struct {
	Action    ActionType
	Workspace string
	Repo      string
}

ActionStartMsg is sent when an action starts.

type ActionType

type ActionType int

ActionType represents the type of action to perform.

const (
	ActionFetch ActionType = iota
	ActionPull
	ActionDelete
	ActionCreate
	ActionSwitch
	ActionDiff
)

func (ActionType) String

func (a ActionType) String() string

String returns a human-readable name for the action.

type ConfirmAction

type ConfirmAction struct {
	Action      ActionType
	Workspace   string
	Repo        string
	Description string
}

ConfirmAction contains details for a confirmation dialog.

type ConfirmModel

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

ConfirmModel represents a confirmation dialog.

func NewConfirm

func NewConfirm(action ConfirmAction, keys KeyMap) ConfirmModel

NewConfirm creates a new confirmation dialog.

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

Init initializes the component.

func (ConfirmModel) IsCanceled

func (m ConfirmModel) IsCanceled() bool

IsCanceled returns true if the user canceled.

func (ConfirmModel) IsConfirmed

func (m ConfirmModel) IsConfirmed() bool

IsConfirmed returns true if the user confirmed.

func (ConfirmModel) IsDeleting added in v0.0.4

func (m ConfirmModel) IsDeleting() bool

IsDeleting returns true if a deletion is in progress.

func (ConfirmModel) IsDone

func (m ConfirmModel) IsDone() bool

IsDone returns true if the dialog is complete.

func (ConfirmModel) SetDeleting added in v0.0.4

func (m ConfirmModel) SetDeleting(deleting bool) ConfirmModel

SetDeleting sets the deleting state.

func (ConfirmModel) SetSize

func (m ConfirmModel) SetSize(width, height int) ConfirmModel

SetSize sets the component dimensions.

func (ConfirmModel) Update

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

Update handles messages.

func (ConfirmModel) View

func (m ConfirmModel) View() string

View renders the confirmation dialog.

type DashboardModel

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

DashboardModel is the main dashboard model.

func NewDashboard

func NewDashboard(wm *workspace.Manager, cm *config.ConfigManager) DashboardModel

NewDashboard creates a new dashboard model.

func (DashboardModel) Init

func (m DashboardModel) Init() tea.Cmd

Init initializes the dashboard.

func (DashboardModel) OpenSetup added in v0.0.4

func (m DashboardModel) OpenSetup() bool

OpenSetup returns true if the user requested to open the setup wizard.

func (DashboardModel) SelectedPath

func (m DashboardModel) SelectedPath() string

SelectedPath returns the path of the workspace the user wants to switch to.

func (DashboardModel) Update

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

Update handles all messages.

func (DashboardModel) View

func (m DashboardModel) View() string

View renders the dashboard.

type DashboardResult added in v0.0.4

type DashboardResult struct {
	SelectedPath string
	OpenSetup    bool
}

DashboardResult contains the result of running the dashboard.

func RunDashboard

func RunDashboard(wm *workspace.Manager, cm *config.ConfigManager) (DashboardResult, error)

RunDashboard runs the dashboard and returns the result.

type DetailsModel

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

DetailsModel represents the right panel workspace details.

func NewDetails

func NewDetails(keys KeyMap) DetailsModel

NewDetails creates a new details model.

func (DetailsModel) Init

func (m DetailsModel) Init() tea.Cmd

Init initializes the component.

func (DetailsModel) SelectedRepo

func (m DetailsModel) SelectedRepo() int

SelectedRepo returns the currently selected repo index.

func (DetailsModel) SetFocused

func (m DetailsModel) SetFocused(focused bool) DetailsModel

SetFocused sets whether this panel is focused.

func (DetailsModel) SetLoading

func (m DetailsModel) SetLoading(loading bool) DetailsModel

SetLoading sets the loading state.

func (DetailsModel) SetSize

func (m DetailsModel) SetSize(width, height int) DetailsModel

SetSize sets the component dimensions.

func (DetailsModel) SetStatuses

func (m DetailsModel) SetStatuses(statuses []RepoStatus) DetailsModel

SetStatuses sets the repo statuses.

func (DetailsModel) SetWorkspace

func (m DetailsModel) SetWorkspace(ws *WorkspaceData) DetailsModel

SetWorkspace sets the workspace to display.

func (DetailsModel) Update

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

Update handles messages.

func (DetailsModel) View

func (m DetailsModel) View() string

View renders the details panel.

type DiffLoadedMsg

type DiffLoadedMsg struct {
	Content  string
	RepoName string
	Staged   bool
	Error    error
}

DiffLoadedMsg is sent when diff content is loaded.

type DiffViewModel

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

func NewDiffView

func NewDiffView(keys KeyMap) DiffViewModel

func (DiffViewModel) Init

func (m DiffViewModel) Init() tea.Cmd

func (DiffViewModel) SetContent

func (m DiffViewModel) SetContent(content, repoName string, staged bool) DiffViewModel

func (DiffViewModel) SetError

func (m DiffViewModel) SetError(err error) DiffViewModel

func (DiffViewModel) SetLoading

func (m DiffViewModel) SetLoading(loading bool) DiffViewModel

func (DiffViewModel) SetSize

func (m DiffViewModel) SetSize(width, height int) DiffViewModel

func (DiffViewModel) Update

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

func (DiffViewModel) View

func (m DiffViewModel) View() string

type ErrorMsg

type ErrorMsg struct {
	Error   error
	Context string
}

ErrorMsg is sent when an error occurs.

type HelpModel

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

HelpModel represents the help overlay.

func NewHelp

func NewHelp(keys KeyMap) HelpModel

NewHelp creates a new help model.

func (HelpModel) Init

func (m HelpModel) Init() tea.Cmd

Init initializes the component.

func (HelpModel) SetSize

func (m HelpModel) SetSize(width, height int) HelpModel

SetSize sets the component dimensions.

func (HelpModel) Update

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

Update handles messages.

func (HelpModel) View

func (m HelpModel) View() string

View renders the help overlay.

type KeyMap

type KeyMap struct {
	Up         key.Binding
	Down       key.Binding
	Left       key.Binding
	Right      key.Binding
	Select     key.Binding
	Fetch      key.Binding
	Pull       key.Binding
	Delete     key.Binding
	Create     key.Binding
	Refresh    key.Binding
	Diff       key.Binding
	DiffStaged key.Binding
	Settings   key.Binding
	Help       key.Binding
	Quit       key.Binding
	Filter     key.Binding
	Confirm    key.Binding
	Cancel     key.Binding
}

KeyMap contains all keyboard bindings for the dashboard.

func DefaultKeyMap

func DefaultKeyMap() KeyMap

DefaultKeyMap returns the default keybindings with vim support.

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

FullHelp returns all key bindings organized by category.

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

ShortHelp returns a short list of key bindings for the help view.

type Pane

type Pane int

Pane represents which panel is focused.

const (
	PaneWorkspaceList Pane = iota
	PaneDetails
)

type RefreshMsg

type RefreshMsg struct{}

RefreshMsg requests a refresh of all workspace statuses.

type RepoStatus

type RepoStatus = status.RepoStatus

RepoStatus is an alias to the shared status type with UI methods.

func FetchWorkspaceStatus

func FetchWorkspaceStatus(workspacePath string, projects []string) []RepoStatus

FetchWorkspaceStatus fetches status for all repos in a workspace.

type RepoStatusMsg

type RepoStatusMsg struct {
	WorkspacePath string
	RepoName      string
	Status        RepoStatus
}

RepoStatusMsg is sent when a single repo's status is updated.

type StatusClearedMsg added in v0.0.5

type StatusClearedMsg struct{}

StatusClearedMsg signals that status message should be cleared.

type StatusSummary

type StatusSummary = status.StatusSummary

StatusSummary is an alias to the shared status summary type.

type TickMsg

type TickMsg time.Time

TickMsg is sent periodically for auto-refresh.

type WorkspaceData

type WorkspaceData struct {
	Name       string
	Path       string
	Projects   []string
	Created    time.Time
	IsWorktree bool
}

WorkspaceData contains information about a workspace.

func WorkspacesToData

func WorkspacesToData(workspaces []workspace.Workspace) []WorkspaceData

WorkspacesToData converts workspace types to dashboard WorkspaceData.

type WorkspaceListModel

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

WorkspaceListModel represents the left panel workspace list.

func NewWorkspaceList

func NewWorkspaceList(workspaces []WorkspaceData, keys KeyMap) WorkspaceListModel

NewWorkspaceList creates a new workspace list model.

func (WorkspaceListModel) Init

func (m WorkspaceListModel) Init() tea.Cmd

Init initializes the component.

func (WorkspaceListModel) SelectedIndex

func (m WorkspaceListModel) SelectedIndex() int

SelectedIndex returns the actual index of the selected workspace.

func (WorkspaceListModel) SelectedWorkspace

func (m WorkspaceListModel) SelectedWorkspace() *WorkspaceData

SelectedWorkspace returns the selected workspace or nil.

func (WorkspaceListModel) SetFocused

func (m WorkspaceListModel) SetFocused(focused bool) WorkspaceListModel

SetFocused sets whether this panel is focused.

func (WorkspaceListModel) SetSize

func (m WorkspaceListModel) SetSize(width, height int) WorkspaceListModel

SetSize sets the component dimensions.

func (WorkspaceListModel) SetStatuses

func (m WorkspaceListModel) SetStatuses(statuses map[string][]RepoStatus) WorkspaceListModel

SetStatuses updates the status map.

func (WorkspaceListModel) SetWorkspaces

func (m WorkspaceListModel) SetWorkspaces(workspaces []WorkspaceData) WorkspaceListModel

SetWorkspaces updates the workspace list.

func (WorkspaceListModel) Update

Update handles messages.

func (WorkspaceListModel) View

func (m WorkspaceListModel) View() string

View renders the workspace list.

type WorkspaceStatusMsg

type WorkspaceStatusMsg struct {
	WorkspacePath string
	Statuses      []RepoStatus
}

WorkspaceStatusMsg is sent when a workspace's status is updated.

type WorkspacesLoadedMsg

type WorkspacesLoadedMsg struct {
	Workspaces []WorkspaceData
}

WorkspacesLoadedMsg is sent when workspaces are loaded.

Jump to

Keyboard shortcuts

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