Rhai Engine Worker UI
A Yew-based WASM interface to monitor Rhai workers.
Prerequisites
- Rust: Install from rust-lang.org
- Trunk: Install with
cargo install trunk - A backend service providing the necessary API endpoints (see below).
Backend API Requirements
This UI expects a backend service to be running that can provide data from Redis. The UI will make requests to the following (example) endpoints:
GET /api/worker/{worker_name}/tasks_and_stats: Returns initialWorkerDataincluding a list ofTaskSummaryand initialQueueStats.WorkerData:{ "queue_stats": { "current_size": u32, "color_code": "string" }, "tasks": [TaskSummary] }TaskSummary:{ "hash": "string", "created_at": i64, "status": "string" }
GET /api/worker/{worker_name}/queue_stats: Returns currentQueueStatsfor polling.QueueStats:{ "current_size": u32, "color_code": "string" }
GET /api/task/{task_hash}: ReturnsTaskDetails.TaskDetails:{ "hash": "string", "created_at": i64, "status": "string", "script_content": "string", "result": "optional_string", "error": "optional_string" }
Note: The API endpoints are currently hardcoded with relative paths (e.g., /api/...). This assumes the backend API is served from the same host and port as the Trunk development server, or that a proxy is configured.
Development
- Navigate to the
rhai_engine_uidirectory:cd /Users/timurgordon/code/git.ourworld.tf/herocode/rhailib/rhai_engine_ui/ - Run the development server:
trunk serve --port 8081 - Open your browser to
http://127.0.0.1:8081.
Building for Release
trunk build --release
This will output static files to the dist directory.