Duration
The duration column type displays time spans in human-readable format (e.g., 2h 30m, 1d). Values are expected in nanoseconds.
| Field | Description | Scheme |
|---|---|---|
name* | Column name (must be a valid SQL identifier) |
|
type* | Data type that controls formatting and visualization |
|
badge | Badge styling configuration. Use | |
card.position | Where this column appears in the card layout: |
|
card.useForAccent | Set to |
|
description | Human-readable help text for the column |
|
filter | Enable server-side filtering for this column. Set | object |
hidden | Hide the column from the table view (default: false) |
|
icon | CEL expression that resolves to an icon name per row (e.g. |
|
primaryKey | Whether this column is part of the primary key (default: false). At least one column must be marked as primary key. |
|
unit | Unit label appended to the displayed value (e.g. |
|
url | Link to a config, another view, or a custom URL using CEL / Go templates | |
width | Display width, e.g. |
|
Example
pipelines.yamlapiVersion: mission-control.flanksource.com/v1
kind: View
metadata:
name: pipelines
namespace: mc
spec:
display:
title: Pipelines
icon: github
sidebar: true
table:
sort: "-lastRun"
size: 5
cache:
maxAge: 30m
minAge: 1m
refreshTimeout: 30s
panels:
- name: Repository
type: table
query: SELECT COUNT(*) AS value, details->'repository'->>'full_name' as repository FROM workflows GROUP BY details->'repository'->>'full_name'
- name: Average Duration
description: Create Release average duration
type: duration
query: >
SELECT AVG(details->'duration') AS value, details->'repository'->>'full_name' as label
FROM workflows GROUP BY details->'repository'->>'full_name'
columns:
- name: id
type: string
description: The id of the pipeline.
primaryKey: true
hidden: true
- name: repository
type: string
description: The repository of the pipeline.
width: "2"
filter:
type: multiselect
- name: name
type: string
description: The name of the pipeline.
width: "3"
filter:
type: multiselect
- name: lastRun
type: datetime
description: The namespace name.
width: "2"
- name: lastRunBy
type: string
description: The chart name.
width: "2"
filter:
type: multiselect
- name: duration
type: duration
width: "1"
description: The duration of the pipeline.
- name: status
type: status
width: "1"
description: The status of the pipeline.
filter:
type: multiselect
queries:
workflows:
changes:
limit: 10
search: change_type=GitHubActionRun* @order=-created_at
types:
- GitHubAction::Workflow
mapping:
name: row.name.split('/')[1]
lastRun: row.details.created_at
lastRunBy: row.details.triggering_actor.login
repository: row.details.repository.full_name
status: >
has(row.details.conclusion) ? row.details.conclusion : 'pending'
duration: timestamp(row.details.updated_at) - timestamp(row.details.run_started_at)