Simulation Upload Update

This commit is contained in:
2026-02-21 22:21:05 -05:00
parent 4c24b141fe
commit 913f45b51b
20 changed files with 1479 additions and 492 deletions

View File

@@ -27,10 +27,10 @@ You can then access the interface at: [http://localhost:8080](http://localhost:8
If you prefer to run the system directly on your OS without Docker, you will need `Bun` and `Go` (with CGO enabled) installed.
### 1. Build the Frontend
Navigate to the root directory and use Bun to render the static HTML/JS payload.
Navigate to the root directory and use `npm` to install dependencies and build the static HTML/JS payload.
```bash
bun install
bun run build
npm install
npm run build
```
*(This produces a `build/` directory that the Go backend expects).*
@@ -52,18 +52,23 @@ Returns a JSON array of all indexed simulations, including their ID, name, creat
### `POST /api/simulations/create`
Creates a new simulation entry.
- **Request Body:** Raw text containing the YAML configuration block.
- **Behavior:** Checks if an identical config exists. If so, it returns the existing simulation ID/Name for overwriting. If not, it allocates a new `simulation_X` incrementally, inserts it into the database, builds the file directory in `../results`, and returns the new ID/Name.
- **Request Body:** JSON object containing the combined configurations (e.g., `search`, `uav`, `ugv`). The configuration *must* contain at least one search pattern definition (either `spiral`, `lawnmower`, or `levy`) inside the JSON.
- **Behavior:** Checks if an identical config exists. If so, it returns the existing simulation ID/Name for overwriting. If not, it allocates a new `simulation_X` incrementally, inserts it into the database, builds the file directory in `../results`, and returns the new ID/Name. Returns `400 Bad Request` if payload is not valid JSON or lacks a known search pattern.
- **Response:** JSON object `{"id": <int>, "name": <string>}`
### `GET /api/simulations/:id`
Provides detailed JSON metadata for a specific simulation ID, including its name, raw text config, creation timestamp, and a dynamically fetched array of all the internal resources (images, logs, videos) located within its folder.
Provides detailed JSON metadata for a specific simulation ID, including its name, JSON config string, creation timestamp, and a dynamically fetched array of all the internal resources (images, logs, videos) located within its folder.
### `PUT /api/simulations/:id/time`
Updates the numeric benchmarking metrics (`search_time` and `total_time`) for a specific simulation run.
- **Request Body:** JSON object containing floats: `{"search_time": 25.4, "total_time": 105.8}`
- **Response:** JSON object `{"status": "success"}`
### `PUT /api/simulations/:id/rename`
Renames a specific simulation. Automatically updates the database and physically renames the matching directory path on the system filesystem to mirror structural links.
- **Request Body:** JSON object containing the new underlying name: `{"name": "new_simulation_name"}`
- **Response:** JSON object `{"status": "success", "new_name": "new_simulation_name"}`
### `POST /api/simulations/:id/upload`
Uploads a new media or data resource file directly into a completed simulation run. Supports both images (e.g., PNGs) and heavy video files (e.g., AVIs) out of the box with an initial multi-part allocation pool mapping of 500 MB.
- **Request Data:** `multipart/form-data` packet using the `file` keyword carrying the binary data blocks.