mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Update dash
This commit is contained in:
@@ -20,9 +20,6 @@ file_data.c: dashboard.html
|
||||
node $(TOP)/resources/pack.js out.html:dashboard.html:gzip > file_data.c
|
||||
@echo "On-flash size: `grep -oE '[0-9]+' file_data.c | wc -l`"
|
||||
|
||||
purge:
|
||||
curl -s https://purge.jsdelivr.net/gh/cesanta/mongoose@master/resources/dashboard.js
|
||||
|
||||
# For development: rebuild and restart if any of the sources change
|
||||
watch:
|
||||
node $(TOP)/resources/watch.js -w main.c -w dashboard.c -w $(TOP)/mongoose.h -w dashboard.html -- make
|
||||
|
||||
@@ -209,7 +209,7 @@ void mg_dash_poll(struct mg_mgr *mgr) {
|
||||
mg_dash_send_change(mgr, &set_metrics);
|
||||
}
|
||||
if (mg_timer_expired(&timer2, 120, mg_now()) && s_graph2_report) {
|
||||
mg_dash_send_change(mgr, &set_graph2);
|
||||
//mg_dash_send_change(mgr, &set_graph2);
|
||||
}
|
||||
if (s_action2 == true && s_action2_timeout < mg_now()) {
|
||||
s_action2 = false;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<title>My Dashboard</title>
|
||||
|
||||
<!-- Mongoose device dashboard -->
|
||||
<script src="https://cdn.jsdelivr.net/gh/cesanta/mongoose@master/resources/dashboard.js"></script>
|
||||
<script src="https://mongoose.ws/resources/dashboard.js?2"></script>
|
||||
<script>
|
||||
Dashboard.init({
|
||||
debug: true,
|
||||
@@ -101,8 +101,9 @@
|
||||
ev.preventDefault();
|
||||
const username = (document.getElementById('login-username')?.value || '').trim();
|
||||
const password = passwordEl.value || '';
|
||||
passwordEl.value = '';
|
||||
Dashboard.login({username, password}).then(r => showLogin(false));
|
||||
console.log('LOGIN', {username, password});
|
||||
passwordEl.value = '';
|
||||
};
|
||||
|
||||
Dashboard.on('logout', function() { showLogin(true); });
|
||||
@@ -374,7 +375,7 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
</svg>
|
||||
<span>${__status.username || 'admin'}</span>
|
||||
<svg viewBox="0 0 24 24"
|
||||
onclick="Dashboard.logout()"
|
||||
onclick="Dashboard.logout().then(() => location.reload())"
|
||||
style="cursor: pointer;"
|
||||
class="nav-icon" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
||||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||||
@@ -614,10 +615,16 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="field-label">Upload new firmware</div>
|
||||
<label class="btn btn-primary">
|
||||
<label class="btn btn-primary">
|
||||
<svg viewBox="0 0 24 24" class="nav-icon" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 3v12" />
|
||||
<path d="m7 8 5-5 5 5" />
|
||||
<path d="M5 21h14" />
|
||||
</svg>
|
||||
Select .bin file
|
||||
<input type="file" accept=".bin" hidden>
|
||||
<input type="file" accept=".bin" hidden data-upload="1" />
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -710,14 +717,14 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
</div>
|
||||
<div class="file-size">${f.size}</div>
|
||||
<div class="file-actions">
|
||||
<a href="files/${encodeURIComponent(f.name)}" target="_blank" class="btn btn-secondary">
|
||||
<a href="fs/${encodeURIComponent(f.name)}" target="_blank" class="btn btn-secondary">
|
||||
<svg viewBox="0 0 24 24" class="nav-icon" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M12 3v12" />
|
||||
<path d="m7 10 5 5 5-5" />
|
||||
<path d="M5 21h14" />
|
||||
</svg>
|
||||
</a>
|
||||
<button onclick="fetch('files/${encodeURIComponent(f.name)}?action=delete'); return false;" class="btn btn-secondary">
|
||||
<button onclick="fetch('fs/${encodeURIComponent(f.name)}', {method: 'DELETE'}); return false;" class="btn btn-secondary">
|
||||
<svg viewBox="0 0 24 24" class="nav-icon" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M3 6h18" />
|
||||
<path d="M8 6V4h8v2" />
|
||||
|
||||
@@ -20,9 +20,6 @@ file_data.c: dashboard.html
|
||||
node $(TOP)/resources/pack.js out.html:dashboard.html:gzip > file_data.c
|
||||
@echo "On-flash size: `grep -oE '[0-9]+' file_data.c | wc -l`"
|
||||
|
||||
purge:
|
||||
curl -s https://purge.jsdelivr.net/gh/cesanta/mongoose@master/resources/dashboard.js
|
||||
|
||||
# For development: rebuild and restart if any of the sources change
|
||||
watch:
|
||||
node $(TOP)/resources/watch.js -w main.c -w dashboard.c -w $(TOP)/mongoose.h -w dashboard.html -- make
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>LED Control Dashboard</title>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/gh/cesanta/mongoose@master/resources/dashboard.js"></script>
|
||||
<script src="https://mongoose.ws/resources/dashboard.js"></script>
|
||||
<script>
|
||||
Dashboard.init({
|
||||
debug: true,
|
||||
|
||||
Reference in New Issue
Block a user