Fix training agent heartbeat status
This commit is contained in:
@@ -10,7 +10,7 @@ android {
|
||||
applicationId = "xyz.kusoft.tradebotmonitor"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 7
|
||||
versionName = "0.2.4"
|
||||
versionCode = 8
|
||||
versionName = "0.2.5"
|
||||
}
|
||||
}
|
||||
|
||||
+16
-2
@@ -575,12 +575,26 @@ class MainActivity : Activity() {
|
||||
private fun trainingComputerPanel(retrain: JSONObject): View =
|
||||
LinearLayout(this).apply {
|
||||
val coordination = retrain.optJSONObject("coordination") ?: JSONObject()
|
||||
val agentOnline = coordination.optBoolean("agent_online", false)
|
||||
val activeJob = coordination.optJSONObject("active_job")
|
||||
val agentRecentlySeen = coordination.optBoolean(
|
||||
"agent_recently_seen",
|
||||
coordination.optBoolean("agent_online", false),
|
||||
)
|
||||
val agentBusy = coordination.optBoolean(
|
||||
"agent_busy",
|
||||
activeJob?.optStringClean("status") == "running",
|
||||
)
|
||||
val connectionText = when {
|
||||
agentRecentlySeen -> "онлайн"
|
||||
agentBusy -> "занят обучением"
|
||||
else -> "нет связи"
|
||||
}
|
||||
val connectionColor = if (agentRecentlySeen || agentBusy) palette.green else palette.amber
|
||||
orientation = LinearLayout.VERTICAL
|
||||
addView(text("Компьютер обучения", 12f, Typeface.NORMAL, palette.muted))
|
||||
addView(text(prefs.trainingComputerName, 18f, Typeface.BOLD, palette.green).top(dp(5)))
|
||||
addView(text(prefs.trainingComputerPath, 12f, Typeface.NORMAL, palette.muted).top(dp(4)))
|
||||
addView(keyValueLine("Связь агента", if (agentOnline) "онлайн" else "нет связи", if (agentOnline) palette.green else palette.amber).top(dp(4)))
|
||||
addView(keyValueLine("Связь агента", connectionText, connectionColor).top(dp(4)))
|
||||
addView(text("Бот ставит задания через tb.kusoft.xyz, а этот Windows-agent сам забирает их через интернет и возвращает результат.", 12f, Typeface.NORMAL, palette.muted).top(dp(8)))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user