Merge pull request #375 from langflow-ai/tui-service-status-parse-fix
tui service status parse fix
This commit is contained in:
commit
fef5f36a10
1 changed files with 21 additions and 8 deletions
|
|
@ -85,16 +85,27 @@ class WelcomeScreen(Screen):
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
import json
|
import json
|
||||||
services = []
|
services = []
|
||||||
for line in result.stdout.strip().split('\n'):
|
|
||||||
if line.strip():
|
# Try parsing as a single JSON array first (podman format)
|
||||||
try:
|
try:
|
||||||
service = json.loads(line)
|
parsed = json.loads(result.stdout.strip())
|
||||||
services.append(service)
|
if isinstance(parsed, list):
|
||||||
except json.JSONDecodeError:
|
services = parsed
|
||||||
continue
|
else:
|
||||||
|
services = [parsed] if isinstance(parsed, dict) else []
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
# Fallback: try parsing line-by-line (docker format)
|
||||||
|
for line in result.stdout.strip().split('\n'):
|
||||||
|
if line.strip():
|
||||||
|
try:
|
||||||
|
service = json.loads(line)
|
||||||
|
if isinstance(service, dict):
|
||||||
|
services.append(service)
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
continue
|
||||||
|
|
||||||
# Check if any services are running
|
# Check if any services are running
|
||||||
running_services = [s for s in services if s.get('State') == 'running']
|
running_services = [s for s in services if isinstance(s, dict) and s.get('State') == 'running']
|
||||||
self.services_running = len(running_services) > 0
|
self.services_running = len(running_services) > 0
|
||||||
else:
|
else:
|
||||||
self.services_running = False
|
self.services_running = False
|
||||||
|
|
@ -196,6 +207,8 @@ class WelcomeScreen(Screen):
|
||||||
s.name for s in services.values() if s.status == ServiceStatus.RUNNING
|
s.name for s in services.values() if s.status == ServiceStatus.RUNNING
|
||||||
]
|
]
|
||||||
self.services_running = len(running_services) > 0
|
self.services_running = len(running_services) > 0
|
||||||
|
else:
|
||||||
|
self.services_running = False
|
||||||
|
|
||||||
# Check native service state
|
# Check native service state
|
||||||
self.docling_running = self.docling_manager.is_running()
|
self.docling_running = self.docling_manager.is_running()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue