CUI

Components / Developer tools

Pipeline

A CI or CD run: each stage is a column of its jobs with their status and duration, and connectors run between the stages.

Functions: cui_pipeline

Pipeline

Usage

static const char *stages[] = { "Build", "Test", "Deploy" };
static const cui_pipeline_job jobs[] = {      /* name, stage, status, seconds (-1: not run), allow_failure */
    { "linux-x64", 0, CUI_JOB_PASSED, 142 },
    { "unit", 1, CUI_JOB_RUNNING, 95 },
    { "lint", 1, CUI_JOB_FAILED, 12, true },
    { "production", 2, CUI_JOB_PENDING, -1 },
};
static int selected = -1;
cui_pipeline_result r = cui_pipeline(ui, "run", stages, 3, jobs, 4, .selected = &selected);
if (r.clicked >= 0) show_log(&jobs[r.clicked]);

A stage's header sums up its jobs: failed beats running, then pending; a failure with allow_failure shows a warning and does not fail the stage. Running jobs show a spinner. Below 560 points the stages stack top to bottom.

Returns a cui_pipeline_result: clicked is the job clicked this frame and hovered the job under the pointer, both indices into jobs, or -1. jobs is your flat array and is only read; each job names its stage by an index into stages. duration is in seconds, and a negative value means the job has not run and shows no time, so use -1 there: 0 shows as a time. selected points at your int: the pipeline marks that job and writes the index on a click.

Keyboard

  • Tab moves through the jobs, and Enter or Space clicks the focused one.

Options of cui_pipeline

OptionTypeDefaultDescription
.widthcui_sizeWidth: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own.
.selectedint *job shown selected, set on a click

cui_pipeline_job

FieldTypeDescription
nameconst char *shown on the job's row and in its tooltip
stageintindex into the stage names
statuscui_job_statusOne of CUI_JOB_PENDING, CUI_JOB_RUNNING, CUI_JOB_PASSED, CUI_JOB_FAILED, CUI_JOB_SKIPPED or CUI_JOB_CANCELED.
durationfloatseconds; negative when it has not run
allow_failureboola failure does not fail the stage

cui_job_status: CUI_JOB_PENDING, CUI_JOB_RUNNING, CUI_JOB_PASSED, CUI_JOB_FAILED, CUI_JOB_SKIPPED, CUI_JOB_CANCELED

cui_pipeline_result

FieldTypeDescription
clickedintjob clicked this frame (or chosen with Enter or Space), or -1
hoveredintjob under the pointer, or -1

Related

  • Query builder: A filter built from conditions joined by all or any, in groups that nest.
  • Problems panel: Compiler and linter output grouped by file, with each file's count.
  • Schedule picker: A cron schedule edited through plain choices instead of the expression, with the next runs listed.
  • Key-value editor: Rows of key and value fields for HTTP headers, query parameters or environment variables.