Add G-Box manual page and header device image
This commit is contained in:
parent
30a3460ab0
commit
839093d50b
|
|
@ -549,6 +549,59 @@ def ip_addresses_for_iface(iface):
|
||||||
return {"ipv4": ipv4, "ipv6": ipv6}
|
return {"ipv4": ipv4, "ipv6": ipv6}
|
||||||
|
|
||||||
|
|
||||||
|
def iface_exists(iface):
|
||||||
|
return os.path.exists(f"/sys/class/net/{iface}")
|
||||||
|
|
||||||
|
|
||||||
|
def read_sysfs_value(path):
|
||||||
|
return read_text(path).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def mac_address_for_iface(iface):
|
||||||
|
if not iface_exists(iface):
|
||||||
|
return ""
|
||||||
|
return read_sysfs_value(f"/sys/class/net/{iface}/address")
|
||||||
|
|
||||||
|
|
||||||
|
def carrier_state_for_iface(iface):
|
||||||
|
if not iface_exists(iface):
|
||||||
|
return None
|
||||||
|
raw = read_sysfs_value(f"/sys/class/net/{iface}/carrier")
|
||||||
|
if raw == "1":
|
||||||
|
return True
|
||||||
|
if raw == "0":
|
||||||
|
return False
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def operstate_for_iface(iface):
|
||||||
|
if not iface_exists(iface):
|
||||||
|
return ""
|
||||||
|
return read_sysfs_value(f"/sys/class/net/{iface}/operstate")
|
||||||
|
|
||||||
|
|
||||||
|
def link_speed_for_iface(iface):
|
||||||
|
if not iface_exists(iface):
|
||||||
|
return ""
|
||||||
|
raw = read_sysfs_value(f"/sys/class/net/{iface}/speed")
|
||||||
|
if raw.isdigit():
|
||||||
|
speed = int(raw)
|
||||||
|
if speed >= 1000 and speed % 1000 == 0:
|
||||||
|
return f"{speed // 1000} Gbps"
|
||||||
|
if speed > 0:
|
||||||
|
return f"{speed} Mbps"
|
||||||
|
if shutil.which("ethtool"):
|
||||||
|
rc, stdout, _ = run(["ethtool", iface], timeout=8)
|
||||||
|
if rc == 0:
|
||||||
|
for line in stdout.splitlines():
|
||||||
|
text = line.strip()
|
||||||
|
if text.startswith("Speed:"):
|
||||||
|
value = text.split(":", 1)[1].strip()
|
||||||
|
if value and value.lower() != "unknown!":
|
||||||
|
return value.replace("Mb/s", " Mbps").replace("Gb/s", " Gbps")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def gateway_for_iface(iface):
|
def gateway_for_iface(iface):
|
||||||
rc, stdout, _ = run(["ip", "route", "show", "default", "dev", iface], timeout=8)
|
rc, stdout, _ = run(["ip", "route", "show", "default", "dev", iface], timeout=8)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
|
|
@ -561,6 +614,19 @@ def gateway_for_iface(iface):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def default_route_iface():
|
||||||
|
rc, stdout, _ = run(["ip", "route", "show", "default"], timeout=8)
|
||||||
|
if rc != 0:
|
||||||
|
return ""
|
||||||
|
for raw in stdout.splitlines():
|
||||||
|
parts = raw.split()
|
||||||
|
if "dev" in parts:
|
||||||
|
index = parts.index("dev")
|
||||||
|
if index + 1 < len(parts):
|
||||||
|
return parts[index + 1]
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def dns_servers_for_iface(iface):
|
def dns_servers_for_iface(iface):
|
||||||
if nmcli_available():
|
if nmcli_available():
|
||||||
rc, stdout, _ = run(["nmcli", "-g", "IP4.DNS", "dev", "show", iface], timeout=8)
|
rc, stdout, _ = run(["nmcli", "-g", "IP4.DNS", "dev", "show", iface], timeout=8)
|
||||||
|
|
@ -629,16 +695,72 @@ def get_network_activity(iface):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def summarize_interface(iface, kind="ethernet"):
|
||||||
|
present = iface_exists(iface)
|
||||||
|
addresses = ip_addresses_for_iface(iface) if present else {"ipv4": [], "ipv6": []}
|
||||||
|
gateway = gateway_for_iface(iface) if present else ""
|
||||||
|
dns = dns_servers_for_iface(iface) if present else []
|
||||||
|
activity = get_network_activity(iface) if present else {"rx_bytes_per_sec": None, "tx_bytes_per_sec": None}
|
||||||
|
nm_state = nmcli_device_state(iface) if present and nmcli_available() else {}
|
||||||
|
mac_address = mac_address_for_iface(iface) if present else ""
|
||||||
|
oper_state = operstate_for_iface(iface) if present else ""
|
||||||
|
carrier = carrier_state_for_iface(iface) if kind == "ethernet" and present else None
|
||||||
|
link_speed = link_speed_for_iface(iface) if kind == "ethernet" and present else ""
|
||||||
|
default_iface = default_route_iface()
|
||||||
|
is_default_route = bool(present and iface == default_iface)
|
||||||
|
|
||||||
|
if not present:
|
||||||
|
status = "not available"
|
||||||
|
status_text = "Ethernet interface not available" if kind == "ethernet" else "Wi-Fi interface not available"
|
||||||
|
elif kind == "ethernet":
|
||||||
|
if carrier is False:
|
||||||
|
status = "disconnected"
|
||||||
|
status_text = "Ethernet cable not connected"
|
||||||
|
elif nm_state.get("state") == "connected" or gateway or addresses["ipv4"] or addresses["ipv6"]:
|
||||||
|
status = "connected"
|
||||||
|
status_text = "Connected"
|
||||||
|
else:
|
||||||
|
status = "disconnected"
|
||||||
|
status_text = "Disconnected"
|
||||||
|
else:
|
||||||
|
if nm_state.get("state") == "connected" or gateway or addresses["ipv4"] or addresses["ipv6"]:
|
||||||
|
status = "connected"
|
||||||
|
status_text = "Connected"
|
||||||
|
elif nm_state.get("state"):
|
||||||
|
status = nm_state.get("state")
|
||||||
|
status_text = nm_state.get("state").replace("-", " ").capitalize()
|
||||||
|
else:
|
||||||
|
status = "disconnected"
|
||||||
|
status_text = "Disconnected"
|
||||||
|
|
||||||
|
return {
|
||||||
|
"interface": iface,
|
||||||
|
"kind": kind,
|
||||||
|
"present": present,
|
||||||
|
"status": status,
|
||||||
|
"status_text": status_text,
|
||||||
|
"connected": status == "connected",
|
||||||
|
"connection": nm_state.get("connection", ""),
|
||||||
|
"state": nm_state.get("state", "") or oper_state or status,
|
||||||
|
"addresses": addresses,
|
||||||
|
"gateway": gateway,
|
||||||
|
"dns": dns,
|
||||||
|
"activity": activity,
|
||||||
|
"mac_address": mac_address,
|
||||||
|
"link_speed": link_speed,
|
||||||
|
"carrier": carrier,
|
||||||
|
"is_default_route": is_default_route,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_network_summary():
|
def get_network_summary():
|
||||||
iface = get_primary_interface()
|
iface = get_primary_interface()
|
||||||
profile = read_wifi_profile_state()
|
profile = read_wifi_profile_state()
|
||||||
script_status = parse_wifi_status_script()
|
script_status = parse_wifi_status_script()
|
||||||
nm_state = nmcli_device_state(iface)
|
|
||||||
addresses = ip_addresses_for_iface(iface)
|
|
||||||
gateway = gateway_for_iface(iface)
|
|
||||||
dns = dns_servers_for_iface(iface)
|
|
||||||
current_ssid = get_active_ssid(iface)
|
current_ssid = get_active_ssid(iface)
|
||||||
activity = get_network_activity(iface)
|
wifi_summary = summarize_interface(iface, "wifi")
|
||||||
|
wifi_summary["ssid"] = current_ssid or profile["ssid"]
|
||||||
|
eth_summary = summarize_interface("eth0", "ethernet")
|
||||||
try:
|
try:
|
||||||
ap_status = public_ap_status()
|
ap_status = public_ap_status()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
@ -656,15 +778,20 @@ def get_network_summary():
|
||||||
"desired_profile": profile,
|
"desired_profile": profile,
|
||||||
"ap_status": ap_status,
|
"ap_status": ap_status,
|
||||||
"wifi": {
|
"wifi": {
|
||||||
"connected": nm_state.get("state") == "connected",
|
"connected": wifi_summary["connected"],
|
||||||
"state": nm_state.get("state") or script_status.get("NM_STATE", "unknown"),
|
"state": wifi_summary["state"] or script_status.get("NM_STATE", "unknown"),
|
||||||
"connection": nm_state.get("connection") or script_status.get("NM_CONNECTION", ""),
|
"connection": wifi_summary["connection"] or script_status.get("NM_CONNECTION", ""),
|
||||||
"ssid": current_ssid or profile["ssid"],
|
"ssid": current_ssid or profile["ssid"],
|
||||||
},
|
},
|
||||||
"addresses": addresses,
|
"addresses": wifi_summary["addresses"],
|
||||||
"gateway": gateway,
|
"gateway": wifi_summary["gateway"],
|
||||||
"dns": dns,
|
"dns": wifi_summary["dns"],
|
||||||
"activity": activity,
|
"activity": wifi_summary["activity"],
|
||||||
|
"interfaces": {
|
||||||
|
"wifi": wifi_summary,
|
||||||
|
"ethernet": eth_summary,
|
||||||
|
},
|
||||||
|
"active_uplink": "eth0" if eth_summary["is_default_route"] else iface if wifi_summary["is_default_route"] else "",
|
||||||
"script_status": script_status,
|
"script_status": script_status,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1042,6 +1169,13 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
if parsed.path == "/logo.png":
|
if parsed.path == "/logo.png":
|
||||||
self.send_file(os.path.join(PUBLIC_DIR, "logo.png"), "image/png")
|
self.send_file(os.path.join(PUBLIC_DIR, "logo.png"), "image/png")
|
||||||
return
|
return
|
||||||
|
if parsed.path == "/g-box.png":
|
||||||
|
gbox_path = os.path.join(PUBLIC_DIR, "g-box.png")
|
||||||
|
if os.path.exists(gbox_path):
|
||||||
|
self.send_file(gbox_path, "image/png")
|
||||||
|
else:
|
||||||
|
self.send_file(os.path.join(PUBLIC_DIR, "logo.png"), "image/png")
|
||||||
|
return
|
||||||
if parsed.path == "/favicon.png":
|
if parsed.path == "/favicon.png":
|
||||||
self.send_file(os.path.join(PUBLIC_DIR, "favicon.png"), "image/png")
|
self.send_file(os.path.join(PUBLIC_DIR, "favicon.png"), "image/png")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,29 @@ body{
|
||||||
}
|
}
|
||||||
.brand{display:flex;align-items:center;gap:16px;min-width:0}
|
.brand{display:flex;align-items:center;gap:16px;min-width:0}
|
||||||
.brandCopy{display:flex;flex-direction:column;justify-content:center;gap:4px;min-width:0}
|
.brandCopy{display:flex;flex-direction:column;justify-content:center;gap:4px;min-width:0}
|
||||||
.brandLogo{
|
.brandDevice{
|
||||||
width:68px;height:68px;object-fit:contain;display:block;flex:0 0 auto;
|
width:min(26vw, 280px);
|
||||||
border-radius:18px;background:rgba(255,255,255,.9);border:1px solid rgba(215,224,219,.9);padding:7px;
|
max-height:190px;
|
||||||
box-shadow:0 10px 24px rgba(16,24,20,.06);
|
object-fit:contain;
|
||||||
|
display:block;
|
||||||
|
flex:0 0 auto;
|
||||||
|
filter:drop-shadow(0 12px 20px rgba(16,24,20,.12));
|
||||||
}
|
}
|
||||||
.eyebrow{font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--accent);font-weight:600}
|
.eyebrow{font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--accent);font-weight:600}
|
||||||
h1{margin:0;font-size:34px;line-height:1.02;font-weight:650;letter-spacing:-.03em}
|
h1{margin:0;font-size:34px;line-height:1.02;font-weight:650;letter-spacing:-.03em}
|
||||||
.sub{margin:0;color:var(--muted);font-weight:300}
|
.sub{margin:0;color:var(--muted);font-weight:300}
|
||||||
.osLabel{font-size:14px;color:var(--ink);font-weight:400}
|
.osLabel,.brandSupport{font-size:14px;color:var(--ink);font-weight:400}
|
||||||
|
.capabilityBadge{
|
||||||
|
display:inline-flex;
|
||||||
|
align-items:center;
|
||||||
|
align-self:flex-start;
|
||||||
|
border-radius:999px;
|
||||||
|
padding:7px 12px;
|
||||||
|
background:rgba(14,122,83,.10);
|
||||||
|
color:var(--accent);
|
||||||
|
font-size:12px;
|
||||||
|
font-weight:700;
|
||||||
|
}
|
||||||
.identityPanel{
|
.identityPanel{
|
||||||
display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:14px 16px;min-width:300px;
|
display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;padding:14px 16px;min-width:300px;
|
||||||
}
|
}
|
||||||
|
|
@ -152,9 +166,90 @@ h1{margin:0;font-size:34px;line-height:1.02;font-weight:650;letter-spacing:-.03e
|
||||||
}
|
}
|
||||||
.displayHero.is-connected,.apHero.is-enabled{background:rgba(14,122,83,.08)}
|
.displayHero.is-connected,.apHero.is-enabled{background:rgba(14,122,83,.08)}
|
||||||
.displayHero.is-empty,.apHero.is-disabled{background:#f7f8f7}
|
.displayHero.is-empty,.apHero.is-disabled{background:#f7f8f7}
|
||||||
|
.apExplanation{
|
||||||
|
margin-top:14px;
|
||||||
|
padding:14px 16px;
|
||||||
|
border:1px solid var(--line);
|
||||||
|
border-radius:14px;
|
||||||
|
background:#fbfcfb;
|
||||||
|
}
|
||||||
|
.apExplanation p{
|
||||||
|
margin:8px 0 0;
|
||||||
|
color:var(--muted);
|
||||||
|
font-size:13px;
|
||||||
|
line-height:1.55;
|
||||||
|
}
|
||||||
.displayHeroLabel{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:6px}
|
.displayHeroLabel{font-size:12px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);margin-bottom:6px}
|
||||||
.displayHeroText{font-size:20px;font-weight:700}
|
.displayHeroText{font-size:20px;font-weight:700}
|
||||||
.displayHeroMeta{display:flex;gap:10px;flex-wrap:wrap;color:var(--muted);font-size:13px}
|
.displayHeroMeta{display:flex;gap:10px;flex-wrap:wrap;color:var(--muted);font-size:13px}
|
||||||
|
.networkOverviewGrid{
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:repeat(2,minmax(0,1fr));
|
||||||
|
gap:16px;
|
||||||
|
margin-top:16px;
|
||||||
|
}
|
||||||
|
.networkInterfaceBlock{
|
||||||
|
border:1px solid var(--line);
|
||||||
|
border-radius:14px;
|
||||||
|
background:#fbfcfb;
|
||||||
|
padding:14px;
|
||||||
|
}
|
||||||
|
.networkInterfaceHead{
|
||||||
|
display:flex;
|
||||||
|
justify-content:space-between;
|
||||||
|
gap:10px;
|
||||||
|
align-items:flex-start;
|
||||||
|
flex-wrap:wrap;
|
||||||
|
}
|
||||||
|
.networkInterfaceHead h3{
|
||||||
|
margin:0 0 8px;
|
||||||
|
font-size:18px;
|
||||||
|
}
|
||||||
|
.gboxHero{
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:minmax(220px, 340px) minmax(0,1fr);
|
||||||
|
gap:24px;
|
||||||
|
align-items:center;
|
||||||
|
}
|
||||||
|
.gboxHeroImage{
|
||||||
|
width:100%;
|
||||||
|
max-height:320px;
|
||||||
|
object-fit:contain;
|
||||||
|
}
|
||||||
|
.gboxHeroCopy{
|
||||||
|
display:grid;
|
||||||
|
gap:10px;
|
||||||
|
}
|
||||||
|
.specTable{
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:180px minmax(0,1fr);
|
||||||
|
gap:10px 14px;
|
||||||
|
margin-top:16px;
|
||||||
|
font-size:14px;
|
||||||
|
}
|
||||||
|
.specTable .key{
|
||||||
|
color:var(--muted);
|
||||||
|
font-weight:600;
|
||||||
|
}
|
||||||
|
.manualGrid{
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns:repeat(2,minmax(0,1fr));
|
||||||
|
gap:14px;
|
||||||
|
margin-top:16px;
|
||||||
|
}
|
||||||
|
.manualGroup{
|
||||||
|
border:1px solid var(--line);
|
||||||
|
border-radius:14px;
|
||||||
|
padding:14px;
|
||||||
|
background:#fbfcfb;
|
||||||
|
}
|
||||||
|
.manualSteps{
|
||||||
|
margin:10px 0 0;
|
||||||
|
padding-left:20px;
|
||||||
|
color:var(--ink);
|
||||||
|
}
|
||||||
|
.manualSteps li + li{margin-top:8px}
|
||||||
|
.manualNotes{margin-top:10px}
|
||||||
.connectorList{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
|
.connectorList{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:12px}
|
||||||
.connectorCard{border:1px solid var(--line);border-radius:14px;padding:14px;background:#fbfcfb}
|
.connectorCard{border:1px solid var(--line);border-radius:14px;padding:14px;background:#fbfcfb}
|
||||||
.connectorHead{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;margin-bottom:12px}
|
.connectorHead{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;margin-bottom:12px}
|
||||||
|
|
@ -202,6 +297,11 @@ h1{margin:0;font-size:34px;line-height:1.02;font-weight:650;letter-spacing:-.03e
|
||||||
.banner.success{background:rgba(14,122,83,.10);color:var(--accent)}
|
.banner.success{background:rgba(14,122,83,.10);color:var(--accent)}
|
||||||
.banner.error{background:rgba(185,52,52,.10);color:var(--error)}
|
.banner.error{background:rgba(185,52,52,.10);color:var(--error)}
|
||||||
.scanList{display:grid;gap:10px}
|
.scanList{display:grid;gap:10px}
|
||||||
|
.scanCollapsedHint{
|
||||||
|
margin-top:14px;
|
||||||
|
color:var(--muted);
|
||||||
|
font-size:13px;
|
||||||
|
}
|
||||||
.scanRow{
|
.scanRow{
|
||||||
display:flex;justify-content:space-between;gap:12px;align-items:center;
|
display:flex;justify-content:space-between;gap:12px;align-items:center;
|
||||||
border:1px solid var(--line);border-radius:12px;background:#fbfcfb;padding:12px 14px;
|
border:1px solid var(--line);border-radius:12px;background:#fbfcfb;padding:12px 14px;
|
||||||
|
|
@ -241,12 +341,15 @@ h1{margin:0;font-size:34px;line-height:1.02;font-weight:650;letter-spacing:-.03e
|
||||||
@media (max-width:940px){
|
@media (max-width:940px){
|
||||||
.hero{grid-template-columns:1fr}
|
.hero{grid-template-columns:1fr}
|
||||||
.identityPanel{min-width:0}
|
.identityPanel{min-width:0}
|
||||||
|
.gboxHero{grid-template-columns:1fr}
|
||||||
}
|
}
|
||||||
@media (max-width:720px){
|
@media (max-width:720px){
|
||||||
.summaryGrid{grid-template-columns:1fr}
|
|
||||||
.meta{grid-template-columns:1fr 1fr}
|
.meta{grid-template-columns:1fr 1fr}
|
||||||
.splitMeta{grid-template-columns:1fr}
|
.splitMeta{grid-template-columns:1fr}
|
||||||
.brandLogo{width:58px;height:58px}
|
.networkOverviewGrid{grid-template-columns:1fr}
|
||||||
|
.manualGrid{grid-template-columns:1fr}
|
||||||
|
.specTable{grid-template-columns:1fr}
|
||||||
|
.brandDevice{width:min(70vw, 260px);max-height:180px}
|
||||||
.wideCard,.displayCard,.accessPointCard{grid-column:auto}
|
.wideCard,.displayCard,.accessPointCard{grid-column:auto}
|
||||||
.displayHeroText{font-size:18px}
|
.displayHeroText{font-size:18px}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
status: null,
|
status: null,
|
||||||
health: null,
|
health: null,
|
||||||
network: null,
|
network: null,
|
||||||
scan: { ok: true, networks: [], error: "", warning: "", message: "", loading: false, scannedAt: "" },
|
scan: { ok: true, networks: [], error: "", warning: "", message: "", loading: false, scannedAt: "", expanded: false },
|
||||||
networkForm: {
|
networkForm: {
|
||||||
ssid: "",
|
ssid: "",
|
||||||
password: "",
|
password: "",
|
||||||
|
|
@ -307,6 +307,12 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<div class="apExplanation">
|
||||||
|
<div class="listTitle">Local maintenance Wi-Fi</div>
|
||||||
|
<p>Access Point creates a local Wi-Fi network on the device. It is used for first-time setup, maintenance, and recovery when the device cannot connect to the configured network.</p>
|
||||||
|
<p>It usually turns on when the device has no working uplink or when an engineer enables AP mode for service access. In normal operation it may remain disabled.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="meta">${renderKeyValueRows(details)}</div>
|
<div class="meta">${renderKeyValueRows(details)}</div>
|
||||||
|
|
||||||
<div id="apBannerSuccess" class="banner success" ${apUi.message ? "" : "hidden"}>${esc(apUi.message)}</div>
|
<div id="apBannerSuccess" class="banner success" ${apUi.message ? "" : "hidden"}>${esc(apUi.message)}</div>
|
||||||
|
|
@ -592,12 +598,83 @@
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function interfaceTone(summary) {
|
||||||
|
if (!summary || !summary.present) return "warn";
|
||||||
|
return summary.connected ? "ok" : "warn";
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderInterfaceOverview(title, summary, options = {}) {
|
||||||
|
const fallbackText = options.fallbackText || "Not available";
|
||||||
|
const stateText = summary && summary.present ? textValue(summary.status_text, fallbackText) : fallbackText;
|
||||||
|
const name = summary && summary.kind === "wifi"
|
||||||
|
? textValue(summary.ssid || summary.connection, "Not available")
|
||||||
|
: textValue(summary && summary.connection, "Not available");
|
||||||
|
const rows = [
|
||||||
|
{ label: "State", value: stateText },
|
||||||
|
{ label: summary && summary.kind === "wifi" ? "Active connection" : "Connection", value: name },
|
||||||
|
{ label: "Interface", value: summary && summary.interface ? summary.interface : fallbackText },
|
||||||
|
{ label: "IPv4", value: summary && summary.addresses ? (summary.addresses.ipv4 || []).join(", ") || fallbackText : fallbackText },
|
||||||
|
{ label: "IPv6", value: summary && summary.addresses ? (summary.addresses.ipv6 || []).join(", ") || fallbackText : fallbackText },
|
||||||
|
{ label: "Gateway", value: summary ? textValue(summary.gateway, fallbackText) : fallbackText },
|
||||||
|
{ label: "DNS", value: summary ? (summary.dns || []).join(", ") || fallbackText : fallbackText },
|
||||||
|
{ label: "Incoming", value: summary ? formatRate(summary.activity && summary.activity.rx_bytes_per_sec) : fallbackText },
|
||||||
|
{ label: "Outgoing", value: summary ? formatRate(summary.activity && summary.activity.tx_bytes_per_sec) : fallbackText },
|
||||||
|
];
|
||||||
|
if (summary && summary.kind === "wifi") {
|
||||||
|
rows.push({ label: "Desired network", value: textValue(options.desiredProfile, "Not available") });
|
||||||
|
}
|
||||||
|
if (summary && summary.kind === "ethernet") {
|
||||||
|
rows.splice(3, 0,
|
||||||
|
{ label: "Link speed", value: textValue(summary.link_speed, summary.present ? "Not available" : fallbackText) },
|
||||||
|
{ label: "MAC address", value: textValue(summary.mac_address, summary.present ? "Not available" : fallbackText) }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return `
|
||||||
|
<section class="networkInterfaceBlock">
|
||||||
|
<div class="networkInterfaceHead">
|
||||||
|
<div>
|
||||||
|
<h3>${esc(title)}</h3>
|
||||||
|
<div class="badge"><span class="dot ${interfaceTone(summary)}"></span>${esc(stateText)}</div>
|
||||||
|
</div>
|
||||||
|
${summary && summary.is_default_route ? `<span class="actionBadge">Active uplink</span>` : ""}
|
||||||
|
</div>
|
||||||
|
<div class="meta compactMeta">${renderKeyValueRows(rows)}</div>
|
||||||
|
</section>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
function renderNetworkTab() {
|
function renderNetworkTab() {
|
||||||
const network = state.network || {};
|
const network = state.network || {};
|
||||||
const desired = network.desired_profile || {};
|
const desired = network.desired_profile || {};
|
||||||
const wifi = network.wifi || {};
|
const interfaces = network.interfaces || {};
|
||||||
const addresses = network.addresses || { ipv4: [], ipv6: [] };
|
const wifi = interfaces.wifi || {
|
||||||
const activity = network.activity || {};
|
interface: network.iface || "wlan0",
|
||||||
|
kind: "wifi",
|
||||||
|
present: true,
|
||||||
|
connected: !!(network.wifi && network.wifi.connected),
|
||||||
|
status_text: network.wifi && network.wifi.connected ? "Connected" : "Disconnected",
|
||||||
|
state: network.wifi && network.wifi.state || "unknown",
|
||||||
|
connection: network.wifi && network.wifi.connection || "",
|
||||||
|
ssid: network.wifi && network.wifi.ssid || desired.ssid || "",
|
||||||
|
addresses: network.addresses || { ipv4: [], ipv6: [] },
|
||||||
|
gateway: network.gateway || "",
|
||||||
|
dns: network.dns || [],
|
||||||
|
activity: network.activity || { rx_bytes_per_sec: null, tx_bytes_per_sec: null },
|
||||||
|
is_default_route: network.active_uplink === (network.iface || "wlan0")
|
||||||
|
};
|
||||||
|
const ethernet = interfaces.ethernet || {
|
||||||
|
interface: "eth0",
|
||||||
|
kind: "ethernet",
|
||||||
|
present: false,
|
||||||
|
connected: false,
|
||||||
|
status_text: "Ethernet interface not available",
|
||||||
|
addresses: { ipv4: [], ipv6: [] },
|
||||||
|
dns: [],
|
||||||
|
activity: { rx_bytes_per_sec: null, tx_bytes_per_sec: null },
|
||||||
|
mac_address: "",
|
||||||
|
link_speed: "",
|
||||||
|
is_default_route: network.active_uplink === "eth0"
|
||||||
|
};
|
||||||
const accessPointCard = (state.status && state.status.services || []).find((item) => item.id === "access_point");
|
const accessPointCard = (state.status && state.status.services || []).find((item) => item.id === "access_point");
|
||||||
|
|
||||||
return `
|
return `
|
||||||
|
|
@ -636,29 +713,30 @@
|
||||||
<h2>Available Networks</h2>
|
<h2>Available Networks</h2>
|
||||||
<div class="scanStatus">${state.scan.loading ? "Scan in progress" : esc(`${(state.scan.networks || []).length} networks found`)}</div>
|
<div class="scanStatus">${state.scan.loading ? "Scan in progress" : esc(`${(state.scan.networks || []).length} networks found`)}</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="actionBtn secondary" type="button" ${state.scan.loading ? "disabled" : ""} onclick="window.__scanNetworks()">${esc(state.scan.loading ? "Scanning..." : (state.scan.networks || []).length ? "Rescan" : "Scan networks")}</button>
|
<div class="actionRow">
|
||||||
|
<button class="actionBtn secondary" type="button" onclick="window.__toggleScanPanel()">${esc(state.scan.expanded ? "Collapse" : "Expand")}</button>
|
||||||
|
<button class="actionBtn secondary" type="button" ${state.scan.loading ? "disabled" : ""} onclick="window.__scanNetworks()">${esc(state.scan.loading ? "Scanning..." : (state.scan.networks || []).length ? "Rescan" : "Scan networks")}</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${state.scan.warning ? `<div class="banner error">${esc(state.scan.warning)}</div>` : ""}
|
${state.scan.expanded ? `
|
||||||
${renderScanRows()}
|
${state.scan.warning ? `<div class="banner error">${esc(state.scan.warning)}</div>` : ""}
|
||||||
|
${renderScanRows()}
|
||||||
|
` : `<div class="scanCollapsedHint">Available networks list is collapsed.</div>`}
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
${renderSimplePanel("Current Network Status", [
|
<article class="panel card wideCard">
|
||||||
{ label: "State", value: wifi.state || "unknown" },
|
<div class="cardTop">
|
||||||
{ label: "Current SSID", value: wifi.ssid || desired.ssid || "Not available" },
|
<div>
|
||||||
{ label: "Connection", value: wifi.connection || "Not available" },
|
<h2>Network Overview</h2>
|
||||||
{ label: "Interface", value: network.iface || "wlan0" },
|
<div class="badge"><span class="dot ${network.active_uplink ? "ok" : "warn"}"></span>${esc(network.active_uplink ? `Active uplink: ${network.active_uplink}` : "No active uplink")}</div>
|
||||||
{ label: "Gateway", value: network.gateway || "Not available" },
|
</div>
|
||||||
{ label: "DNS", value: (network.dns || []).join(", ") || "Not available" }
|
</div>
|
||||||
], "wideCard")}
|
<div class="networkOverviewGrid">
|
||||||
|
${renderInterfaceOverview("Wi-Fi", wifi, { desiredProfile: desired.profile || desired.ssid || "" })}
|
||||||
${renderSimplePanel("Addresses and Throughput", [
|
${renderInterfaceOverview("Ethernet", ethernet, { fallbackText: "Interface not available" })}
|
||||||
{ label: "IPv4", value: (addresses.ipv4 || []).join(", ") || "Not available" },
|
</div>
|
||||||
{ label: "IPv6", value: (addresses.ipv6 || []).join(", ") || "Not available" },
|
</article>
|
||||||
{ label: "Incoming", value: formatRate(activity.rx_bytes_per_sec) },
|
|
||||||
{ label: "Outgoing", value: formatRate(activity.tx_bytes_per_sec) },
|
|
||||||
{ label: "Desired profile", value: desired.profile || "Not available" }
|
|
||||||
], "wideCard")}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${accessPointCard ? `<div class="cards">${renderAccessPointCard(accessPointCard)}</div>` : ""}
|
${accessPointCard ? `<div class="cards">${renderAccessPointCard(accessPointCard)}</div>` : ""}
|
||||||
|
|
@ -691,6 +769,101 @@
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function renderSpecRows(rows) {
|
||||||
|
return rows.map((item) => `
|
||||||
|
<div class="key">${esc(item.label)}</div>
|
||||||
|
<div>${esc(item.value)}</div>
|
||||||
|
`).join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderGboxManualTab() {
|
||||||
|
const specs = [
|
||||||
|
{ label: "CPU", value: "RK3566 Quad-core, 1.8 GHz" },
|
||||||
|
{ label: "GPU", value: "Mali-G52-2EE (OpenGL ES 1.1/2.0/3.2, OpenCL 2.0, Vulkan 1.1)" },
|
||||||
|
{ label: "Network", value: "Wi-Fi, 10/100 Mbps Ethernet" },
|
||||||
|
{ label: "Video", value: "HDMI 2.0" },
|
||||||
|
{ label: "Resolution", value: "up to 1920x1080" },
|
||||||
|
{ label: "Audio", value: "3.5 mm TRRS" },
|
||||||
|
{ label: "Interfaces", value: "Ethernet, SD, USB2.0, USB3.0, RS232, RS485" },
|
||||||
|
{ label: "Power", value: "12V / 2A" },
|
||||||
|
{ label: "Power consumption", value: "22 W" },
|
||||||
|
{ label: "Operation", value: "24/7" },
|
||||||
|
{ label: "Size", value: "166 x 105 x 30 mm" },
|
||||||
|
{ label: "Weight", value: "350 g" }
|
||||||
|
];
|
||||||
|
const interfaceGroups = [
|
||||||
|
{ title: "Network", items: ["Ethernet (RJ45)", "Wi-Fi antenna"] },
|
||||||
|
{ title: "Media", items: ["HDMI", "3.5 mm audio"] },
|
||||||
|
{ title: "USB / Storage", items: ["USB 2.0", "USB 3.0", "SD card", "internal USB"] },
|
||||||
|
{ title: "Serial", items: ["RS232", "RS485"] },
|
||||||
|
{ title: "Power", items: ["DC 12V"] },
|
||||||
|
{ title: "Indicators", items: ["Red - standby", "Green - active", "Blue - run status"] }
|
||||||
|
];
|
||||||
|
const quickStart = [
|
||||||
|
"Connect power (12V / 2A)",
|
||||||
|
"Connect HDMI (optional)",
|
||||||
|
"Connect Ethernet or configure Wi-Fi",
|
||||||
|
"Connect peripherals if needed",
|
||||||
|
"Power on",
|
||||||
|
"Check LED indicators",
|
||||||
|
"Open Web UI"
|
||||||
|
];
|
||||||
|
const notes = [
|
||||||
|
"Use a stable power supply",
|
||||||
|
"Ensure proper ventilation",
|
||||||
|
"Verify RS232 / RS485 wiring before energizing the line",
|
||||||
|
"Designed for 24/7 operation"
|
||||||
|
];
|
||||||
|
|
||||||
|
return `
|
||||||
|
<section class="tabPanel">
|
||||||
|
<article class="panel card wideCard gboxHero">
|
||||||
|
<img class="gboxHeroImage" src="/g-box.png" alt="IOMATEX G-Box" onerror="this.onerror=null;this.src='/logo.png';">
|
||||||
|
<div class="gboxHeroCopy">
|
||||||
|
<div class="eyebrow">IOMATEX G-Box</div>
|
||||||
|
<h2>G-Box Instructions and Manual</h2>
|
||||||
|
<p class="sub">Compact edge gateway for automation workloads, local service access, commissioning, and resilient field maintenance.</p>
|
||||||
|
<div class="capabilityBadge">Digital DNA ready</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<div class="cards">
|
||||||
|
<article class="panel card wideCard">
|
||||||
|
<div class="cardTop"><div><h2>Technical Specifications</h2></div></div>
|
||||||
|
<div class="specTable">${renderSpecRows(specs)}</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel card wideCard">
|
||||||
|
<div class="cardTop"><div><h2>Gateway Interfaces</h2></div></div>
|
||||||
|
<div class="manualGrid">
|
||||||
|
${interfaceGroups.map((group) => `
|
||||||
|
<section class="manualGroup">
|
||||||
|
<div class="listTitle">${esc(group.title)}</div>
|
||||||
|
<ul class="msgList">${group.items.map((item) => `<li>${esc(item)}</li>`).join("")}</ul>
|
||||||
|
</section>
|
||||||
|
`).join("")}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel card">
|
||||||
|
<div class="cardTop"><div><h2>Installation Guide</h2></div></div>
|
||||||
|
<div class="listTitle">Quick Start</div>
|
||||||
|
<ol class="manualSteps">
|
||||||
|
${quickStart.map((item) => `<li>${esc(item)}</li>`).join("")}
|
||||||
|
</ol>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="panel card">
|
||||||
|
<div class="cardTop"><div><h2>Notes</h2></div></div>
|
||||||
|
<ul class="msgList manualNotes">
|
||||||
|
${notes.map((item) => `<li>${esc(item)}</li>`).join("")}
|
||||||
|
</ul>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
function renderActiveTab() {
|
function renderActiveTab() {
|
||||||
nodes.tabs.forEach((button) => {
|
nodes.tabs.forEach((button) => {
|
||||||
button.classList.toggle("is-active", button.dataset.tab === state.activeTab);
|
button.classList.toggle("is-active", button.dataset.tab === state.activeTab);
|
||||||
|
|
@ -705,6 +878,10 @@
|
||||||
nodes.content.innerHTML = renderTscreenTab();
|
nodes.content.innerHTML = renderTscreenTab();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (state.activeTab === "gbox") {
|
||||||
|
nodes.content.innerHTML = renderGboxManualTab();
|
||||||
|
return;
|
||||||
|
}
|
||||||
nodes.content.innerHTML = renderHealthTab();
|
nodes.content.innerHTML = renderHealthTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -712,7 +889,7 @@
|
||||||
const safe = identity || {};
|
const safe = identity || {};
|
||||||
nodes.edgeId.textContent = safe.edge_id || "-";
|
nodes.edgeId.textContent = safe.edge_id || "-";
|
||||||
nodes.hostName.textContent = safe.hostname || "-";
|
nodes.hostName.textContent = safe.hostname || "-";
|
||||||
nodes.osLabel.textContent = safe.os_label || "IOMATEX Edge OS";
|
nodes.osLabel.textContent = "Unified diagnostics, network operations and gateway commissioning.";
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateHeaderMeta(payload) {
|
function updateHeaderMeta(payload) {
|
||||||
|
|
@ -918,12 +1095,18 @@
|
||||||
|
|
||||||
window.__scanNetworks = async function () {
|
window.__scanNetworks = async function () {
|
||||||
if (state.scan.loading) return;
|
if (state.scan.loading) return;
|
||||||
|
state.scan.expanded = true;
|
||||||
state.scan.loading = true;
|
state.scan.loading = true;
|
||||||
renderActiveTab();
|
renderActiveTab();
|
||||||
await loadScan();
|
await loadScan();
|
||||||
if (state.activeTab === "network") renderActiveTab();
|
if (state.activeTab === "network") renderActiveTab();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.__toggleScanPanel = function () {
|
||||||
|
state.scan.expanded = !state.scan.expanded;
|
||||||
|
if (state.activeTab === "network") renderActiveTab();
|
||||||
|
};
|
||||||
|
|
||||||
window.__applyWifiProfile = async function () {
|
window.__applyWifiProfile = async function () {
|
||||||
const validationError = networkValidationError();
|
const validationError = networkValidationError();
|
||||||
if (validationError) {
|
if (validationError) {
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@
|
||||||
<main class="shell">
|
<main class="shell">
|
||||||
<header class="hero">
|
<header class="hero">
|
||||||
<div class="brand">
|
<div class="brand">
|
||||||
<img class="brandLogo" src="/logo.png" alt="IOMATEX logo">
|
<img class="brandDevice" src="/g-box.png" alt="IOMATEX G-Box" onerror="this.onerror=null;this.src='/logo.png';">
|
||||||
<div class="brandCopy">
|
<div class="brandCopy">
|
||||||
<div class="eyebrow">IOMATEX</div>
|
<div class="eyebrow">IOMATEX G-Box</div>
|
||||||
<h1>Edge Console</h1>
|
<h1>Edge Automation Gateway</h1>
|
||||||
<p class="sub osLabel" id="osLabel">IOMATEX Edge OS</p>
|
<div class="capabilityBadge">Digital DNA ready</div>
|
||||||
<p class="sub">Unified diagnostics, network operations and It-Screen foundation.</p>
|
<p class="sub brandSupport" id="osLabel">Unified diagnostics, network operations and gateway commissioning.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<section class="panel identityPanel">
|
<section class="panel identityPanel">
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
<button class="tabBtn is-active" type="button" data-tab="health">Health</button>
|
<button class="tabBtn is-active" type="button" data-tab="health">Health</button>
|
||||||
<button class="tabBtn" type="button" data-tab="network">Network</button>
|
<button class="tabBtn" type="button" data-tab="network">Network</button>
|
||||||
<button class="tabBtn" type="button" data-tab="tscreen">It-Screen</button>
|
<button class="tabBtn" type="button" data-tab="tscreen">It-Screen</button>
|
||||||
|
<button class="tabBtn" type="button" data-tab="gbox">G-Box Instructions and Manual</button>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<section id="tabContent" class="tabContent" aria-live="polite"></section>
|
<section id="tabContent" class="tabContent" aria-live="polite"></section>
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
|
|
@ -32,6 +32,7 @@ SERVICE_NAME="iomatex-console.service"
|
||||||
LEGACY_SERVICE_NAME="iomatex-webipc.service"
|
LEGACY_SERVICE_NAME="iomatex-webipc.service"
|
||||||
CFG_PATH="/etc/iomatex/console.json"
|
CFG_PATH="/etc/iomatex/console.json"
|
||||||
SRC_LOGO="${LOGO_SOURCE:-$SCRIPT_DIR/iomatex_logo_source.png}"
|
SRC_LOGO="${LOGO_SOURCE:-$SCRIPT_DIR/iomatex_logo_source.png}"
|
||||||
|
SRC_GBOX="${GBOX_SOURCE:-$SCRIPT_DIR/g-box.png}"
|
||||||
APP_BIND="${CONSOLE_BIND:-0.0.0.0}"
|
APP_BIND="${CONSOLE_BIND:-0.0.0.0}"
|
||||||
APP_PORT="${CONSOLE_PORT:-80}"
|
APP_PORT="${CONSOLE_PORT:-80}"
|
||||||
ts="$(date +%s)"
|
ts="$(date +%s)"
|
||||||
|
|
@ -311,6 +312,7 @@ require_file "$STAGE_FRONTEND_DIR/index.html"
|
||||||
require_file "$STAGE_FRONTEND_DIR/console.js"
|
require_file "$STAGE_FRONTEND_DIR/console.js"
|
||||||
require_file "$STAGE_FRONTEND_DIR/console.css"
|
require_file "$STAGE_FRONTEND_DIR/console.css"
|
||||||
require_file "$STAGE_PROVIDERS_DIR/00_core_services.py"
|
require_file "$STAGE_PROVIDERS_DIR/00_core_services.py"
|
||||||
|
require_file "$SRC_GBOX"
|
||||||
|
|
||||||
echo "[5/8] Install Wi-Fi helper scripts"
|
echo "[5/8] Install Wi-Fi helper scripts"
|
||||||
cat > /usr/local/sbin/iomatex-ap-sync-config <<'EOF'
|
cat > /usr/local/sbin/iomatex-ap-sync-config <<'EOF'
|
||||||
|
|
@ -793,6 +795,7 @@ if [ ! -f "$SRC_LOGO" ]; then
|
||||||
echo "ERROR: logo source image not found: $SRC_LOGO" >&2
|
echo "ERROR: logo source image not found: $SRC_LOGO" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
install -m 0644 "$SRC_GBOX" "$STAGE_PUBLIC_DIR/g-box.png"
|
||||||
python3 - "$SRC_LOGO" "$STAGE_PUBLIC_DIR/logo.png" "$STAGE_PUBLIC_DIR/favicon.png" <<'PY'
|
python3 - "$SRC_LOGO" "$STAGE_PUBLIC_DIR/logo.png" "$STAGE_PUBLIC_DIR/favicon.png" <<'PY'
|
||||||
import sys
|
import sys
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue