# orca.ui.runs

> A module of morca's API.

`/runs`, the runs list: newest first, filtered by pipeline, status (any of several, each with its count), trigger, when it was created, a run and its partitions, a page at a time (`orca.views.runs.RunsPage`), and its runs picked to cancel, retry or backfill again in one go (`orca.api.actions.bulk`); `/runs/table` is a list's page as the fragment it refreshes from, for `/runs`, a pipeline's Runs tab and the home page.

## Functions

### `grouped`

```mojo
def grouped(n: Int) -> String
```

`n` with commas between thousands: 1,234.

### `pager_link`

```mojo
def pager_link(mut h: Html, rel: StringSpan[ImmStaticOrigin], href: String, label: String)
```

### `runs_list`

```mojo
def runs_list(mut h: Html, mut db: State, p: RunsPage)
```

A runs table and its pager, refreshed from `/runs/table` while a run on it is queued or running, and slowly while it's the newest page, so new runs join it; an older page with nothing going on stays as it is.

### `runs_fragment_query`

```mojo
def runs_fragment_query(url: String) -> RunsQuery
```

The list a `/runs/table` URL names.

### `runs_table`

```mojo
def runs_table(mut db: State, url: String) -> Page
```

`/runs/table`: a runs list's page (`?view=list`, `pipeline` or `home`, its filters, `limit` and cursor) as an HTML fragment. While it has a run going on it says to ask again in `LIVE_EVERY` seconds; else the newest page says `IDLE_EVERY`, and an older one answers 286.

### `runs_filters_html`

```mojo
def runs_filters_html(mut h: Html, mut db: State, p: RunsPage, pipelines: List[String] = List(__list_literal__=NoneType(None)))
```

The filter bar over a runs list: a GET form, so it works without JavaScript, that keeps the page size; pipeline (on `/runs`, from `pipelines`), status (any of them, each with its runs under the other filters), trigger, created from and to, a partition (a glob or a part of one) and a run; the quick picks of when, and a link that clears them.

### `runs_done_html`

```mojo
def runs_done_html(mut h: Html, url: String)
```

What a bulk action did (`orca.api.actions.bulk`, which sends the browser back with `?did=` and its counts), said over the list.

### `runs_bulk_html`

```mojo
def runs_bulk_html(mut h: Html, p: RunsPage)
```

The form the runs list's checkboxes belong to (`form="bulk-runs"`): cancel, retry or backfill again the runs ticked, or every run that matches the filters, its number on the box that picks them, which the action checks is still so. Hidden until logged in, where login is on (`act__need`).

### `runs`

```mojo
def runs(mut db: State, var q: RunsQuery, url: String = "") -> Page
```

`/runs`: a page of runs newest first, filtered, by id under `q.before` or just above `q.after` (`runs_page`); with how many match and links to the newest, newer and older pages, and refreshed while it can change (`runs_list`). `?run=` a run that's there goes to its page.

### `jumped`

```mojo
def jumped(p: RunsPage) -> Bool
```

Whether the list was asked for one run (`?run=`) and has it: the page goes to the run's own.

## Aliases

### `RUN_STATUSES`

```mojo
comptime RUN_STATUSES = List(String("queued"), String("running"), String("deferred"), String("succeeded"), String("failed"), String("cancelled"), __list_literal__=NoneType(None))
```

The statuses a run takes (`orca.runs.status`), in the order a run goes through them; a deferred run waits for its `retry_at`.

### `RUN_TRIGGERS`

```mojo
comptime RUN_TRIGGERS = List(String("schedule"), String("sensor"), String("backfill"), String("manual"), String("ui"), String("rerun"), String("rebuild"), String("fill"), __list_literal__=NoneType(None))
```

The triggers orca writes (`orca.runs.trigger`): the scheduler's fires and sensors, `backfill`, a binary's `run`, the UI's start button, a rerun, a rebuild and a fill (`orca.fill`). The filter adds any others the table has.
