mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-18 10:59:45 +00:00
Dash levels
This commit is contained in:
1 parent
5c3ffdb570
commit
1536b6a38b
5 files changed
+254
-51
No files matched your search
@@ -100,7 +100,7 @@ static struct mg_field fields_settings[] = {
|
||||
};
|
||||
|
||||
static struct mg_field_set set_settings = {
|
||||
"settings", fields_settings, read_settings, write_settings, 0, 0, NULL,
|
||||
"settings", fields_settings, read_settings, write_settings, 3, 7, NULL,
|
||||
};
|
||||
|
||||
#define NUM_POINTS_GRAPH1 7 // How many graph1 data points to send
|
||||
@@ -126,8 +126,8 @@ void read_graph1(void) {
|
||||
for (i = 0; i < NUM_POINTS_GRAPH1; i++) {
|
||||
struct point p;
|
||||
p.x = (uint16_t) i;
|
||||
p.y1 = 85 - (uint16_t) ((49 * i) / NUM_POINTS_GRAPH1) + (rand() % 9);
|
||||
p.y2 = 20 + (uint16_t) ((69 * i) / NUM_POINTS_GRAPH1) + (rand() % 5);
|
||||
p.y1 = (uint16_t) (85 - ((49 * i) / NUM_POINTS_GRAPH1) + (rand() % 9));
|
||||
p.y2 = (uint16_t) (20 + ((69 * i) / NUM_POINTS_GRAPH1) + (rand() % 5));
|
||||
len += mg_snprintf(s_graph1_data + len, sizeof(s_graph1_data) - len,
|
||||
"%s[%hu,%hu,%hu]", i > 0 ? "," : "", p.x, p.y1, p.y2);
|
||||
}
|
||||
@@ -156,8 +156,8 @@ void read_graph2(void) {
|
||||
for (i = 0; i < NUM_POINTS_GRAPH2; i++) {
|
||||
uint16_t x = (uint16_t) (i * 7 + t);
|
||||
uint16_t y = (uint16_t) (i * 3 - t / 2);
|
||||
uint8_t a = (x ^ (x >> 3)) & 255;
|
||||
uint8_t b = (y ^ (y >> 4)) & 255;
|
||||
uint8_t a = (uint8_t) (x ^ (x >> 3)) & 255;
|
||||
uint8_t b = (uint8_t) (y ^ (y >> 4)) & 255;
|
||||
int v =
|
||||
70 + ((a < 128 ? a : 255 - a) >> 1) + ((b < 128 ? b : 255 - b) >> 2);
|
||||
len += mg_snprintf(s_graph2_data + len, sizeof(s_graph2_data) - len,
|
||||
|
||||
@@ -327,7 +327,7 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
</svg>
|
||||
Overview
|
||||
</a>
|
||||
<a href="#settings" id="tab-settings" class="nav-link" role="tab" aria-controls="settings" aria-selected="false" tabindex="-1">
|
||||
<a href="#settings" id="tab-settings" class="nav-link ${__status.userlevel > 0 && __status.userlevel < 7 ? 'hidden' : ''}" role="tab" aria-controls="settings" aria-selected="false" tabindex="-1">
|
||||
<svg viewBox="0 0 24 24" class="nav-icon" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
<path d="M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06A1.7 1.7 0 0 0 15 19.4a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 0-.4 1.1V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-.4-1.1 1.7 1.7 0 0 0-1-.6 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-.6-1 1.7 1.7 0 0 0-1.1-.4H2.8a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.1-.4 1.7 1.7 0 0 0 .6-1 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.7 1.7 0 0 0 9 4.6c.38-.16.72-.4 1-.7.26-.3.4-.69.4-1.1V2.8a2 2 0 1 1 4 0v.1c0 .41.14.8.4 1.1.28.3.62.54 1 .7a1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.7 1.7 0 0 0 19.4 9c.16.38.4.72.7 1 .3.26.69.4 1.1.4h.1a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.1.4 1.7 1.7 0 0 0-.7 1z" />
|
||||
@@ -363,7 +363,7 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
||||
<circle cx="12" cy="7" r="4" />
|
||||
</svg>
|
||||
<span>${__status.username || 'admin'}</span>
|
||||
<span>${__status.userlevel == 3 ? 'user' : 'admin'}</span>
|
||||
<svg viewBox="0 0 24 24"
|
||||
onclick="Dashboard.logout().then(() => location.reload())"
|
||||
style="cursor: pointer;"
|
||||
|
||||
Reference in new issue
Block a user