Deploy AIOS web (React glide grid + FastAPI slice)
Browse files- RELEASES.json +1 -1
- VERSION +1 -1
- api/main.py +4 -0
- api/routes_connectors.py +78 -1
- web/public/AIOS_DEPLOY_RECEIPT +1 -1
RELEASES.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
{
|
| 2 |
-
"current": "
|
| 3 |
"releases": []
|
| 4 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"current": "4645cb94f",
|
| 3 |
"releases": []
|
| 4 |
}
|
VERSION
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
4645cb94f
|
api/main.py
CHANGED
|
@@ -2393,6 +2393,10 @@ def _rebuild_odoo_relational(why, previous_meta_fingerprint=None, meta_state_out
|
|
| 2393 |
failure = (routes_connectors._odoo_failure(failed, "materialization")
|
| 2394 |
if failed else None)
|
| 2395 |
tables = report.get("tables") if isinstance(report.get("tables"), dict) else {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2396 |
database_receipts = report.get("databases")
|
| 2397 |
database_receipts = database_receipts if isinstance(database_receipts, dict) else {}
|
| 2398 |
canonical_receipts = report.get("canonicalDatabases")
|
|
|
|
| 2393 |
failure = (routes_connectors._odoo_failure(failed, "materialization")
|
| 2394 |
if failed else None)
|
| 2395 |
tables = report.get("tables") if isinstance(report.get("tables"), dict) else {}
|
| 2396 |
+
# A discovered model's clean pass is a per-database success too, or its old failure never clears.
|
| 2397 |
+
discovered = report.get("discovered") if isinstance(report.get("discovered"), dict) else {}
|
| 2398 |
+
if isinstance(discovered.get("tables"), dict):
|
| 2399 |
+
tables = {**discovered["tables"], **tables}
|
| 2400 |
database_receipts = report.get("databases")
|
| 2401 |
database_receipts = database_receipts if isinstance(database_receipts, dict) else {}
|
| 2402 |
canonical_receipts = report.get("canonicalDatabases")
|
api/routes_connectors.py
CHANGED
|
@@ -2162,7 +2162,81 @@ def _connection_jobs(rt, provider, connection_id):
|
|
| 2162 |
cid = str(connection_id or "").strip() or "default"
|
| 2163 |
if provider == "odoo" and cid == "default":
|
| 2164 |
cid = _odoo_connection_slot(rt, connection_id)
|
| 2165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2166 |
|
| 2167 |
|
| 2168 |
_PASS_STATES = {"running": "syncing", "continuing": "syncing", "done": "ready", "waiting": "ready",
|
|
@@ -3272,6 +3346,8 @@ def connector_sync_status(connector_key: str, connection_id: str = None,
|
|
| 3272 |
jobs = _connection_jobs(rt, connector_key, resolved_connection)
|
| 3273 |
row = (connector_sync.job_summary(jobs)
|
| 3274 |
or connector_sync.read(rt, connector_key, resolved_connection))
|
|
|
|
|
|
|
| 3275 |
# Odoo's lifecycle comes from its job receipts; the other connectors read C-status beside no row.
|
| 3276 |
answer = _sync_payload(connector_key, resolved_connection, row, rt=rt)
|
| 3277 |
if connector_key == "odoo":
|
|
@@ -3400,6 +3476,7 @@ def connector_database_jobs(connector_key: str, session: Session = Depends(requi
|
|
| 3400 |
payload = {"provider": connector_key, "jobs": connector_sync.jobs(
|
| 3401 |
session.runtime, connector_key, connection_id)}
|
| 3402 |
if connector_key == "odoo":
|
|
|
|
| 3403 |
payload["receipt"] = odoo_health_receipt(session.runtime, connection_id)
|
| 3404 |
return _safe_connector_status(connector_key, payload)
|
| 3405 |
|
|
|
|
| 2162 |
cid = str(connection_id or "").strip() or "default"
|
| 2163 |
if provider == "odoo" and cid == "default":
|
| 2164 |
cid = _odoo_connection_slot(rt, connection_id)
|
| 2165 |
+
receipts = connector_sync.jobs(rt, provider, cid)
|
| 2166 |
+
return _odoo_current_jobs(rt, receipts) if provider == "odoo" else receipts
|
| 2167 |
+
|
| 2168 |
+
|
| 2169 |
+
def _odoo_offered_labels(rt, cid):
|
| 2170 |
+
"""Enabled database keys this connection offers, with labels, or None when unreadable."""
|
| 2171 |
+
import odoo_relational as rel
|
| 2172 |
+
try:
|
| 2173 |
+
default = _odoo_connection_slot(rt, None)
|
| 2174 |
+
choices = rel.grid_choices(rt, None if cid in ("", "default", default) else cid)
|
| 2175 |
+
except Exception: # noqa: BLE001
|
| 2176 |
+
return None
|
| 2177 |
+
labels = {}
|
| 2178 |
+
for row in choices or ():
|
| 2179 |
+
if isinstance(row, dict) and row.get("enabled"):
|
| 2180 |
+
for key in (row.get("key"), row.get("baseKey")):
|
| 2181 |
+
if key:
|
| 2182 |
+
labels[str(key)] = str(row.get("label") or row.get("key"))
|
| 2183 |
+
return labels or None
|
| 2184 |
+
|
| 2185 |
+
|
| 2186 |
+
def _odoo_current_jobs(rt, jobs):
|
| 2187 |
+
"""Odoo receipts as the newest pass reads them, for every door that summarizes them.
|
| 2188 |
+
|
| 2189 |
+
A failure older than its own database's newest clean sync reads ready. A failure for a
|
| 2190 |
+
database the connection no longer offers drops. Every other failure stays failed, labelled.
|
| 2191 |
+
"""
|
| 2192 |
+
# A cached read keeps the route at one fresh health read; an older document only keeps a failure longer.
|
| 2193 |
+
try:
|
| 2194 |
+
document = rt.get(_ODOO_HEALTH_STATUS) or {}
|
| 2195 |
+
except Exception: # noqa: BLE001
|
| 2196 |
+
document = {}
|
| 2197 |
+
connections = document.get("connections") if isinstance(document, dict) else None
|
| 2198 |
+
connections = connections if isinstance(connections, dict) else {}
|
| 2199 |
+
offered, current = {}, []
|
| 2200 |
+
for job in jobs:
|
| 2201 |
+
if job.get("state") != "failed":
|
| 2202 |
+
current.append(job)
|
| 2203 |
+
continue
|
| 2204 |
+
cid, key = str(job.get("connectionId") or ""), str(job.get("databaseKey") or "")
|
| 2205 |
+
if cid not in offered:
|
| 2206 |
+
offered[cid] = _odoo_offered_labels(rt, cid)
|
| 2207 |
+
if offered[cid] is not None and key not in offered[cid]:
|
| 2208 |
+
continue
|
| 2209 |
+
database = ((connections.get(cid) or {}).get("databases") or {}).get(key)
|
| 2210 |
+
success = _odoo_receipt_success(database) if isinstance(database, dict) else None
|
| 2211 |
+
if _odoo_failure_is_current(job.get("at"), success):
|
| 2212 |
+
current.append({**job, "label": (offered[cid] or {}).get(key) or key})
|
| 2213 |
+
continue
|
| 2214 |
+
current.append({**job, "state": "ready", "error": "", "retryable": False,
|
| 2215 |
+
"at": _odoo_timestamp(success), "supersededFailureAt": job.get("at")})
|
| 2216 |
+
return current
|
| 2217 |
+
|
| 2218 |
+
|
| 2219 |
+
def _odoo_named_failures(row, jobs):
|
| 2220 |
+
"""Name each database that still fails, with its own time, on a failed sync row."""
|
| 2221 |
+
failed = [job for job in jobs if job.get("state") == "failed"]
|
| 2222 |
+
if not row or row.get("state") != "failed" or not failed:
|
| 2223 |
+
return row
|
| 2224 |
+
named = []
|
| 2225 |
+
for job in failed:
|
| 2226 |
+
stamp = _odoo_timestamp(job.get("at"))
|
| 2227 |
+
named.append({"databaseKey": job.get("databaseKey"), "label": job.get("label") or job.get("databaseKey"),
|
| 2228 |
+
"at": (datetime.fromtimestamp(stamp, timezone.utc).isoformat()
|
| 2229 |
+
if stamp is not None else None),
|
| 2230 |
+
"error": job.get("error") or ""})
|
| 2231 |
+
named.sort(key=lambda item: item["at"] or "", reverse=True)
|
| 2232 |
+
lines = []
|
| 2233 |
+
for item in named:
|
| 2234 |
+
cause = re.sub(r"^[a-z][a-z0-9_]*: ", "", item["error"])
|
| 2235 |
+
lines.append(f"{item['label']}: {cause}" if cause else f"{item['label']} did not sync.")
|
| 2236 |
+
others = [error for error in row.get("errors") or ()
|
| 2237 |
+
if error not in {item["error"] for item in named}]
|
| 2238 |
+
errors = lines + others
|
| 2239 |
+
return {**row, "failed": named, "errors": errors, "errorsTotal": len(errors)}
|
| 2240 |
|
| 2241 |
|
| 2242 |
_PASS_STATES = {"running": "syncing", "continuing": "syncing", "done": "ready", "waiting": "ready",
|
|
|
|
| 3346 |
jobs = _connection_jobs(rt, connector_key, resolved_connection)
|
| 3347 |
row = (connector_sync.job_summary(jobs)
|
| 3348 |
or connector_sync.read(rt, connector_key, resolved_connection))
|
| 3349 |
+
if connector_key == "odoo":
|
| 3350 |
+
row = _odoo_named_failures(row, jobs)
|
| 3351 |
# Odoo's lifecycle comes from its job receipts; the other connectors read C-status beside no row.
|
| 3352 |
answer = _sync_payload(connector_key, resolved_connection, row, rt=rt)
|
| 3353 |
if connector_key == "odoo":
|
|
|
|
| 3476 |
payload = {"provider": connector_key, "jobs": connector_sync.jobs(
|
| 3477 |
session.runtime, connector_key, connection_id)}
|
| 3478 |
if connector_key == "odoo":
|
| 3479 |
+
payload["jobs"] = _odoo_current_jobs(session.runtime, payload["jobs"])
|
| 3480 |
payload["receipt"] = odoo_health_receipt(session.runtime, connection_id)
|
| 3481 |
return _safe_connector_status(connector_key, payload)
|
| 3482 |
|
web/public/AIOS_DEPLOY_RECEIPT
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
747c21c582d2259434965f8d5487b2c9844d57256db977026d5598437c3492a0
|