[GH-ISSUE #415] feature templating #347

Open
opened 2026-02-28 01:24:53 +03:00 by kerem · 21 comments
Owner

Originally created by @tablatronix on GitHub (Sep 8, 2017).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/415

I would like to add basic templating , ideas on how to implement welcome.

For starters, modifying http_input string for scan rows, what is the best way ?
A callout on wifiscan, a setter, some other templating method.

This needs to be discussed here, i do not want to have to add support framework for every element we want to allow customized, it will get out of hand, so we need a better mechanism, even callouts for now until we have a templating system.

Originally created by @tablatronix on GitHub (Sep 8, 2017). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/415 I would like to add basic templating , ideas on how to implement welcome. For starters, modifying http_input string for scan rows, what is the best way ? A callout on wifiscan, a setter, some other templating method. This needs to be discussed here, i do not want to have to add support framework for every element we want to allow customized, it will get out of hand, so we need a better mechanism, even callouts for now until we have a templating system.
Author
Owner

@tablatronix commented on GitHub (Sep 8, 2017):

adding wifiscan HTTTP_ITEM template tags
{R} RSSI
{e} encryption type

<!-- gh-comment-id:328164801 --> @tablatronix commented on GitHub (Sep 8, 2017): adding wifiscan `HTTTP_ITEM` template tags `{R}` RSSI `{e}` encryption type
Author
Owner

@tablatronix commented on GitHub (Sep 8, 2017):

Adding some styles
adding callouts, similar to kentaylors branch
chrome_2017-09-08_14-04-23

Probably gonna remove the success and just have the primary for actions, default for notes, danger for attention

<!-- gh-comment-id:328186541 --> @tablatronix commented on GitHub (Sep 8, 2017): Adding some styles adding callouts, similar to kentaylors branch ![chrome_2017-09-08_14-04-23](https://user-images.githubusercontent.com/807787/30227261-aa731b50-949e-11e7-97a0-3ecc1a0fdb39.png) Probably gonna remove the success and just have the primary for actions, default for notes, danger for attention
Author
Owner

@tzapu commented on GitHub (Sep 9, 2017):

as a mention, there was a very nice pull request around here, using webpack to spit out all the templates needed in a header file. it was cool because it did all the minimising and uglyfying for you.

<!-- gh-comment-id:328259200 --> @tzapu commented on GitHub (Sep 9, 2017): as a mention, there was a very nice pull request around here, using webpack to spit out all the templates needed in a header file. it was cool because it did all the minimising and uglyfying for you.
Author
Owner

@tablatronix commented on GitHub (Sep 9, 2017):

I will look around, I only remember the json one but it was bloated with a personal project and jquery

<!-- gh-comment-id:328276662 --> @tablatronix commented on GitHub (Sep 9, 2017): I will look around, I only remember the json one but it was bloated with a personal project and jquery
Author
Owner

@tzapu commented on GitHub (Sep 13, 2017):

i think this is the one
https://github.com/tzapu/WiFiManager/pull/282

thanks for all your great work

<!-- gh-comment-id:329082919 --> @tzapu commented on GitHub (Sep 13, 2017): i think this is the one https://github.com/tzapu/WiFiManager/pull/282 thanks for all your great work
Author
Owner

@tablatronix commented on GitHub (Sep 13, 2017):

Ill look it over, ignored that because I only say the translation part.
Adding i18n and externalizing the strings is on roadmap

<!-- gh-comment-id:329166886 --> @tablatronix commented on GitHub (Sep 13, 2017): Ill look it over, ignored that because I only say the translation part. Adding i18n and externalizing the strings is on roadmap
Author
Owner

@JacobBriggsAckama commented on GitHub (Jan 8, 2018):

Would it help if I was to see if I can resolve the merge conflicts in #282 and do some testing? I suppose I could fork this and add the code I need, but that is a code deadend and I'd rather my time be useful :)

<!-- gh-comment-id:355875239 --> @JacobBriggsAckama commented on GitHub (Jan 8, 2018): Would it help if I was to see if I can resolve the merge conflicts in #282 and do some testing? I suppose I could fork this and add the code I need, but that is a code deadend and I'd rather my time be useful :)
Author
Owner

@tablatronix commented on GitHub (Jan 8, 2018):

This is on next milestone so not really

<!-- gh-comment-id:355876299 --> @tablatronix commented on GitHub (Jan 8, 2018): This is on next milestone so not really
Author
Owner

@JacobBriggsAckama commented on GitHub (Jan 8, 2018):

okay, I'll fork and work against my own feature, and rework my sketch in the future once this has landed. Thanks for all your hard work @tablatronix

<!-- gh-comment-id:355876548 --> @JacobBriggsAckama commented on GitHub (Jan 8, 2018): okay, I'll fork and work against my own feature, and rework my sketch in the future once this has landed. Thanks for all your hard work @tablatronix
Author
Owner

@tablatronix commented on GitHub (Jan 8, 2018):

Please post ideas also.
I thought about callout filters

<!-- gh-comment-id:355876935 --> @tablatronix commented on GitHub (Jan 8, 2018): Please post ideas also. I thought about callout filters
Author
Owner

@JacobBriggsAckama commented on GitHub (Jan 8, 2018):

I'll have a think and see, but at the moment I feel like just having all the strings (along with their corresponding html) be parametrised and overridable on the server (IE on the esp8266) as in #393 would be the simplest method that would give us the smallest complied code.

I guess the other option would be to do the templating in javascript, using something like https://github.com/janl/mustache.js, or even better http://handlebarsjs.com/, then changing the content would be nice and contained.... We would be swapping processing power on the esp8266 for a larger download to the users phone but I am not sure that is really an issue.

<!-- gh-comment-id:356080066 --> @JacobBriggsAckama commented on GitHub (Jan 8, 2018): I'll have a think and see, but at the moment I feel like just having all the strings (along with their corresponding html) be parametrised and overridable on the server (IE on the esp8266) as in #393 would be the simplest method that would give us the smallest complied code. I guess the other option would be to do the templating in javascript, using something like https://github.com/janl/mustache.js, or even better http://handlebarsjs.com/, then changing the content would be nice and contained.... We would be swapping processing power on the esp8266 for a larger download to the users phone but I am not sure that is really an issue.
Author
Owner

@tablatronix commented on GitHub (Jan 8, 2018):

Well there is 2 things that need to happen all strings in a new include and callouts for real time logic

<!-- gh-comment-id:356107868 --> @tablatronix commented on GitHub (Jan 8, 2018): Well there is 2 things that need to happen all strings in a new include and callouts for real time logic
Author
Owner

@tablatronix commented on GitHub (Jan 8, 2018):

The only problem I have with that pattern is each callback needs a a setter, a constant, and maybe a global. Sonif we suddenly need 10 customs then its non maintainable.

<!-- gh-comment-id:356113418 --> @tablatronix commented on GitHub (Jan 8, 2018): The only problem I have with that pattern is each callback needs a a setter, a constant, and maybe a global. Sonif we suddenly need 10 customs then its non maintainable.
Author
Owner

@tzapu commented on GitHub (Jan 9, 2018):

for people that really want to customise the heck out of it, would it not be better maybe to have it somehow serve the html files from spiffs?
if it finds routes/templates on spiffs (or maybe a toggle to load from sd)load that, if not, present the embedded portal
this would allow pretty much endless customisation withour us having to worry about size of lib
it would also allow us to provide a smarter, prettier configuration portal, that is optional

also, i don't say this enough, but thank you @tablatronix , you are wonderful :D

<!-- gh-comment-id:356187429 --> @tzapu commented on GitHub (Jan 9, 2018): for people that really want to customise the heck out of it, would it not be better maybe to have it somehow serve the html files from spiffs? if it finds routes/templates on spiffs (or maybe a toggle to load from sd)load that, if not, present the embedded portal this would allow pretty much endless customisation withour us having to worry about size of lib it would also allow us to provide a smarter, prettier configuration portal, that is optional also, i don't say this enough, but thank you @tablatronix , you are wonderful :D
Author
Owner

@tablatronix commented on GitHub (Jan 9, 2018):

I think
.h file const
spiffs
callouts for select pages ( save, wifiscan, etc for dynamic logic )

But we still need to decide if templating will just be the same sprintf() mechanism or something better.

<!-- gh-comment-id:356373306 --> @tablatronix commented on GitHub (Jan 9, 2018): I think .h file const spiffs callouts for select pages ( save, wifiscan, etc for dynamic logic ) But we still need to decide if templating will just be the same sprintf() mechanism or something better.
Author
Owner

@sorriso93 commented on GitHub (Mar 28, 2018):

Hi I'm looking for request for new functionality but I didn't find it. Maybe this is the appropriate discussion. Is it not possibile to foresee in addition to custom ip configuration via the webserver also the hostname?

<!-- gh-comment-id:376923984 --> @sorriso93 commented on GitHub (Mar 28, 2018): Hi I'm looking for request for new functionality but I didn't find it. Maybe this is the appropriate discussion. Is it not possibile to foresee in addition to custom ip configuration via the webserver also the hostname?
Author
Owner

@tablatronix commented on GitHub (Mar 28, 2018):

Create a new feature request issue thx

<!-- gh-comment-id:376936979 --> @tablatronix commented on GitHub (Mar 28, 2018): Create a new feature request issue thx
Author
Owner

@dontsovcmc commented on GitHub (Nov 5, 2019):

  1. The main problem - the third 'wifisaved screen' page! It doesnt' needed!
    Userfriedly way - to see wi-fi status somewhere near button 'safe' cause if error happened - you can change ssid, pwd on the page.
    I see, that /status request is very sloow on master branch. Maybe this feature for the dev branch.

  2. Now I test radiobuttons as SSIDs:
    const char HTTP_ITEM[] PROGMEM = "<label class='radcontainer'>{v}<input type='radio' name='network' value='{v}' onclick='c(this)'><span class='radiomark'></span>{qi}{qp}</label>";
    function c changes:
    function c(l){document.getElementById('s').value=l.value;

<!-- gh-comment-id:549920623 --> @dontsovcmc commented on GitHub (Nov 5, 2019): 1. The main problem - the third 'wifisaved screen' page! It doesnt' needed! Userfriedly way - to see wi-fi status somewhere near button 'safe' cause if error happened - you can change ssid, pwd on the page. I see, that /status request is very sloow on master branch. Maybe this feature for the dev branch. 2. Now I test radiobuttons as SSIDs: `const char HTTP_ITEM[] PROGMEM = "<label class='radcontainer'>{v}<input type='radio' name='network' value='{v}' onclick='c(this)'><span class='radiomark'></span>{qi}{qp}</label>";` function c changes: `function c(l){document.getElementById('s').value=l.value;`
Author
Owner

@tablatronix commented on GitHub (Nov 5, 2019):

I have no idea what you mean lol

<!-- gh-comment-id:549966219 --> @tablatronix commented on GitHub (Nov 5, 2019): I have no idea what you mean lol
Author
Owner

@dontsovcmc commented on GitHub (Nov 5, 2019):

I mean to increase usability WiFiManager should remove "/wifisave" page and show connect status near button

<!-- gh-comment-id:549988894 --> @dontsovcmc commented on GitHub (Nov 5, 2019): I mean to increase usability WiFiManager should remove "/wifisave" page and show connect status near button
Author
Owner

@tablatronix commented on GitHub (Nov 5, 2019):

wifisave exists because we have to shut the ap down to connect, you cannot just connect to the sta in the background. It is that way on purpose

<!-- gh-comment-id:550025447 --> @tablatronix commented on GitHub (Nov 5, 2019): wifisave exists because we have to shut the ap down to connect, you cannot just connect to the sta in the background. It is that way on purpose
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#347
No description provided.