Skip to content
Arjen van Bochoven edited this page Feb 19, 2022 · 5 revisions

Since MunkiReport 5.3.1 it is possible and advised to configure widgets using the built-in widget templates. You can use the widgets by adding your widgets as YAML files with an extension of .yml

At the moment there are three types of widgets available:

Scrollbox widget

Use this widget to show a list of entries with counts. The scrollbox widget takes in the following properties:

property required description
type yes to determine the widget type
widget_id. yes unique id, prefix with module name
api_url yes url to get the data from
i18n_title no i18n string that points to the localised title
icon. no icon for the widget
listing_link no link to the relevant listing
search_key no key to search for in the data
badge no if not set, no badge is shown, possible values: name of field, reg_timestamp, percent

Example

type: scrollbox
widget_id: hardware-model-widget
api_url: /module/machine/get_model_stats
i18n_title: machine.hardware_widget_title
icon: fa-laptop
listing_link: /show/listing/machine/hardware
search_key: label

Bargraph Widget

type: bargraph
widget_id: memory-widget
api_url: /module/machine/get_memory_stats
i18n_title: machine.memory.title
icon: fa-lightbulb-o
listing_link: /show/listing/machine/hardware
label_modifier: label + ' GB'
search_component: encodeURIComponent('memory = ') + parseInt(label) + 'GB'
margin: {left: 70}

Button widget

type: button
widget_id: installed-memory-widget
api_url: /module/machine/get_memory_stats/button
i18n_title: warranty.installed_memory_title
listing_link: /show/listing/machine/hardware
icon: fa-tasks
buttons:
  - label: < 4GB
    search_component: memory < 4GB 
    class: btn-danger  
  - label: 4GB + 
    search_component: 4GB memory 7GB 
    class: btn-warning
  - label: 8GB + 
    search_component: memory > 7GB 
    class: btn-success

Client detail widget

There's a special widget template that can be used to render a widget on the client summary page. For now there's only a table client detail widget. To populate it with data, you can use the script on one of the client detail tabs (disk_report), link to a js file (machine) or include a js file in the YAML.

property required description
type yes to determine the widget type 'table' is the only available value
id no unique id, prefix with module name
icon no icon for the widget
i18n_title no i18n string that points to the localised title
class no class for the title
table_id no id for the table
table yes array with rows

The table rows are defined as

property required description
i18n_header yes header in i18n format
prepend no string to prepend the value with
class no class for the <span> containing the row value
append no string to append the value with
js no javascript string that retrieves the values and fills the table
js_link no (relative) url pointing to a javascript file

Example

type: table
class: machine-computer_name
js_link: 
  - module/machine/js/machine_detail
  - module/tag/js/tag_detail
table:
    - i18n_header: last_seen
      class: reportdata-check-in_date
    - i18n_header: uptime
      class: machine-uptime
    - i18n_header: business_unit.machine_group
      class: machine-machine_group
    - i18n_header: reg_date
      class: reportdata-reg_date
    - i18n_header: status
      class: reportdata-archive_status
Clone this wiki locally