Z-Wave-Me / home-automation

Z-Way Home Automation engine
182 stars 116 forks source link

How to create a module with new modal element #503

Open michapr opened 4 years ago

michapr commented 4 years ago

Hi,

I cannot find a description how to create a new module with a modal file (for opening a new DIV)

I'm creating a new Chart module (inspired by intchart) - and all is working as expected, but I do not know how to create a new modal element. Even modify the existing seems not to be possible easy, because the elements are inside the (old) build.js and templates.js files and taken from there.

In documentation do not find anything about it.

So question is, how to create the graphModal.html inside Z-Way, so that it can be used. And - what is the right way to add an icon for statistics inside the device widget (like yout history or the Intchart symbol).

In this time using a modified Intchart structure (file names) but want to modify as sample the modal element.

Thanks!

Michael

PoltoS commented 4 years ago

Unfortunatelly there is no easy way to do it in the current architecture except for mangling the UI sources.

There are actually only four places to mangle:

If the new chart will be pretty easy to use, we can try to implement it in the main branch (or accept a pull-request)

michapr commented 4 years ago

Where can I find this files in the local installation - and how to merge the modified files there? in /opt/z-way-server/htdocs/smarthome/app/ is no "views" and "controllers" directory.

I have seen at https://github.com/Z-Wave-Me/home-automation/wiki/How-to-create-a-widget that templates should be precompiled:

$ cd /path/to/automationFolder
$ nunjucks-precompile ./templates/ > ./htdocs/_templates.js

But it seems that "_templates " is not existing more... Is this the right way for inserting new elements?

And - will this changes be overwritten in case of updating? I think so,...

Implementing in main branch could not be possible because of license terms of highcharts - it is free for personal not commercial use only - so it could be added by me (when finished) as module "for personal use" only...