> Version 0.6 brings DashMachine one big step forward to being a finished product by adding a gui to edit the various settings in the config.ini. **Changelog** - improvements to /home including 'pinned' cards, multi-select tag filtering, 'action providers' allowing you to do web searches from the searchbar - rebuilt sidenav with list view, mirroring filter/search/collapse state of the homepage - /settings and /home now on same route - dynamic reloading of settings (no more page reloads) - dedicated config.ini editor slide-out - settings editor slide-out - card editor slide-out - better access group control - dedicated documentation pages - improved documentation - new system for automatically generating documentation for platforms - ability to load custom platforms - added an 'on_starup' method for platforms allowing for registering api routes. (example coming soon)
2.2 KiB
Data Sources
Data sources provide information to cards on the dashboard. Here's how it works in a nutshell:
- If a card is configured with a data source, once the dashboard has loaded, the web client will go through each data source and request information from the server.
- A data source 'platform' on the server handles the information request, and returns html to the web client.
- The web client then appends the returned html in the 'data source container' on the card.
For apps the 'data source container' is this area:
For custom cards the 'data source container' is this area:
What are 'platforms' and what can they do?
Platforms are simply a python file on the server, set up to take in configuration data from the config.ini and return html back to the web interface. The platforms included with DM are found at DashMachine/dashmachine/platform
. This is the 'official' set of data source platforms created for DM by Ross and the community.
Some examples on what a platform can do:
- Any data creation/manipulation that the Python language is capable of
- make calls on REST APIs
- format data as html
- return html with javascript to create interactive cards, or interact with the DOM
- register new API resources on the DM server.
Value Templates
Some platforms allow for the user to create the template for the data source in the configuration. The platform will provide a number of variables the user's template will have access to. If you see a platform with a variable value_template
, you will need to set it as a jinja template html string. For example, the pihole
platform provides "domain_count", "queries", "blocked", "ads_percentage", "unique_domains", "forwarded", "cached", "total_clients", "unique_clients", "total_queries", "gravity_last_updated"
. So our value template could look like:
value_template = Ads Blocked Today: {{ blocked }}<br>Status: {{ status }}<br>Queries today: {{ queries }}
See Jinja Templating