Read-only terminal UI dashboard for monitoring the ServeImport service in real time. Launched as a standalone CLI command; it does not require the import service to be running.
ImportTUI polls three data sources every TuiConstants.IMPORT_POLL_SECS seconds (default 5 s):
psutil to detect whether ServeImport watch is active.local.documents/ for pending files awaiting import, sorted by modification time descending.def_import for the configured import definitions (up to TuiConstants.IMPORT_CONFIGS_LIMIT rows).__init__(self)Initialises the theme, console, layout, and internal state (watch_running, pending_files, import_configs, db_ok). No port argument — this monitor does not bind to a network port.
start(self) / stop(self)Standard TUI lifecycle — start renders the initial layout and launches the background thread; stop signals it and tears down.
log(self, message, level) / set_status(self, message)Thread-safe log append and footer status update.
_poll_data(self) (internal)Runs every IMPORT_POLL_SECS. Iterates process list via psutil, lists local.documents/, and queries def_import. All results are written to shared state under self.lock.
| Panel | Content |
|---|---|
| Header | Heartbeat, package, watch process status, clock, uptime |
| Sidebar | DB status, watch process status, pending file count, import config count |
| Pending Files | Table of files in local.documents/ — name, size (KB), modification time |
| Import Configs | Table of def_import rows — code, directory, file pattern |
| Log | Scrolling log |
| Footer | Last poll timestamp |
python ServeImport.py tui
Press Ctrl+C to exit.