Documentation
¶
Index ¶
- Constants
- Variables
- func BEHelpDesc(actionName, desc string) string
- func BEUnavailableErr(featureName string) error
- func DecodeRef(s string) []string
- func EncodeRef(parts ...string) string
- func FeatureLockedCmd(featureName string) tea.Cmd
- func HasAction(name string) bool
- func IsTopLevel(name string) bool
- func RegisterAction(name string, fn Action)
- func RegisterGatedAction(name string, guard func() bool, fn Action)
- func RegisterTopLevel(name string)
- func RegisterView(name string, f Factory)
- func UnregisterActionForTest(name string)
- type Action
- type AppErrorMsg
- type AppInfoMsg
- type Factory
- type Filterable
- type GoBackMsg
- type NavigateToMsg
- type OpenUnlockDialogMsg
- type OpenUpdateDialogMsg
- type View
Constants ¶
const ( NameHelp = "help" NameStacks = "stacks" NameServices = "services" NameTasks = "tasks" NameNodes = "nodes" NameConfigs = "configs" NameSecrets = "secrets" NameContexts = "contexts" NameInspect = "inspect" NameLogs = "logs" NameLoading = "loading" NameNetworks = "networks" NameVolumes = "volumes" )
View name constants for type-safe navigation
const BELandingURL = "https://swarmcli.io/be"
BELandingURL is the public Business Edition landing page (trial info, feature overview). Exported so the BE module references the same string instead of re-hardcoding it.
Variables ¶
BEUnavailableFormat is the format string used by BEUnavailableErr. Contains one %s verb for the feature name. Override in init() to customise.
BEUnavailableFormatFn, if set, returns the error message for a feature. Takes precedence over BEUnavailableFormat. Override in init() to customise.
var FeatureLockedCmdFn func(featureName string) tea.Cmd
FeatureLockedCmdFn, if set by an extension, returns a tea.Cmd to run when a license-gated feature is requested without entitlement. When set it takes precedence over the caller's local error dialog, letting the extension show a richer prompt (e.g. an inline license dialog) instead of the flat BEUnavailableErr text. Override in init().
var ServicesHealthHint func() string
ServicesHealthHint, when set by the BE module, returns a one-line services- view footer note (e.g. why container health is unavailable on the current context), or "" when there is nothing to say. It lets BE surface a context- specific note without CE having to know about managed contexts. Set in init(); read on the render goroutine.
Functions ¶
func BEHelpDesc ¶
BEHelpDesc returns desc if the action is registered, or desc+" (BE)" if not.
func BEUnavailableErr ¶
BEUnavailableErr returns an error indicating a feature requires Business Edition.
func EncodeRef ¶
EncodeRef packs fields into one Action argument string. It is the shared contract for actions that need more than a bare resource name — e.g. volume actions need the swarm node ID plus the volume name, because a volume name is only unique per node. Decode with DecodeRef.
func FeatureLockedCmd ¶
FeatureLockedCmd returns the extension's rich locked-feature command for featureName, or nil when no extension is registered — in which case callers fall back to surfacing BEUnavailableErr in their own error UI.
func IsTopLevel ¶
IsTopLevel reports whether a view name is a top-level (root) view.
func RegisterAction ¶
RegisterAction registers a named action. Must only be called from init() functions.
func RegisterGatedAction ¶
RegisterGatedAction registers an action with a runtime guard. GetAction and HasAction return false when the guard returns false. Must only be called from init() functions.
func RegisterTopLevel ¶
func RegisterTopLevel(name string)
RegisterTopLevel marks a view name as top-level. Called from init() by extension modules to register additional root views.
func RegisterView ¶
RegisterView registers a view factory under the given name. Must only be called from init() functions.
func UnregisterActionForTest ¶
func UnregisterActionForTest(name string)
UnregisterActionForTest removes a registered action. Test-only; not safe for concurrent use.
Types ¶
type Action ¶
Action is a feature action that can be triggered by key presses. The string parameter is the resource name (e.g. secret name). Registered during init() by extension packages, read-only after startup.
type AppErrorMsg ¶
AppErrorMsg signals that a view (or the app layer) encountered a loading error. The app shows a modal error dialog. On dismiss it navigates to FallbackView (if non-empty) or calls goBack().
type AppInfoMsg ¶
AppInfoMsg signals that a view (or the app layer) wants to show an informational notice — the AppErrorMsg counterpart for non-error content. The app shows the same modal styled as a neutral "Info" notice (not an error). On dismiss it navigates to FallbackView (if non-empty) or calls goBack(). Generic extension point: senders decide what warrants a notice.
type Factory ¶
Factory creates a View instance with its initial command. The deps parameter provides Docker operation interfaces for testability.
func GetFactory ¶
GetFactory returns the factory for the given view name.
type Filterable ¶
type Filterable interface {
ApplySearchQuery(query string)
ClearSearchQuery()
}
Filterable is an opt-in interface for views that support app-level "/" search filtering. Checked via type assertion in app/update.go.
type GoBackMsg ¶
type GoBackMsg struct{}
GoBackMsg requests the app to pop the current view and return to the previous one.
type NavigateToMsg ¶
type NavigateToMsg struct {
// view (i.e., not be pushed onto the navigation stack). When false,
// the view manager should push the new view onto the history stack.
Replace bool
}
type OpenUnlockDialogMsg ¶
type OpenUnlockDialogMsg struct{}
OpenUnlockDialogMsg requests the app to open the swarm unlock-key dialog.
type OpenUpdateDialogMsg ¶
type OpenUpdateDialogMsg struct {
Version string
}
OpenUpdateDialogMsg requests the app to force-show the "update available" notice on demand (the dev-only :dev-update command), bypassing the per-version dismissal. Version overrides the displayed latest version when set; otherwise the app falls back to the last checked version or a stub.
type View ¶
type View interface {
Update(msg tea.Msg) tea.Cmd
View() string
Init() tea.Cmd
Name() string
ShortHelpItems() []helpbar.HelpEntry
OnEnter() tea.Cmd // Called when view becomes active
OnExit() tea.Cmd // Called when view is removed/replaced
HasErrors() bool // Returns true if the view has any errors to display
// Frame components — views return unframed content,
// app wraps with ui.RenderViewFrame.
FrameTitle() string // text for frame title bar
FrameHeader() string // rendered header line(s), "" if none
FrameContent() string // unframed content (may include dialog overlays)
}