mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-27 20:48:29 +00:00
Update dash UI
This commit is contained in:
1 parent
0f0cf7a5db
commit
e75afcba42
3 files changed
+1057
-1052
No files matched your search
+1047
-1044
File diff suppressed because it is too large.
Load diff
@@ -44,6 +44,7 @@ const Footer = props => html`
|
|||||||
|
|
||||||
|
|
||||||
const Hero = props => html`
|
const Hero = props => html`
|
||||||
|
<div class="section">
|
||||||
<div style="margin-top: 1em; background: #eee; padding: 1em; border-radius: 0.5em; color: #777; ">
|
<div style="margin-top: 1em; background: #eee; padding: 1em; border-radius: 0.5em; color: #777; ">
|
||||||
<h1 style="margin: 0.2em 0;">Interactive Device Dashboard</h1>
|
<h1 style="margin: 0.2em 0;">Interactive Device Dashboard</h1>
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ const Hero = props => html`
|
|||||||
are sent over Websocket at URI <code>curl localhost:8000/api/watch</code>
|
are sent over Websocket at URI <code>curl localhost:8000/api/watch</code>
|
||||||
as JSON strings <code>{"name": "..", "data": ...}</code>
|
as JSON strings <code>{"name": "..", "data": ...}</code>
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
const Login = function(props) {
|
const Login = function(props) {
|
||||||
@@ -130,7 +131,7 @@ const Configuration = function(props) {
|
|||||||
const updatesub = ev => update('sub', sub);
|
const updatesub = ev => update('sub', sub);
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div style="margin: 0 0.3em;">
|
<div class="section">
|
||||||
<h3 style="background: #c03434; color: #fff; padding: 0.4em;">
|
<h3 style="background: #c03434; color: #fff; padding: 0.4em;">
|
||||||
Device Configuration</h3>
|
Device Configuration</h3>
|
||||||
<div style="margin: 0.5em 0; display: flex;">
|
<div style="margin: 0.5em 0; display: flex;">
|
||||||
@@ -194,7 +195,7 @@ const Messages = function(props) {
|
|||||||
}).then(r => setTxt(''));
|
}).then(r => setTxt(''));
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<div style="margin: 0 0.3em;">
|
<div class="section">
|
||||||
<h3 style="background: #30c040; color: #fff; padding: 0.4em;">MQTT messages</h3>
|
<h3 style="background: #30c040; color: #fff; padding: 0.4em;">MQTT messages</h3>
|
||||||
<div>
|
<div>
|
||||||
MQTT server status: <b>${cfg.connected ? 'connected' : 'diconnected'}</b>
|
MQTT server status: <b>${cfg.connected ? 'connected' : 'diconnected'}</b>
|
||||||
@@ -298,7 +299,7 @@ const Chart = function(props) {
|
|||||||
let xmax = 0, missing = MaxMetricsDataPoints - data.length;
|
let xmax = 0, missing = MaxMetricsDataPoints - data.length;
|
||||||
if (missing > 0) xmax = Math.round(Date.now() / 1000) + missing;
|
if (missing > 0) xmax = Math.round(Date.now() / 1000) + missing;
|
||||||
return html`
|
return html`
|
||||||
<div style="margin: 0 0.3em;">
|
<div class="section">
|
||||||
<h3 style="background: #ec3; color: #fff; padding: 0.4em;">Data Chart</h3>
|
<h3 style="background: #ec3; color: #fff; padding: 0.4em;">Data Chart</h3>
|
||||||
<div style="overflow: auto; padding: 0.5em;" class="">
|
<div style="overflow: auto; padding: 0.5em;" class="">
|
||||||
<${SVG} height=240 width=600 ymin=0 ymax=20 xmax=${xmax} data=${data} />
|
<${SVG} height=240 width=600 ymin=0 ymax=20 xmax=${xmax} data=${data} />
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ a, a:visited, a:active { color: #55f; }
|
|||||||
.rounded { border-radius: 0.5em; }
|
.rounded { border-radius: 0.5em; }
|
||||||
.nowrap { white-space: nowrap; }
|
.nowrap { white-space: nowrap; }
|
||||||
.msg { background: #def; border-left: 5px solid #59d; padding: 0.5em; font-size: 90%; margin: 1em 0; }
|
.msg { background: #def; border-left: 5px solid #59d; padding: 0.5em; font-size: 90%; margin: 1em 0; }
|
||||||
|
.section { margin: 0 1em; }
|
||||||
|
.topic { background: #fea; padding: 0.2em 1em; border-radius: 0.4em; }
|
||||||
|
.data { background: #aef; padding: 0.2em 1em; border-radius: 0.4em; }
|
||||||
|
|
||||||
|
/* Grid */
|
||||||
.row { display: flex; flex-wrap: wrap; }
|
.row { display: flex; flex-wrap: wrap; }
|
||||||
.col { margin: 0; padding: 0; overflow: auto; }
|
.col { margin: 0; padding: 0; overflow: auto; }
|
||||||
.col-12 { width: 100%; }
|
.col-12 { width: 100%; }
|
||||||
@@ -32,9 +37,5 @@ a, a:visited, a:active { color: #55f; }
|
|||||||
.col-3 { width: 25%; }
|
.col-3 { width: 25%; }
|
||||||
.col-2 { width: 16.66%; }
|
.col-2 { width: 16.66%; }
|
||||||
.col-1 { width: 8.33%; }
|
.col-1 { width: 8.33%; }
|
||||||
|
|
||||||
.topic { background: #fea; padding: 0.2em 1em; border-radius: 0.4em; }
|
|
||||||
.data { background: #aef; padding: 0.2em 1em; border-radius: 0.4em; }
|
|
||||||
|
|
||||||
@media (min-width: 1310px) { .container { margin: auto; width: 1270px; } }
|
@media (min-width: 1310px) { .container { margin: auto; width: 1270px; } }
|
||||||
@media (max-width: 920px) { .row .col { width: 100%; } }
|
@media (max-width: 920px) { .row .col { width: 100%; } }
|
||||||
Reference in new issue
Block a user