Refactor device-dashboard

This commit is contained in:
Sergio R. Caprile committed 2023-05-26 20:45:08 -03:00
1 parent 49a9bb5a8b
commit 58606e1702
29 files changed
+5123 -4476

No files matched your search

-2
View File
@@ -8,8 +8,6 @@ CFLAGS = -W -Wall -Wextra -g -I. # Build options
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
CFLAGS_MONGOOSE +=
FILES_TO_EMBED ?= $(wildcard web_root/*)
ifeq ($(OS),Windows_NT) # Windows settings. Assume MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feprog.exe
PROG ?= example.exe # Use .exe suffix for the binary
PACK = pack.exe # Packing executable
+5 -8
View File
@@ -5,13 +5,10 @@ into an embedded device and provide a complete device dashboard with the
following features:
- Authentication: login-protected dashboard
- Multiple logins with different permissions (admin and user)
- Web UI is fully embedded into the server/firmware binary, and does not
need a filesystem to serve it. UI is resilient to FS problems
- Administrators can change server settings
- Multiple logins (with possibly different permissions)
- The Web UI can be fully embedded into the firmware binary, then not
needing a filesystem to serve it; so being resilient to FS problems
- All changes are propagated to all connected clients
- The device is connected to the external MQTT server
- Logged in clients can send/receive messages via MQTT
## Screenshots
@@ -21,9 +18,9 @@ This is a login screen that prompts for user/password
## Main dashboard
The main dashboard page shows the interactive MQTT console
The main dashboard page shows the interactive console
![](screenshots/dashboard.webp)
See a detailed tutorial at https://mongoose.ws/tutorials/device-dashboard/
<!-- See a detailed tutorial at https://mongoose.ws/tutorials/device-dashboard/ -->
+1
View File
@@ -1,6 +1,7 @@
// Copyright (c) 2020-2023 Cesanta Software Limited
// All rights reserved
#include "mongoose.h"
#include "net.h"
static int s_sig_num;
+1
View File
@@ -237,6 +237,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
struct mg_http_serve_opts opts;
memset(&opts, 0, sizeof(opts));
#if MG_ENABLE_PACKED_FS
opts.root_dir = "/web_root";
opts.fs = &mg_fs_packed;
#else
opts.root_dir = "web_root";
File diff suppressed because it is too large. Load diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 16 KiB

+1 -1
View File
@@ -211,7 +211,7 @@ function Settings({}) {
toggle button, dropdown select, input field with left and right
addons. Device settings are received by calling
/api/settings/get API call, which returns settings JSON object.
Clicking on a save button calls /api/settings/set
Clicking on the save button calls /api/settings/set
API call" />
<//>