2024 Jul 09, 12:29 AM
Hi Dan,
I've written a plugin that logs the water pressure for the system, and displays a graph of that on the home page, so it's easy to correlate with the history. It seems to be working pretty well, but I needed more access to the home page html than seems to be offered by the plugin architecture.
I believe the limits of the plugin architecture WRT the display, are adding completely new pages, adding a bit of text to the footer, or adding to the status text on the timeline. Did I miss something or is this really the limit?
In order to display the graph I want to insert and populate an additional table row in the schedule table, aligned with the program display for system maintenance purposes. Right now I manually add a <script src="..."> tag to home.html, and use this to attach events to generate the UI changes (jQuery listeners and DOM MutationObservers).
Maintaining even this single line of code different from the trunk isn't ideal, so I started thinking about a more general way to accomplish this. For instance adding a global variable which would contain a list of scripts to inject, something like:
gv.plugin_scripts = [];
Each plugin could augment register the need to inject scripts into the home page by populating this variable:
gv.plugin.append(["home", "pressure_monitor.js"]);
When any UI page is loaded, it would check for any relevant script injection requests and process them. The result in this case would be to generate a <script src="static/scripts/pressure_monitor.js"></script> tag in the home page.
WDYT? Would this be granting too much power to plugin developers?
- Jonathan
I've written a plugin that logs the water pressure for the system, and displays a graph of that on the home page, so it's easy to correlate with the history. It seems to be working pretty well, but I needed more access to the home page html than seems to be offered by the plugin architecture.
I believe the limits of the plugin architecture WRT the display, are adding completely new pages, adding a bit of text to the footer, or adding to the status text on the timeline. Did I miss something or is this really the limit?
In order to display the graph I want to insert and populate an additional table row in the schedule table, aligned with the program display for system maintenance purposes. Right now I manually add a <script src="..."> tag to home.html, and use this to attach events to generate the UI changes (jQuery listeners and DOM MutationObservers).
Maintaining even this single line of code different from the trunk isn't ideal, so I started thinking about a more general way to accomplish this. For instance adding a global variable which would contain a list of scripts to inject, something like:
gv.plugin_scripts = [];
Each plugin could augment register the need to inject scripts into the home page by populating this variable:
gv.plugin.append(["home", "pressure_monitor.js"]);
When any UI page is loaded, it would check for any relevant script injection requests and process them. The result in this case would be to generate a <script src="static/scripts/pressure_monitor.js"></script> tag in the home page.
WDYT? Would this be granting too much power to plugin developers?
- Jonathan