fix: Fix orchestrator dashboard service errors
Fixed two critical issues preventing dashboard from loading:
1. OrchestrationStatus enum case mismatch:
- Changed OrchestrationStatus.COMPLETED → .completed
- Changed OrchestrationStatus.COMPLETED_WITH_WARNINGS → .partial_success
- Enum values are lowercase, not uppercase
2. Service hostname resolution errors:
- Fixed all service URLs to include -service suffix:
- http://inventory:8000 → http://inventory-service:8000
- http://production:8000 → http://production-service:8000
- http://procurement:8000 → http://procurement-service:8000
- http://alert-processor:8000 → http://alert-processor-service:8000
This fixes the AttributeError and "Name or service not known" errors
preventing the dashboard from loading demo data.
This commit is contained in:
@@ -181,7 +181,7 @@ async def get_bakery_health_status(
|
||||
# Get alerts
|
||||
try:
|
||||
alerts_response = await client.get(
|
||||
f"http://alert-processor:8000/api/v1/tenants/{tenant_id}/alerts/summary"
|
||||
f"http://alert-processor-service:8000/api/v1/tenants/{tenant_id}/alerts/summary"
|
||||
)
|
||||
alerts_data = alerts_response.json() if alerts_response.status_code == 200 else {}
|
||||
critical_alerts = alerts_data.get("critical_count", 0)
|
||||
@@ -192,7 +192,7 @@ async def get_bakery_health_status(
|
||||
# Get pending PO count
|
||||
try:
|
||||
po_response = await client.get(
|
||||
f"http://procurement:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
f"http://procurement-service:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
params={"status": "pending_approval", "limit": 100}
|
||||
)
|
||||
po_data = po_response.json() if po_response.status_code == 200 else {}
|
||||
@@ -204,7 +204,7 @@ async def get_bakery_health_status(
|
||||
# Get production delays
|
||||
try:
|
||||
prod_response = await client.get(
|
||||
f"http://production:8000/api/v1/tenants/{tenant_id}/production-batches",
|
||||
f"http://production-service:8000/api/v1/tenants/{tenant_id}/production-batches",
|
||||
params={"status": "ON_HOLD", "limit": 100}
|
||||
)
|
||||
prod_data = prod_response.json() if prod_response.status_code == 200 else {}
|
||||
@@ -216,7 +216,7 @@ async def get_bakery_health_status(
|
||||
# Get inventory status
|
||||
try:
|
||||
inv_response = await client.get(
|
||||
f"http://inventory:8000/api/v1/tenants/{tenant_id}/inventory/dashboard/stock-status"
|
||||
f"http://inventory-service:8000/api/v1/tenants/{tenant_id}/inventory/dashboard/stock-status"
|
||||
)
|
||||
inv_data = inv_response.json() if inv_response.status_code == 200 else {}
|
||||
out_of_stock_count = inv_data.get("out_of_stock_count", 0)
|
||||
@@ -270,7 +270,7 @@ async def get_orchestration_summary(
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
try:
|
||||
po_response = await client.get(
|
||||
f"http://procurement:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
f"http://procurement-service:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
params={"status": "pending_approval", "limit": 10}
|
||||
)
|
||||
if po_response.status_code == 200:
|
||||
@@ -290,7 +290,7 @@ async def get_orchestration_summary(
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
try:
|
||||
batch_response = await client.get(
|
||||
f"http://production:8000/api/v1/tenants/{tenant_id}/production-batches/today"
|
||||
f"http://production-service:8000/api/v1/tenants/{tenant_id}/production-batches/today"
|
||||
)
|
||||
if batch_response.status_code == 200:
|
||||
batches = batch_response.json().get("batches", [])
|
||||
@@ -332,7 +332,7 @@ async def get_action_queue(
|
||||
pending_pos = []
|
||||
try:
|
||||
po_response = await client.get(
|
||||
f"http://procurement:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
f"http://procurement-service:8000/api/v1/tenants/{tenant_id}/purchase-orders",
|
||||
params={"status": "pending_approval", "limit": 20}
|
||||
)
|
||||
if po_response.status_code == 200:
|
||||
@@ -344,7 +344,7 @@ async def get_action_queue(
|
||||
critical_alerts = []
|
||||
try:
|
||||
alerts_response = await client.get(
|
||||
f"http://alert-processor:8000/api/v1/tenants/{tenant_id}/alerts",
|
||||
f"http://alert-processor-service:8000/api/v1/tenants/{tenant_id}/alerts",
|
||||
params={"severity": "critical", "resolved": False, "limit": 20}
|
||||
)
|
||||
if alerts_response.status_code == 200:
|
||||
@@ -409,7 +409,7 @@ async def get_production_timeline(
|
||||
async with httpx.AsyncClient(timeout=10.0) as client:
|
||||
try:
|
||||
response = await client.get(
|
||||
f"http://production:8000/api/v1/tenants/{tenant_id}/production-batches/today"
|
||||
f"http://production-service:8000/api/v1/tenants/{tenant_id}/production-batches/today"
|
||||
)
|
||||
if response.status_code == 200:
|
||||
batches = response.json().get("batches", [])
|
||||
@@ -459,7 +459,7 @@ async def get_insights(
|
||||
sustainability_data = {}
|
||||
try:
|
||||
response = await client.get(
|
||||
f"http://inventory:8000/api/v1/tenants/{tenant_id}/sustainability/widget"
|
||||
f"http://inventory-service:8000/api/v1/tenants/{tenant_id}/sustainability/widget"
|
||||
)
|
||||
if response.status_code == 200:
|
||||
sustainability_data = response.json()
|
||||
@@ -470,7 +470,7 @@ async def get_insights(
|
||||
inventory_data = {}
|
||||
try:
|
||||
response = await client.get(
|
||||
f"http://inventory:8000/api/v1/tenants/{tenant_id}/inventory/dashboard/stock-status"
|
||||
f"http://inventory-service:8000/api/v1/tenants/{tenant_id}/inventory/dashboard/stock-status"
|
||||
)
|
||||
if response.status_code == 200:
|
||||
inventory_data = response.json()
|
||||
|
||||
@@ -213,8 +213,8 @@ class DashboardService:
|
||||
select(OrchestrationRun)
|
||||
.where(OrchestrationRun.tenant_id == tenant_id)
|
||||
.where(OrchestrationRun.status.in_([
|
||||
OrchestrationStatus.COMPLETED,
|
||||
OrchestrationStatus.COMPLETED_WITH_WARNINGS
|
||||
OrchestrationStatus.completed,
|
||||
OrchestrationStatus.partial_success
|
||||
]))
|
||||
.order_by(desc(OrchestrationRun.started_at))
|
||||
.limit(1)
|
||||
@@ -259,8 +259,8 @@ class DashboardService:
|
||||
select(OrchestrationRun)
|
||||
.where(OrchestrationRun.tenant_id == tenant_id)
|
||||
.where(OrchestrationRun.status.in_([
|
||||
OrchestrationStatus.COMPLETED,
|
||||
OrchestrationStatus.COMPLETED_WITH_WARNINGS
|
||||
OrchestrationStatus.completed,
|
||||
OrchestrationStatus.partial_success
|
||||
]))
|
||||
.order_by(desc(OrchestrationRun.started_at))
|
||||
.limit(1)
|
||||
|
||||
Reference in New Issue
Block a user