mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
fix: data sync delay
This commit is contained in:
@@ -179,6 +179,11 @@ class NewHostTreeModel private constructor() : SimpleTreeModel<Host>(
|
|||||||
source: DatabaseChangedExtension.Source
|
source: DatabaseChangedExtension.Source
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
// 同步数据
|
||||||
|
if (type == DataType.Host.name && id.isNotBlank()) {
|
||||||
|
syncUserObject(id)
|
||||||
|
}
|
||||||
|
|
||||||
if (id.isBlank() || source != DatabaseChangedExtension.Source.Sync) return
|
if (id.isBlank() || source != DatabaseChangedExtension.Source.Sync) return
|
||||||
if (type.isNotBlank() && type != DataType.Host.name) return
|
if (type.isNotBlank() && type != DataType.Host.name) return
|
||||||
|
|
||||||
@@ -213,6 +218,16 @@ class NewHostTreeModel private constructor() : SimpleTreeModel<Host>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun syncUserObject(id: String) {
|
||||||
|
for (node in getRoot().getAllChildren()) {
|
||||||
|
if (node.id == id) {
|
||||||
|
val host = hostManager.getHost(id) ?: return
|
||||||
|
node.host = host
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private inner class MyAccountAccountExtension : AccountExtension {
|
private inner class MyAccountAccountExtension : AccountExtension {
|
||||||
|
|||||||
Reference in New Issue
Block a user