Skip to end of banner
Go to start of banner

Creating opCharts HTML Widgets

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

opCharts HTML widgets is a way to define templates which opCharts can render and present to the user.

Prerequisites

  • opCharts version >= 4.0.9
  • You will need system administration privileges so you can create the required files in the /usr/local/omk directory.

How to

Inside /usr/local/omk/templates/public/ create a new template file and have its prefix .html.ep example: acme_list.html.ep

You can define any arbitrary HTML as you see fit, mojolicious templates are also supported, see more on rendering mojolicious templates at https://mojolicious.org/perldoc/Mojo/Template

After any change you will need to restart the omkd daemon


Now you have what content can be rendered you need a opCharts component to tell the dashboard it can render this new file.

inside /usr/local/omk/lib/json/opCharts/components.d/ create a new json file we will use acme_component.json


acme_component.json
{
  "name": "Acme Component",
  "ep_template_file": "public/acme_list",
  "options": {
    "titleText": "My Title"
  },
  "type": "ep_template"
}


Name is what the component is called in the dashboards dropdown list

ep_template_file is the loccation of the template file.

titleText is the component display name

  • No labels