meerkat-dashboard/meerkat

Templating / Element Groups

s2156945 opened this issue · 1 comments

Prerequisites
The text size / zoom thing needs to be fixed such that text size scales exactly with the element sizes

Is your feature request related to a problem? Please describe.
These things are boring and repetitive

  • Creating many similar dashboards
  • Creating table-like dashboards
  • Creating summary dashboards

Describe the solution you'd like
For the purpose of this discussion, a dashboard is:

  1. A group of elements
  2. A background and a size
  3. Everything else - title, folder, URL

One way of doing templates would be to template the whole dashboard (like Meerkat V2) - i.e. all 3 parts of a dashboard. What I am proposing is to make the template based on a group of elements (#1) optionally with a background (#2).

Implicitly, all conventionally defined dashboards would be available as templates (possibly this would be a dropdown on each dashboard - this is a dashboard/elementgroup/both).

Templating / substitutions: to create a template - an elementgroup with substitutions:

  • start with a dashboard
  • add some keys e.g. site_name, site_prefix
  • enter the values for the variables (e.g. site_name = Launceston, site_prefix = LAU)
  • replace some values in the dashboard with %variable% e.g. the text content of the heading with %site_name%, the first part of the host name in many of the elements with %site_prefix%
  • The element editing interface could be in two modes - the current (dropdown?) mode and a "template" mode which would just give the strings and allow users to substitute in the %key% strings for substitution.
    This would create a "smart folder" for the template with one entry including the set of values for the variables
    To create other dashboards based on that template would just involve creating new sets of values for the existing keys

A new element type "elementgroup" would allow:

  • selection of the one of the available elementgroups.
  • value inputs for the defined substitutions.

So basic template function would be:

  • empty dashboard
  • elementgroup element taking up the whole dashboard
  • values set in that element

A table could be implemented by:

  • a "rowtemplate" dashboard with one row of elements with templating/substitutions for each element in the row as above
  • the "table" dashboard with one or two columns of "elementgroup" elements pointing to the "rowtemplate" elementgroup with the appropriate values for the keys

Tables could be simplified by a "table" element which gives rows and columns of any element with:

  • key/values for each row
  • key/values for each column
  • list of key/value sets which would be applied left to right
  • each cell would get the aggregation of the the key/values from the row, column and list

When an elementgroup is included on a dashboard, the geometry of each element would be transformed (scaled and translated) by simple algebra, where xo = "x of original", xr = "x resulting", xe = "x of elementgroup" etc.
h = ho * he / 100
w = wo * we / 100
x = xe + xo * we / 100
y = ye + yo * he / 100

Summary pages could include whole dashboards as a smaller representation, clicking on the elementgroup (whole area or background) could optionally take the user to the original dashboard.

Describe alternatives you've considered
Creating dashboards from scripts which directly produce JSON and the background images.
Creating templates from complete dashboards (like Meerkat V2)

Additional context

This is a bit of a brain dump, needs some clarification / examples on my part.

image
"Table" type dashboard example.

The "table" element would also need horizontal + vertical spacing values.

It would make sense to me to use jinja or similar as it may be useful to use maths e.g. to convert a row number to an index or ID in a check name see - https://jbmoelker.github.io/jinja-compat-tests/