Refocus dashboard on device monitoring

This commit is contained in:
chick
2026-07-07 23:33:27 +08:00
parent 2505ee561a
commit 0e746f961c
6 changed files with 247 additions and 91 deletions
+32 -3
View File
@@ -137,7 +137,9 @@ function pickDevice(data) {
imei: data.imei || data.IMEI || null,
manufacturer: data.manufacturer || data.vendor || null,
model: data.model || data.device_model || null,
firmware: data.firmware || data.firmware_version || data.version || null,
firmware: data.firmware || data.firmware_version || data.version || data.revision || null,
revision: data.revision || null,
powered: data.powered ?? data.power ?? null,
online: data.online ?? data.is_online ?? null,
}
}
@@ -148,9 +150,12 @@ function pickSim(data) {
return {
iccid: data.iccid || data.ICCID || null,
imsi: data.imsi || data.IMSI || null,
phoneNumber: data.phone_number || data.phoneNumber || data.msisdn || null,
phoneNumber: data.phone_number || data.phoneNumber || data.msisdn || (Array.isArray(data.phone_numbers) ? data.phone_numbers[0] : null) || null,
phoneNumbers: data.phone_numbers || data.phoneNumbers || null,
operator: data.operator || data.operator_name || null,
signal: data.signal || data.signal_strength || null,
present: data.present ?? data.inserted ?? null,
smsCenter: data.sms_center || data.smsCenter || null,
}
}
@@ -160,8 +165,10 @@ function pickNetwork(data) {
return {
operator: data.operator || data.operator_name || data.provider || null,
registration: data.registration || data.registration_state || data.status || null,
accessTechnology: data.access_technology || data.accessTechnology || data.rat || data.mode || null,
accessTechnology: data.access_technology || data.accessTechnology || data.rat || data.mode || data.technology_preference || null,
signal: data.signal || data.signal_strength || data.rssi || null,
mcc: data.mcc || null,
mnc: data.mnc || null,
}
}
@@ -172,6 +179,10 @@ function pickSms(data) {
total: data.total ?? data.total_count ?? data.count ?? null,
unread: data.unread ?? data.unread_count ?? null,
conversations: data.conversations ?? data.conversation_count ?? null,
incoming: data.incoming ?? null,
outgoing: data.outgoing ?? null,
pushed: data.pushed ?? null,
pushAttempted: data.push_attempted ?? data.pushAttempted ?? null,
}
}
@@ -182,6 +193,7 @@ function pickDataStatus(data) {
enabled: data.enabled ?? data.data_enabled ?? null,
connected: data.connected ?? data.is_connected ?? null,
roaming: data.roaming ?? data.roaming_allowed ?? null,
active: data.active ?? null,
}
}
@@ -192,6 +204,22 @@ function pickOta(data) {
currentVersion: data.current_version || data.currentVersion || data.version || null,
latestVersion: data.latest_version || data.latestVersion || null,
updateAvailable: data.update_available ?? data.updateAvailable ?? null,
pendingUpdate: data.pending_update ?? data.pendingUpdate ?? null,
currentCommit: data.current_commit || data.currentCommit || null,
}
}
function pickSystem(data) {
data = apiData(data)
if (!data || typeof data !== 'object') return null
return {
cpuLoad: data.cpu_load ?? data.cpuLoad ?? null,
memory: data.memory || null,
disk: data.disk || null,
networkSpeed: data.network_speed || data.networkSpeed || null,
info: data.system_info || data.systemInfo || null,
temperature: data.temperature || null,
uptime: data.uptime ?? null,
}
}
@@ -203,6 +231,7 @@ export function summarizeInstanceSnapshot(raw) {
sms: pickSms(raw.smsStats),
data: pickDataStatus(raw.data),
ota: pickOta(raw.ota),
system: pickSystem(raw.stats),
stats: apiData(raw.stats) || null,
calls: apiData(raw.calls) || null,
}