wizzy icon indicating copy to clipboard operation
wizzy copied to clipboard

PoC: Add support for templating

Open johnsudaar opened this issue 5 years ago • 9 comments

This is a basic support for templating in wizzy. Adding it ad the fs part make it really easy and makes templating available for every wizzy resources.

The templating engine used is handlebars: http://handlebarsjs.com/

johnsudaar avatar Aug 06 '19 20:08 johnsudaar

Small demo: https://streamable.com/7lghf

johnsudaar avatar Aug 06 '19 20:08 johnsudaar

That is very nice! I feel like the original author is not maintaining the lib anymore. I think it would be worth forking or asking him to have a new maintainer. How does it work if you import changes from the remote? I guess it would override it right? Also I think it would be better if we could import those parameters from a configuration that could be set per environment.

Sytten avatar Aug 06 '19 20:08 Sytten

Thanks. Yeah importing a dashboard would override the hbs file back to the raw json. I don't see any workarround for that.

Good idea having a way to store those variables in a file can be cool. Maybe in wizzy/config.js we could use a variable entry that could be set globally and per context?

johnsudaar avatar Aug 07 '19 06:08 johnsudaar

Yeah that's what I feared (for import), maybe a good first step would be to warn the user if he overrides a template? It would be nice to be able to be able to modify a dashboard in grafana and still be able to import the diff.

I am not sure I would put it all in config.js. It could be use for sensitive variables, but it would also be nice to have another file for non-sensitive variables that could be commited.

Sytten avatar Aug 07 '19 15:08 Sytten

Feel free to merge this PR guys, you both have the ability to merge the PRs to the project. I will work on the Release and Org side so that you guys have more control on this project.

utkarshcmu avatar Aug 07 '19 17:08 utkarshcmu

Detecting if the template has been modified by the user or if the remote had changed is not an easy task.

We could add the templating engine only if the file has a particular extension (like: .json.tmpl) and warn the user if he tries to import a dashboard that has a template file.

johnsudaar avatar Aug 26 '19 11:08 johnsudaar

Do you plan to finish the feature and add tests for it? It would be nice to have the feature land in 0.8.0.

Sytten avatar Sep 03 '19 22:09 Sytten

Hi there Sorry for the long time there, i had other things that took priority ...

What does this PR miss to be merged ?

johnsudaar avatar Feb 19 '20 14:02 johnsudaar

Heee let me review it, I am also super busy

Sytten avatar Feb 19 '20 20:02 Sytten