refactor: rimossa etichetta Network dai Time Slot nell'interfaccia
Rimossa l'estrazione MQTT in app.py e la visualizzazione frontend (es. [BM]) accanto a TS1 e TS2. Il mapping esclusivo non è più coerente quando si utilizzano configurazioni multi-network con politiche di TGRewrite avanzate.
This commit is contained in:
@@ -235,7 +235,6 @@ client_telemetry = {}
|
|||||||
last_notified_errors = {}
|
last_notified_errors = {}
|
||||||
device_health = {}
|
device_health = {}
|
||||||
last_seen_reflector = {}
|
last_seen_reflector = {}
|
||||||
network_mapping = {}
|
|
||||||
node_info = {}
|
node_info = {}
|
||||||
node_general = {}
|
node_general = {}
|
||||||
node_versions = {}
|
node_versions = {}
|
||||||
@@ -458,32 +457,6 @@ def on_message(client, userdata, msg):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing health data: {e}")
|
logger.error(f"Error parsing health data: {e}")
|
||||||
|
|
||||||
elif len(parts) >= 4 and p0 == 'data' and p2 == 'dmrgateway' and (parts[3].upper().startswith('NETWORK') or parts[3].upper().startswith('DMR NETWORK')):
|
|
||||||
try:
|
|
||||||
cid = parts[1].lower()
|
|
||||||
data = json.loads(payload)
|
|
||||||
|
|
||||||
if cid not in network_mapping:
|
|
||||||
network_mapping[cid] = {"ts1": "", "ts2": ""}
|
|
||||||
|
|
||||||
if str(data.get("Enabled")) == "1":
|
|
||||||
net_name = data.get("Name", "Net").upper()
|
|
||||||
is_ts1 = False
|
|
||||||
is_ts2 = False
|
|
||||||
|
|
||||||
keys_to_check = ["PassAllTG", "PassAllPC", "TGRewrite", "PCRewrite", "TypeRewrite", "SrcRewrite"]
|
|
||||||
for k in keys_to_check:
|
|
||||||
val = str(data.get(k, "")).strip()
|
|
||||||
if val.startswith("1"): is_ts1 = True
|
|
||||||
if val.startswith("2"): is_ts2 = True
|
|
||||||
|
|
||||||
if is_ts1: network_mapping[cid]["ts1"] = net_name
|
|
||||||
if is_ts2: network_mapping[cid]["ts2"] = net_name
|
|
||||||
notify_update()
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.error(f"Error parsing DMRGateway for {cid}: {e}")
|
|
||||||
|
|
||||||
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'info':
|
elif len(parts) >= 4 and p0 == 'data' and p2 in ('mmdvm', 'mmdvmhost') and parts[3].lower() == 'info':
|
||||||
try:
|
try:
|
||||||
cid = parts[1].lower()
|
cid = parts[1].lower()
|
||||||
@@ -681,7 +654,6 @@ def get_states():
|
|||||||
"states": client_states,
|
"states": client_states,
|
||||||
"telemetry": client_telemetry,
|
"telemetry": client_telemetry,
|
||||||
"health": device_health,
|
"health": device_health,
|
||||||
"networks": network_mapping,
|
|
||||||
"info": node_info,
|
"info": node_info,
|
||||||
"general": node_general,
|
"general": node_general,
|
||||||
"last_seen": seen_ages(),
|
"last_seen": seen_ages(),
|
||||||
|
|||||||
@@ -464,7 +464,7 @@
|
|||||||
ttReqCfg: "Request immediate data update", ttGlobal: "Force profile switch on network", ttAdmin: "User and system management", ttPass: "Change your password", ttLogout: "Log out",
|
ttReqCfg: "Request immediate data update", ttGlobal: "Force profile switch on network", ttAdmin: "User and system management", ttPass: "Change your password", ttLogout: "Log out",
|
||||||
ttProfA: "Switch to Profile A", ttProfB: "Switch to Profile B", ttTgOn: "Enable Telegram notifications", ttTgOff: "Disable Telegram notifications", ttSvc: "Manage system daemons", ttFile: "Edit .ini configuration files", ttHat: "Send physical reset to modem", ttBoot: "Reboot node operating system",
|
ttProfA: "Switch to Profile A", ttProfB: "Switch to Profile B", ttTgOn: "Enable Telegram notifications", ttTgOff: "Disable Telegram notifications", ttSvc: "Manage system daemons", ttFile: "Edit .ini configuration files", ttHat: "Send physical reset to modem", ttBoot: "Reboot node operating system",
|
||||||
ttSwitchTo: "Switch to profile: ", ttSvcStart: "Start service", ttSvcRestart: "Restart service", ttSvcEdit: "Edit configuration", ttSvcStop: "Stop service", ttLang: "Change language",
|
ttSwitchTo: "Switch to profile: ", ttSvcStart: "Start service", ttSvcRestart: "Restart service", ttSvcEdit: "Edit configuration", ttSvcStop: "Stop service", ttLang: "Change language",
|
||||||
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "⏱️ AVERAGE DURATION", statTodayTx: "📡 TRANSITS TODAY", statNoData: "No data",
|
statTopTG: "🎯 TOP TALKGROUPS", statTopCall: "🗣️ TOP CALLSIGNS", statLoading: "Loading...", statAvgDur: "⏱️ AVERAGE DURATION", statTodayTx: "📡 TRANSITI TODAY", statNoData: "No data",
|
||||||
statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES", modVersions: "Software & Firmware"
|
statTitle: "DAILY STATISTICS", statAllNodes: "ALL NODES", modVersions: "Software & Firmware"
|
||||||
},
|
},
|
||||||
it: {
|
it: {
|
||||||
@@ -889,7 +889,6 @@
|
|||||||
if (altDiv) altDiv.style.display = "none";
|
if (altDiv) altDiv.style.display = "none";
|
||||||
if (tsContainer) tsContainer.style.display = "flex";
|
if (tsContainer) tsContainer.style.display = "flex";
|
||||||
|
|
||||||
let netObj = data.networks && data.networks[c.id.toLowerCase()] ? data.networks[c.id.toLowerCase()] : {ts1: "", ts2: ""};
|
|
||||||
activeModeColor = "var(--primary)";
|
activeModeColor = "var(--primary)";
|
||||||
|
|
||||||
if (ts1Div && ts2Div) {
|
if (ts1Div && ts2Div) {
|
||||||
@@ -899,8 +898,8 @@
|
|||||||
[ts1Div, ts2Div].forEach((div, idx) => {
|
[ts1Div, ts2Div].forEach((div, idx) => {
|
||||||
if (isSimplex && idx === 0) return;
|
if (isSimplex && idx === 0) return;
|
||||||
|
|
||||||
const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? ''); const netName = idx === 0 ? netObj.ts1 : netObj.ts2;
|
const val = String((idx === 0 ? telemetryObj.ts1 : telemetryObj.ts2) ?? '');
|
||||||
const fullLabel = netName ? `TS${idx + 1} [${netName}]` : `TS${idx + 1}`;
|
const fullLabel = `TS${idx + 1}`;
|
||||||
div.innerText = `${fullLabel}: ${val}`;
|
div.innerText = `${fullLabel}: ${val}`;
|
||||||
div.style.setProperty('--pulse-color', activeModeColor);
|
div.style.setProperty('--pulse-color', activeModeColor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user