Skip to content
ConsoleMonster
Class

Phases

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

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

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

Accepted by parameters 8

Constructors

public Phases(string widgetId = "phases") #

Creates a phases widget.

Parameters

widgetId string = "phases" optional
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 required
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 required
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 required
The dispatcher.

Returns

PhasesHandle The handle.
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 required
The zero-based position; a position past the end appends.
key string required
Unique key (also the label when label is null).
status ConsoleMonster.Styling.StatusKind = Pending optional
Status.
label string? = null optional
Label (markup), or null.
detail string? = null optional
Detail, or null.

Returns

Phases This instance.

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 required
The key of an existing phase.
key string required
The item key, unique within the phase (also the label when label is null).
status ConsoleMonster.Styling.StatusKind = Pending optional
The item status.
label string? = null optional
Label (markup), or null to keep the existing one.
detail string? = null optional
Detail (duration, percentage), or null to keep the existing one.

Returns

Phases This instance.

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 required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
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 required
The target region.
context ConsoleMonster.Canvas.RenderContext required
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 required
Unique key (also the label when label is null).
status ConsoleMonster.Styling.StatusKind = Pending optional
Status.
label string? = null optional
Label (markup), or null.
detail string? = null optional
Detail (duration, percentage), or null.

Returns

Phases This instance.

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 required
The key of an existing phase.
item string required
The key of an existing item of that phase.
key string required
The sub-item key, unique within the item (also the label when label is null).
status ConsoleMonster.Styling.StatusKind = Pending optional
The sub-item status.
label string? = null optional
Label (markup), or null to keep the existing one.
detail string? = null optional
Detail, or null to keep the existing one.

Returns

Phases This instance.

Exceptions

  • ArgumentException – The phase or the item has not been added, or the key is empty or contains U+001F.

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 IReadOnlyList<StatusItem> Items { get; } #

The phases in order.

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.

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 required
The instance.
value bool = true optional
The value; true when omitted.

Returns

Phases The same instance.

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 required
The instance.
value int required
The value.

Returns

Phases The same instance.

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 required
The instance.
value bool = true optional
The value; true when omitted.

Returns

Phases The same instance.

Examples

// C# initializer or property                                         // C# fluent
new global::ConsoleMonster.Widgets.Phases { StepCounter = value };    Ui.Phases().StepCounter(value);