model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUptime

func FormatUptime(created time.Time) string

FormatUptime formats the container uptime

func ParseProjectName

func ParseProjectName(containerName string) string

ParseProjectName extracts the project name from a container name Examples:

  • myproject_web_1 -> myproject
  • myproject-web-1 -> myproject
  • standalone -> standalone (no prefix)

Types

type NodeType

type NodeType int
const (
	NodeTypeProject NodeType = iota
	NodeTypeContainer
)

type Tree

type Tree struct {
	Root     *TreeNode
	Flat     []*TreeNode // Flattened view for navigation
	Selected int
}

func BuildTree

func BuildTree(containers []docker.ContainerInfo) *Tree

BuildTree groups containers by project prefix

func (*Tree) GetDepth

func (t *Tree) GetDepth(node *TreeNode) int

GetDepth returns the depth of a node in the tree

func (*Tree) GetNodePath

func (t *Tree) GetNodePath(node *TreeNode) string

GetNodePath returns a unique path identifier for a node

func (*Tree) GetSelected

func (t *Tree) GetSelected() *TreeNode

GetSelected returns the currently selected node

func (*Tree) MoveDown

func (t *Tree) MoveDown()

MoveDown moves selection down

func (*Tree) MoveUp

func (t *Tree) MoveUp()

MoveUp moves selection up

func (*Tree) RestoreSelection

func (t *Tree) RestoreSelection(path string)

RestoreSelection attempts to restore selection to a node with the given path

func (*Tree) ToggleExpanded

func (t *Tree) ToggleExpanded()

ToggleExpanded toggles the expanded state of the selected node

func (*Tree) UpdateFlatView

func (t *Tree) UpdateFlatView()

UpdateFlatView creates a flattened view of visible nodes for navigation

type TreeNode

type TreeNode struct {
	Type      NodeType
	Name      string
	Container *docker.ContainerInfo
	Children  []*TreeNode
	Expanded  bool
	Parent    *TreeNode
}

Jump to

Keyboard shortcuts

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