Add skeleton for advanced page

This commit is contained in:
Daniel Öster 2024-08-30 22:07:26 +03:00
parent fe456b62b3
commit 0be1d5ee93
3 changed files with 19 additions and 16 deletions

View file

@ -10,18 +10,19 @@ String advanced_battery_processor(const String& var) {
content += "body { background-color: black; color: white; }"; content += "body { background-color: black; color: white; }";
content += "</style>"; content += "</style>";
content += "<button onclick='goToMainPage()'>Back to main page</button>";
// Start a new block with a specific background color // Start a new block with a specific background color
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>"; content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
content += "<h4 style='color: white;'>SSID: <span id='SSID'></span> <button onclick='editSSID()'>Edit</button></h4>"; content += "No extra information available for this battery type";
content += "</div>"; content += "</div>";
content += "<button onclick='goToMainPage()'>Back to main page</button>";
content += "<script>"; content += "<script>";
content += "function goToMainPage() { window.location.href = '/'; }"; content += "function goToMainPage() { window.location.href = '/'; }";
content += "</script>"; content += "</script>";
return content; return content;
} }
return String(); return String();
} }

View file

@ -10,6 +10,8 @@ String settings_processor(const String& var) {
content += "body { background-color: black; color: white; }"; content += "body { background-color: black; color: white; }";
content += "</style>"; content += "</style>";
content += "<button onclick='goToMainPage()'>Back to main page</button>";
// Start a new block with a specific background color // Start a new block with a specific background color
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>"; content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
@ -201,7 +203,6 @@ String settings_processor(const String& var) {
#endif #endif
content += "</script>"; content += "</script>";
content += "<button onclick='goToMainPage()'>Back to main page</button>";
content += "<script>"; content += "<script>";
content += "function goToMainPage() { window.location.href = '/'; }"; content += "function goToMainPage() { window.location.href = '/'; }";
content += "</script>"; content += "</script>";

View file

@ -11,11 +11,11 @@ AsyncWebServer server(80);
// Measure OTA progress // Measure OTA progress
unsigned long ota_progress_millis = 0; unsigned long ota_progress_millis = 0;
#include "advanced_battery_html.h"
#include "cellmonitor_html.h" #include "cellmonitor_html.h"
#include "events_html.h" #include "events_html.h"
#include "index_html.cpp" #include "index_html.cpp"
#include "settings_html.h" #include "settings_html.h"
#include "advanced_battery_html.h"
enum WifiState { enum WifiState {
INIT, //before connecting first time INIT, //before connecting first time
@ -61,8 +61,9 @@ void init_webserver() {
[](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, settings_processor); }); [](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, settings_processor); });
// Route for going to advanced battery info web page // Route for going to advanced battery info web page
server.on("/advanced", HTTP_GET, server.on("/advanced", HTTP_GET, [](AsyncWebServerRequest* request) {
[](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, advanced_battery_processor); }); request->send_P(200, "text/html", index_html, advanced_battery_processor);
});
// Route for going to cellmonitor web page // Route for going to cellmonitor web page
server.on("/cellmonitor", HTTP_GET, [](AsyncWebServerRequest* request) { server.on("/cellmonitor", HTTP_GET, [](AsyncWebServerRequest* request) {
@ -411,6 +412,14 @@ String processor(const String& var) {
content += "body { background-color: black; color: white; }"; content += "body { background-color: black; color: white; }";
content += "</style>"; content += "</style>";
// Draw buttons
content += "<button onclick='OTA()'>Perform OTA update</button> ";
content += "<button onclick='Settings()'>Change Settings</button> ";
content += "<button onclick='Advanced()'>Advanced Battery Insights</button> ";
content += "<button onclick='Cellmon()'>Cellmonitor</button> ";
content += "<button onclick='Events()'>Events</button> ";
content += "<button onclick='askReboot()'>Reboot Emulator</button>";
// Start a new block with a specific background color // Start a new block with a specific background color
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>"; content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
@ -788,19 +797,11 @@ String processor(const String& var) {
content += "</div>"; content += "</div>";
#endif // defined CHEVYVOLT_CHARGER || defined NISSANLEAF_CHARGER #endif // defined CHEVYVOLT_CHARGER || defined NISSANLEAF_CHARGER
content += "<button onclick='OTA()'>Perform OTA update</button>";
content += " ";
content += "<button onclick='Settings()'>Change Settings</button>";
content += " ";
content += "<button onclick='Cellmon()'>Cellmonitor</button>";
content += " ";
content += "<button onclick='Events()'>Events</button>";
content += " ";
content += "<button onclick='askReboot()'>Reboot Emulator</button>";
content += "<script>"; content += "<script>";
content += "function OTA() { window.location.href = '/update'; }"; content += "function OTA() { window.location.href = '/update'; }";
content += "function Cellmon() { window.location.href = '/cellmonitor'; }"; content += "function Cellmon() { window.location.href = '/cellmonitor'; }";
content += "function Settings() { window.location.href = '/settings'; }"; content += "function Settings() { window.location.href = '/settings'; }";
content += "function Advanced() { window.location.href = '/advanced'; }";
content += "function Events() { window.location.href = '/events'; }"; content += "function Events() { window.location.href = '/events'; }";
content += content +=
"function askReboot() { if (window.confirm('Are you sure you want to reboot the emulator? NOTE: If " "function askReboot() { if (window.confirm('Are you sure you want to reboot the emulator? NOTE: If "