Skip to content
DataViews

DataViews

A dataview is a useful component in Cavaliba to improve access to relevant information.

It enables data administrators to create predefined views of Schemas and objects. These predefined views contain subsets of fields from a Schema. Users can select a dataview from a list in the Web UI for faster access to the data they need.

You can define multiple DataViews per Schema for different types of users or different needs.

For example, a site Schema describing various locations, headquarters, facilities, factories, buildings for a company, could use an Address dataview which would display only the relevant fields for postal/address such as City, Zipcode, Street, Country. Other dataviews for the same Schema could present Organization, Key Figures, Activities, etc.

DataView objects

DataViews are implemented as a special builtin Schema and can thus be managed from the Web UI, REST API, console CLI, import/export, etc.

Create a Dataview

- classname: _dataview
  keyname: site_postal
  target_class: site
  displayname: Postal
  description: This View displays Geographical information about sites
  content: |
    columns:
      - field: keyname
        label: Site
      - field: address
      - field: zip
        label: Zip Code
      - field: city
      - field: country

This creates a dataview named site_postal for the (target_class) site. Each column shows one field of the schema, or a builtin attribute: keyname, displayname, is_enabled, last_update, last_sync.

label sets the column header. Without it, the header is the field name.

Column options (v5.6.0)

Option Values Default
field field name or builtin attribute
datapoint computed value, see Datapoints below
key part of a datapoint value (e.g. percent)
label header text field / datapoint name
align left center right auto auto: numbers right
format number format, e.g. "{:,.2f}"
unit text added after the value, e.g. " EUR"
widget text number progress badge bool link_list field’s own display
style list of bold mono small muted nowrap
color list of rules, see below
width xs sm md lg xl automatic
popover yes / no, see below yes
sort / filter yes / no, smart table, see below yes
hidden yes / no no
maxlen cut long text, e.g. 40, see below
humanize human-friendly value, e.g. bytes GB, see below

Each column has exactly one field or datapoint.

Number format and unit:

    columns:
      - field: keyname
      - field: bed
        label: Beds
        format: "{:,}"       # 1,250
        unit: " beds"        # 1,250 beds
      - field: budget
        format: "{:,.2f}"    # 12,500.00
        unit: " EUR"

Colors: the first matching rule colors the cell. Operators: < <= > >= == !=. Classes: success warning danger info.

      - field: bed
        color:
          - { when: ">= 200", class: success }
          - { when: "< 20", class: warning }
      - field: status
        widget: badge
        color:
          - { when: "== KO", class: danger }

On date and datetime fields, and on last_update / last_sync, rules compare dates and accept the same values as the search box: now, today, -4d, +30d (also written now-4d, now+30d), 2026, 2026-11, 2026-11-28. Units: h d w m y.

      - field: valid_to
        label: Expires
        color:
          - { when: "< now", class: danger }      # expired
          - { when: "< +30d", class: warning }    # expires within 30 days
          - { when: ">= +30d", class: success }
      - field: last_sync
        color:
          - { when: "< -4d", class: danger }      # not synced for 4 days
      - field: start_date
        color:
          - { when: "== 2026", class: info }      # any day in 2026

With == and !=, a year, month or day means the whole period. “now” is when the page is displayed. A date that can’t be read never matches, and is reported in the logs.

Alignment, style and width:

      - field: keyname
        style: [mono]
        width: sm
      - field: country
        align: center
      - field: is_enabled
        label: Active
        widget: bool         # check mark

A hidden column is not shown in the list, but is still preselected when you open the Exporter from that view.

Long text: maxlen

      - field: description
        maxlen: 30          # "Pediatrics server and digital (...)"

Text longer than maxlen characters is cut and ends with (...). Hover the cell to see the full text. The smart table sorts and filters on the full text.

On a plain field, maxlen shows the value as text: links of reference fields and enumerate icons are not shown in that column.

Human-friendly values: humanize

      - field: disk_gb
        label: Disk
        humanize: bytes GB      # 2000 -> 2 TB
      - field: purchase_date
        humanize: relative d    # 1408 days ago
      - field: last_sync
        humanize: relative dh   # 3d 4h ago
humanize Value Shows
bytes 1536000000 1.5 GB (1 KB = 1000 B)
bytes MB 1536 (stored in MB) 1.5 GB
ibytes 1610612736 1.5 GiB (1 KiB = 1024 B)
ibytes KiB 1572864 (stored in KiB) 1.5 GiB
si 1234567 1.2 M; with unit: "W": 1.2 MW
percent 0.456 45.6%
duration 12000 (seconds) 3h 20min
duration min / duration h 200 (minutes) / 3.5 (hours) 3h 20min / 3h 30min
relative a date 10d 3h ago, in 34 days, now
day a date today, yesterday, tomorrow, else the date

Precision of relative and duration: d, dh, dhm, dhms (compact: 10d 3h 20min) or one unit d, h, m, s (spelled out: 10 days, 567 hours). Defaults: relative dh, duration dhm.

For duration, the first word after duration is the stored unit (s, min, h, d), the second the precision: duration d is a value stored in days, duration s d shows seconds as days.

  • format sets the decimals: humanize: bytes with format: ".2f" shows 1.54 GB.
  • Colours, sorting and export use the real value: 900 MB sorts before 1.5 GB, a colour rule >= 1000 on bytes GB compares gigabytes.
  • relative and day work on date and datetime fields, and on last_update / last_sync. Hover the cell to see the date.
  • A value that doesn’t fit (text in a bytes column) is shown as is. A humanize on the wrong kind of field is ignored and reported in the logs.

