feat: live SSE-based Database Activity panel
Some checks failed
Build and Test / build (pull_request) Failing after 17m0s
Some checks failed
Build and Test / build (pull_request) Failing after 17m0s
Replace the static startup-only item list with a real-time event feed:
- InitGui.py: remove the startup list_items() call that showed
'(Unable to connect)' when not yet authenticated; show a simple
'(Waiting for connection...)' placeholder instead
- silo_commands.py (submodule): maintain an in-memory event list
prepended by SSE events, seeded with 10 recent items on first
connect, with relative timestamps refreshed every 60s
The panel now shows live activity ('F01-0001 updated · just now')
instead of requiring expensive full re-fetches on every SSE event.
This commit is contained in:
Submodule mods/silo updated: 972dc07157...d7c6066030
@@ -104,7 +104,7 @@ def _setup_silo_auth_panel():
|
||||
|
||||
|
||||
def _setup_silo_activity_panel():
|
||||
"""Show a dock widget with recent Silo database activity."""
|
||||
"""Show a dock widget with live Silo database activity."""
|
||||
try:
|
||||
from PySide import QtCore, QtWidgets
|
||||
|
||||
@@ -121,27 +121,12 @@ def _setup_silo_activity_panel():
|
||||
|
||||
widget = QtWidgets.QWidget()
|
||||
layout = QtWidgets.QVBoxLayout(widget)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
activity_list = QtWidgets.QListWidget()
|
||||
activity_list.addItem("(Waiting for connection...)")
|
||||
layout.addWidget(activity_list)
|
||||
|
||||
try:
|
||||
import silo_commands
|
||||
|
||||
items = silo_commands._client.list_items()
|
||||
if isinstance(items, list):
|
||||
for item in items[:20]:
|
||||
pn = item.get("part_number", "")
|
||||
desc = item.get("description", "")
|
||||
updated = item.get("updated_at", "")
|
||||
if updated:
|
||||
updated = updated[:10]
|
||||
activity_list.addItem(f"{pn} - {desc} - {updated}")
|
||||
if activity_list.count() == 0:
|
||||
activity_list.addItem("(No items in database)")
|
||||
except Exception:
|
||||
activity_list.addItem("(Unable to connect to Silo database)")
|
||||
|
||||
panel.setWidget(widget)
|
||||
mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, panel)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user