feat(cloud-console): task listing, attempt history, CORS, and console SPA
Implements the cloud-console OpenSpec change: adds GET /v1/tasks (filterable,
bounded pagination, tasks:read) and GET /v1/tasks/{id}/attempts (404 on unknown
task) to the platform SDK, with matching CloudClient methods and a closed-by-
default CLOUD_CONSOLE_CORS_ORIGINS allow-list wired through CloudControlConfig.
Ships an independent Vue 3 + Vite SPA at cloud-console/ that authenticates with
an operator-supplied bearer token held in sessionStorage, renders tasks with
attempt history, device pool, host registry, and the plugin registry with a
registration form.
Backend test suite: 438 passed (-m "not integration"); cloud-console typecheck
and production build both succeed. PostgreSQL-backed repository tests and
manual end-to-end verification remain pending external infrastructure.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -368,6 +368,36 @@ class SQLAlchemyCloudRepository:
|
||||
).all()
|
||||
return [_task_from_row(row) for row in rows]
|
||||
|
||||
def list_tasks(
|
||||
self,
|
||||
*,
|
||||
status: str | None = None,
|
||||
limit: int = 50,
|
||||
offset: int = 0,
|
||||
) -> list[Any]:
|
||||
with self._sessions() as session:
|
||||
statement = select(ScheduledTaskRow)
|
||||
if status is not None:
|
||||
statement = statement.where(ScheduledTaskRow.status == status)
|
||||
statement = (
|
||||
statement.order_by(
|
||||
ScheduledTaskRow.created_at.desc(),
|
||||
ScheduledTaskRow.id.desc(),
|
||||
)
|
||||
.limit(limit)
|
||||
.offset(offset)
|
||||
)
|
||||
rows = session.scalars(statement).all()
|
||||
return [_task_from_row(row) for row in rows]
|
||||
|
||||
def count_tasks(self, status: str | None = None) -> int:
|
||||
with self._sessions() as session:
|
||||
statement = select(func.count()).select_from(ScheduledTaskRow)
|
||||
if status is not None:
|
||||
statement = statement.where(ScheduledTaskRow.status == status)
|
||||
count = session.scalar(statement)
|
||||
return int(count or 0)
|
||||
|
||||
def get_task(self, task_id: str) -> Any | None:
|
||||
with self._sessions() as session:
|
||||
row = session.get(ScheduledTaskRow, task_id)
|
||||
|
||||
Reference in New Issue
Block a user