Invalid options are ignored (the column keeps its default look) and reported in the logs. A dataview never breaks the list page.

Datapoints (v5.6.0)

A datapoint is a value computed by Cavaliba, not stored in a field. It has no field, so give it a label.

IPAM datapoints:

Datapoint Schema Keys
ipam.subnet ipam_subnet size, prefixlen, netmask, first_ip, last_ip
ipam.occupancy ipam_subnet count, percent, size
ipam.subnet_vlans ipam_subnet VLANs using the subnet (links)
ipam.vlan_subnets ipam_vlan subnets of the VLAN (links)
ipam.vlan_occupancy ipam_vlan count, percent, size (all subnets)

Example, the builtin subnet view:

- classname: _dataview
  keyname: ipam_subnet_default
  target_class: ipam_subnet
  displayname: Default
  content: |
    columns:
      - field: keyname
        label: Subnet
        style: [mono]
      - field: description
      - datapoint: ipam.subnet
        key: size
        label: Size
        align: right
      - datapoint: ipam.occupancy
        key: count
        label: Used
        align: right
      - datapoint: ipam.occupancy
        key: percent
        label: Occupancy
        widget: progress
        unit: "%"
        color:
          - { when: ">= 90", class: danger }
          - { when: ">= 70", class: warning }
      - datapoint: ipam.subnet_vlans
        label: VLAN

You can copy and edit it like any dataview: remove columns, change labels, thresholds or colors.

A datapoint used on another schema, or an unknown one, shows an empty column.

Smart table (v5.6.0)

List pages are smart tables: click a column header to sort, type in the box under a header to filter.

  • Sort and filter act on the current page only. The search box and paging still select which objects are loaded.
  • Click again to reverse the order. Empty cells always come last.
  • Numbers sort as numbers (also when shown with humanize), dates by date, IP addresses and subnets in address order (10.0.0.0/8 before 10.0.0.0/24), the rest alphabetically.
  • The counter above the table shows visible / total on this page.
  • Changing page or reloading resets sort and filters.

Per column:

    columns:
      - field: keyname
      - field: description
        sort: no          # header not clickable
      - field: bed
        filter: no        # no filter box under this header

Per dataview, turn it off:

  content: |
    options:
      smart_table: no
    columns:
      - field: keyname

The default for all list pages is the DATA_SMART_TABLE configuration option (data app, yes). With DATA_SMART_TABLE: no, a dataview can still turn it on with smart_table: yes.

Column help popover (v5.1.0)

In the Web UI, a column header can show a small “?” popover revealing the real underlying field name - useful to know what to type in the search box (see Search & Filters), especially when a column has a custom label. The popover also offers a Filter button that appends fieldname: to the search box for you to complete.

The popover only appears on columns the search box can filter: keyname, displayname, is_enabled, last_update, last_sync and the schema’s own fields. Injected subfields (e.g. owner__email, myenum__widget), external fields and datapoints get no popover.

To hide it on a column anyway:

  columns:
    - field: keyname
      label: Login
      popover: no

Since v5.6.0, filter: no controls the smart table filter box, no longer the popover’s Filter button.

Older syntax

Dataviews written before v5.6.0 keep working, no change needed:

Older syntax Same as
- city - field: city
- City: {from: city} - {field: city, label: City}
- mystring: {popover: no} - {field: mystring, popover: no}

The older form also accepts the new options, e.g. - Beds: {from: bed, align: right}.

Query filter (v5.3.0)

A dataview can also narrow which objects are listed, not just which columns are shown. The optional query field holds a search expression, in the syntax of the list page’s search box (see Search & Filters):

- classname: _dataview
  keyname: laptop_obsolete
  target_class: laptop
  displayname: Obsolete laptops
  description: Laptops still in the inventory but out of support
  query: status:obsolete
  content: |
    columns:
      - keyname
      - displayname
      - status
      - site

Selecting that dataview in the Web UI loads status:obsolete into the search box and lists only the matching objects.

Behaviour to keep in mind:

  • The query is loaded only when the user selects the dataview. A query typed afterwards replaces it and is kept while browsing, paginating and coming back from an object’s detail page.
  • An empty query leaves the current filter in place - it does not clear the search box. Selecting a view cannot be used to remove a filter; the user clears the box.
  • The query is applied as if typed, so it respects the user’s read permissions and can be edited or removed in the search box at any time.
  • A query using characters the search box itself rejects is ignored (a warning is logged), so a malformed dataview never silently lists nothing.
  • Like any search, a field:value term reads the search index, which is refreshed asynchronously - a very recent change may not be matched yet.

Use a dataview

In the Web UI, the dataview selector is next to the Action button.

dataview

Default dataview

A schema without any associated dataviews will present default information in the Web UI, comprising keyname, displayname and last_update. This is not very useful.

You should create a default dataview for each Schema to present more relevant information by default.

By design, a default dataview is named with the schema name with a _default suffix.

Example (from the builtin Sirene Notification Application):

- classname: _dataview
  keyname: sirene_template_default
  target_class: sirene_template
  displayname: Default
  is_enabled: True
  description: Default DataView for Sirene Templates
  content: |
    columns:
      - field: keyname
      - field: displayname
      - field: category
        label: Category
      - field: severity
        label: Severity
      - field: hint
        label: Hint