Phases
ConsoleMonster.Widgets
A step strip for pipelines: ✓ Restore 2.1s › ✓ Build 12s › ⠹ Test 64% › ○ Pack. The active phase is emphasised; phases flow onto more lines when the width is short. A phase can carry items (Phases.Item); the running phase fans out to them under the strip (Phases.FanOut). Phases.Compact draws one line that folds to fit, and Phases.StepCounter a numbered ledger. Live operations (Key = phase): add (Text = label; for an existing phase it changes only the label), insert (Text = label, Value = position), state (State, Text = detail), detail (Text); for items (Key = phase, U+001F, item) and their sub-items (Key = phase, U+001F, item, U+001F, sub-item): item (State, Text = label) and item-detail (Text). A state or item event that finishes a row may give the time it took in milliseconds as Value; otherwise the time is measured from the event that started it.
Inheritance
- LiveWidget
- Phases
Usage
Explore 19 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 11
- Method Ui.Phases
- Extension method Phases.Compact
- Extension method Phases.FanOut
- Extension method Phases.StepCounter
- Method Phases.Insert
- Method Phases.Item
- Method Phases.Set
- Method Phases.SubItem
- Method PhasesFluent.Compact
- Method PhasesFluent.FanOut
- Method PhasesFluent.StepCounter
Accepted by parameters 8
- Method ContentBuilder.Phases
- Method ContentBuilder.Phases
- Extension method Phases.Compact
- Extension method Phases.FanOut
- Extension method Phases.StepCounter
- Method PhasesFluent.Compact
- Method PhasesFluent.FanOut
- Method PhasesFluent.StepCounter
Constructors
public Phases(string widgetId = "phases") #Creates a phases widget.
Parameters
- widgetId string = "phases"
- The live name (default phases).
Methods
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override string? Describe(LiveEvent liveEvent) #Returns a line describing the event for line-based outputs (Stream/Plain), or null when the event is not worth a line (for example a single counter increment). Called after ILiveTarget.Apply.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event that was applied.
Returns
string? A plain line or null.public PhasesHandle Handle(ILiveDispatcher dispatcher) #Returns a handle that updates the phases through a dispatcher.
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public Phases Insert(int index, string key, StatusKind status = Pending, string? label = null, string? detail = null) #Adds a phase at a position, for work planned after the run started that belongs between existing phases. A phase that already exists keeps its place and is updated as Phases.Set does. Live operation: insert (Key = phase, Text = label, Value = position).
Parameters
- index int
- The zero-based position; a position past the end appends.
- key string
- Unique key (also the label when label is null).
- status ConsoleMonster.Styling.StatusKind = Pending
- Status.
- label string? = null
- Label (markup), or null.
- detail string? = null
- Detail, or null.
Exceptions
ArgumentException– The key contains U+001F, which separates phase and item keys.
public Phases Item(string phase, string key, StatusKind status = Pending, string? label = null, string? detail = null) #Adds an item to a phase (a user, file or server it is working on) or updates the item's status.
Parameters
- phase string
- The key of an existing phase.
- key string
- The item key, unique within the phase (also the label when label is null).
- status ConsoleMonster.Styling.StatusKind = Pending
- The item status.
- label string? = null
- Label (markup), or null to keep the existing one.
- detail string? = null
- Detail (duration, percentage), or null to keep the existing one.
Exceptions
ArgumentException– The phase has not been added, or the key is empty or contains U+001F.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public override void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public Phases Set(string key, StatusKind status = Pending, string? label = null, string? detail = null) #Adds a phase or updates its status.
Parameters
- key string
- Unique key (also the label when label is null).
- status ConsoleMonster.Styling.StatusKind = Pending
- Status.
- label string? = null
- Label (markup), or null.
- detail string? = null
- Detail (duration, percentage), or null.
Exceptions
ArgumentException– The key contains U+001F, which separates phase and item keys.
public Phases SubItem(string phase, string item, string key, StatusKind status = Pending, string? label = null, string? detail = null) #Adds a sub-item under an item of a phase (a package under the stage that signs it) or updates its status. The step ledger lists sub-items under their item and folds a finished item's sub-items into a "done/total" count when it is short of space; the fan-out and the compact chain show items only.
Parameters
- phase string
- The key of an existing phase.
- item string
- The key of an existing item of that phase.
- key string
- The sub-item key, unique within the item (also the label when label is null).
- status ConsoleMonster.Styling.StatusKind = Pending
- The sub-item status.
- label string? = null
- Label (markup), or null to keep the existing one.
- detail string? = null
- Detail, or null to keep the existing one.
Exceptions
ArgumentException– The phase or the item has not been added, or the key is empty or contains U+001F.
Inherited Methods
Properties
public bool Compact { get; set; } #Draws the phases as one line that folds to fit, for a table cell, a status-list detail or a header: ✓ Fetch › ● Build 40% › ○ Test. When the line is too wide, phases around the current one (the first failed, running or pending phase) fold into ✓ +2 earlier and ○ +3 more, then into plain counts, and finally the current phase drops its detail. At very narrow widths, surrounding counts are omitted before the current phase is shortened. Other failures can be represented by a folded group's status. Items and the step counter are not shown in this form.
public bool StepCounter { get; set; } #Draws a numbered ledger with hanging labels and right-aligned details, placing a detail below its label when they cannot share a row. A running phase spins and shows its latest detail with the time it has been running (from the session clock); a finished phase keeps the duration it took (from its state events). A phase's items (Phases.Item) are listed under it. When the ledger is taller than its space (an inline live area), finished phases fold their items into a "done/total" count and running phases keep only their running and problem items; if that is still too tall, it shows whole phases around the furthest phase that has started, with the next phase below it, every running phase above pinned under "+N earlier", and "+N more" for the rest. The window only moves forward. An unbounded render (the final printed state) lists every item.
public int FanOut { get; set; } #Rows the current phase fans out to under the strip (default 5; zero hides items). The current phase is the first running one, otherwise the first failed one. When it has more items than rows, failed, warning and running items have priority for the available rows. The last row folds the remaining items into +N more with a count per status.
Inherited Properties
Extension Methods
public static Phases Compact(Phases phases, bool value = true) #Sets Phases.Compact: Draws the phases as one line that folds to fit, for a table cell, a status-list detail or a header: ✓ Fetch › ● Build 40% › ○ Test. When the line is too wide, phases around the current one (the first failed, running or pending phase) fold into ✓ +2 earlier and ○ +3 more, then into plain counts, and finally the current phase drops its detail. At very narrow widths, surrounding counts are omitted before the current phase is shortened. Other failures can be represented by a folded group's status. Items and the step counter are not shown in this form.
Parameters
- phases ConsoleMonster.Widgets.Phases
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Phases { Compact = value }; Ui.Phases().Compact(value);public static Phases FanOut(Phases phases, int value) #Sets Phases.FanOut: Rows the current phase fans out to under the strip (default 5; zero hides items). The current phase is the first running one, otherwise the first failed one. When it has more items than rows, failed, warning and running items have priority for the available rows. The last row folds the remaining items into +N more with a count per status.
Parameters
- phases ConsoleMonster.Widgets.Phases
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Phases { FanOut = value }; Ui.Phases().FanOut(value);public static Phases StepCounter(Phases phases, bool value = true) #Sets Phases.StepCounter: Draws a numbered ledger with hanging labels and right-aligned details, placing a detail below its label when they cannot share a row. A running phase spins and shows its latest detail with the time it has been running (from the session clock); a finished phase keeps the duration it took (from its state events). A phase's items (Phases.Item) are listed under it. When the ledger is taller than its space (an inline live area), finished phases fold their items into a "done/total" count and running phases keep only their running and problem items; if that is still too tall, it shows whole phases around the furthest phase that has started, with the next phase below it, every running phase above pinned under "+N earlier", and "+N more" for the rest. The window only moves forward. An unbounded render (the final printed state) lists every item.
Parameters
- phases ConsoleMonster.Widgets.Phases
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Phases { StepCounter = value }; Ui.Phases().StepCounter(value);