[Webserver] Rework Web Page handling, get them as static as possible #13

Open
opened 2024-07-28 02:40:56 +02:00 by DeltaLima · 1 comment
Owner

Current page handling is a nightmare

    String body = returnHTMLheader("growSettings");
    
    if(strlen(GrowName) < 1) {
      body += "<h1>Final step: Grow settings</h1>";
      body += "<p>Please configure all settings<br>";
      body += "</p>";
      GrowStart = timeClient.getEpochTime();
    }
    
    body += "<h2>&#128262; Grow settings</h2>";
    if(webserver.hasArg("success")) {
      body += FPSTR(HTMLsuccess);
    } 
    body += "<p>Here you can set everything grow related, like light hours, how much water, LED brightness<br>";
    body += "</p>";
    
    body += "<form method='post' action='/growSettings/save'>\n";
    
  

I would like to store the basic html page in LittleFS and do all the dynamic things with javascript. WLED and Tasmota have good examples for this

Current page handling is a nightmare ``` String body = returnHTMLheader("growSettings"); if(strlen(GrowName) < 1) { body += "<h1>Final step: Grow settings</h1>"; body += "<p>Please configure all settings<br>"; body += "</p>"; GrowStart = timeClient.getEpochTime(); } body += "<h2>&#128262; Grow settings</h2>"; if(webserver.hasArg("success")) { body += FPSTR(HTMLsuccess); } body += "<p>Here you can set everything grow related, like light hours, how much water, LED brightness<br>"; body += "</p>"; body += "<form method='post' action='/growSettings/save'>\n"; ``` I would like to store the basic html page in LittleFS and do all the dynamic things with javascript. WLED and Tasmota have good examples for this
DeltaLima added this to the CanGrow Firmware project 2024-09-16 00:25:23 +02:00
Author
Owner

in v0.2 with ESPAsyncWebserver, i couldnt avoid the way of building pages shown above.
I already use the template function, but this is also not super great.

Maybe i should consider building the WebUI completely with javascript and get all the nice data from api endpoints (json).

This topic might be something for v0.3

in v0.2 with ESPAsyncWebserver, i couldnt avoid the way of building pages shown above. I already use the template function, but this is also not super great. Maybe i should consider building the WebUI completely with javascript and get all the nice data from api endpoints (json). This topic might be something for v0.3
DeltaLima added the
enhancement
label 2025-03-16 03:28:58 +01:00
DeltaLima changed title from Enhancement: Rework Web Page handling, get them as static as possible to [Webserver] Rework Web Page handling, get them as static as possible 2025-03-16 03:33:35 +01:00
DeltaLima added the
v0.3.x
label 2025-03-16 03:38:10 +01:00
Sign in to join this conversation.
No milestone
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: DeltaLima/CanGrow#13
No description provided.