Documentation
¶
Index ¶
- Constants
- func ProbeStatusLabel(kind string) string
- func SnapshotAgeLabel(t time.Time) string
- type ActionKind
- type ActionRunner
- type ActionUpdate
- type ActivityPanel
- type ActivityStatus
- type BackupFreshness
- type Dashboard
- type DashboardLoadError
- type DashboardLoadedMsg
- type FormsBackend
- type Model
- func (m Model) Init() tea.Cmd
- func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) WithConfig(cfg *engine.ProfilesConfig, prober StoreProber) Model
- func (m Model) WithForms(backend FormsBackend) Model
- func (m Model) WithReload(cmd tea.Cmd) Model
- func (m Model) WithRunner(runner ActionRunner) Model
- type ProfileAction
- type ProfileCard
- type ProfileSnapshot
- type ProfileStatus
- type ProfileView
- type RepositoryState
- type StoreHealth
- type StoreProbe
- type StoreProber
- type StoreReachability
Constants ¶
const StoreProbeTimeout = 15 * time.Second
StoreProbeTimeout bounds a single store health probe so one unreachable backend cannot stall the dashboard. Probes run concurrently, so the whole first paint is bounded by this regardless of how many stores are configured.
Variables ¶
This section is empty.
Functions ¶
func ProbeStatusLabel ¶
func SnapshotAgeLabel ¶
Types ¶
type ActionKind ¶
type ActionKind string
const ( ActionKindInit ActionKind = "init" ActionKindBackup ActionKind = "backup" ActionKindCheck ActionKind = "check" )
type ActionRunner ¶ added in v1.16.0
type ActionRunner interface {
Start(ctx context.Context, profile ProfileCard, kind ActionKind) <-chan ActionUpdate
}
ActionRunner executes a profile action asynchronously. Start launches the action against ctx and returns a channel that streams progress updates and closes once the final (Done) update has been sent. Implementations must respect ctx cancellation so the model's cancel key can stop a running action.
type ActionUpdate ¶ added in v1.16.0
type ActionUpdate struct {
Panel ActivityPanel
Done bool
Err error
}
ActionUpdate is a single progress update from a running profile action. Non-final updates carry the live ActivityPanel; the final update sets Done (and Err when the action failed) and is the last value sent before the channel closes.
type ActivityPanel ¶
type ActivityStatus ¶
type ActivityStatus string
const ( ActivityStatusIdle ActivityStatus = "" ActivityStatusRunning ActivityStatus = "running" ActivityStatusSuccess ActivityStatus = "success" ActivityStatusError ActivityStatus = "error" )
type BackupFreshness ¶
type BackupFreshness string
const ( BackupFreshnessUnknown BackupFreshness = "" BackupFreshnessNever BackupFreshness = "never" BackupFreshnessRecent BackupFreshness = "recent" BackupFreshnessStale BackupFreshness = "stale" )
type Dashboard ¶
type Dashboard struct {
ProfileCount int
StoreCount int
AuthCount int
SelectedProfile string
Activity ActivityPanel
Profiles []ProfileCard
}
func BuildDashboard ¶
func BuildDashboard(cfg *engine.ProfilesConfig, probes map[string]StoreProbe) Dashboard
BuildDashboard derives the dashboard view-model from the profiles config and whatever store probes have completed so far. A nil probes map yields the skeleton the model renders on its first frame, before any probe returns.
type DashboardLoadError ¶ added in v1.16.0
type DashboardLoadError struct {
Err error
}
DashboardLoadError reports that a dashboard (re)load failed. The model keeps showing the last good dashboard and surfaces the error in the footer.
type DashboardLoadedMsg ¶ added in v1.16.0
type DashboardLoadedMsg struct {
Dashboard Dashboard
}
DashboardLoadedMsg carries a freshly derived dashboard view-model into the model. It is emitted by the command returned from ReloadDashboardCmd.
type FormsBackend ¶ added in v1.16.0
type FormsBackend interface {
forms.ProfileBackend
forms.StoreBackend
forms.SecretBackend
// InitialStoreValues seeds an edit-store form with an existing store's
// field values.
InitialStoreValues(name string) map[string]string
// DeleteProfile removes a profile from the profiles file.
DeleteProfile(name string) error
// Reload re-reads the profiles config after a mutation.
Reload() (*engine.ProfilesConfig, error)
}
FormsBackend is the domain boundary the model uses for profile and store management. It combines the profile and store form backends with the delete, config-reload, and edit-seed operations the model orchestrates around a form. The cmd package implements it by reusing the existing source/store/options/ validation/save helpers.
type Model ¶ added in v1.16.0
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model for the interactive dashboard. This is the read-only foundation from issue #338: it renders the existing derived Dashboard view-model and supports navigation, but performs no actions or mutations. Async actions and forms land in later Phase 2 stories (#339, #340).
func NewModel ¶ added in v1.16.0
NewModel builds a root model seeded with an already-derived dashboard.
func (Model) Init ¶ added in v1.16.0
Init kicks off concurrent store probing when the model is configured with a prober; otherwise it renders the seeded dashboard as-is.
func (Model) WithConfig ¶ added in v1.16.0
func (m Model) WithConfig(cfg *engine.ProfilesConfig, prober StoreProber) Model
WithConfig attaches the profiles config and a store prober, enabling concurrent probing on Init. The seeded dashboard should be a probe-less skeleton (BuildDashboard(cfg, nil)) so the first frame renders immediately.
func (Model) WithForms ¶ added in v1.16.0
func (m Model) WithForms(backend FormsBackend) Model
WithForms enables the profile create/edit/delete flows (issue #340). Without it the model stays read-only plus actions.
func (Model) WithReload ¶ added in v1.16.0
WithReload attaches a command used to refresh the dashboard on "r".
func (Model) WithRunner ¶ added in v1.16.0
func (m Model) WithRunner(runner ActionRunner) Model
WithRunner attaches the async action runner used by the backup/check/init keys.
type ProfileAction ¶
type ProfileAction struct {
Kind ActionKind
Key string
Label string
Enabled bool
Reason string
}
type ProfileCard ¶
type ProfileCard struct {
Name string
Source string
StoreRef string
AuthRef string
Enabled bool
Status ProfileStatus
StatusNote string
StoreHealth StoreHealth
Reachability StoreReachability
Repository RepositoryState
BackupState BackupFreshness
LastBackup string
LastRef string
History []ProfileSnapshot
Actions []ProfileAction
}
type ProfileSnapshot ¶
type ProfileStatus ¶
type ProfileStatus string
const ( ProfileStatusReady ProfileStatus = "ready" ProfileStatusDisabled ProfileStatus = "disabled" ProfileStatusWarning ProfileStatus = "warning" ProfileStatusError ProfileStatus = "error" )
type ProfileView ¶
type ProfileView string
const ( ProfileViewSummary ProfileView = "summary" ProfileViewHistory ProfileView = "history" )
type RepositoryState ¶
type RepositoryState string
const ( RepositoryStateUnknown RepositoryState = "unknown" RepositoryStateInitialized RepositoryState = "initialized" RepositoryStateNotInitialized RepositoryState = "not_initialized" )
type StoreHealth ¶
type StoreHealth string
const ( StoreHealthReady StoreHealth = "ready" StoreHealthPending StoreHealth = "pending" StoreHealthDisabled StoreHealth = "disabled" StoreHealthMissingStore StoreHealth = "missing_store" StoreHealthMissingAuth StoreHealth = "missing_auth" StoreHealthProviderMismatch StoreHealth = "provider_mismatch" StoreHealthNotInitialized StoreHealth = "not_initialized" StoreHealthUnknown StoreHealth = "unknown" )
type StoreProbe ¶
type StoreProbe struct {
Status string
Error string
Snapshots []engine.SnapshotEntry
}
type StoreProber ¶ added in v1.16.0
type StoreProber interface {
Probe(ctx context.Context, name string, store engine.ProfileStore) StoreProbe
}
StoreProber checks the health of a single store. Implementations must honor ctx (including its deadline) and must not block past it.
type StoreReachability ¶
type StoreReachability string
const ( StoreReachabilityUnknown StoreReachability = "unknown" StoreReachabilityPending StoreReachability = "pending" StoreReachabilityReachable StoreReachability = "reachable" )