Skip to content

Latest commit

 

History

History

ui

Rust Simulation UI - Web App

This UI web app is designed to read and display simulation traces generated by the sim-rs project.

Prerequisites

Before you can run the UI, ensure you have the following installed:

  • Bun - A fast JavaScript runtime.

Setup Instructions

  1. Install Bun

    Follow the instructions on the Bun website to install Bun on your system.

  2. Generate a Trace

    Before running the UI, you need to prepare a scenario for it to visualize. Add the following to a file named public/scenarios.json:

    {
       "scenarios": [
          {
             "name": "My Scenario",
             "topology": "topologies/thousand.yaml",
             "duration": 30.0,
             "trace": "traces/myscenario.jsonl"
          }
       ]
    }

    Now add that topology to the public directory:

    mkdir -p public/topologies
    cp ../sim-rs/test-data/thousand.yaml public/topologies

    And generate a trace to visualize from the sim-rs directory:

    mkdir -p ../ui/public/traces
    cargo run --release test_data/thousand.yaml ../ui/public/traces/myscenario.jsonl -s 30
  3. Run the UI

    With Bun installed and the trace generated, navigate to the UI project directory and start the development server:

    bun dev

    This will launch the simulation in your browser.

Additional Information

  • Ensure that the path to the trace file (output/messages.jsonl) is correctly set in the UI project. This is typically defined in a utility file such as ui/src/app/api/utils.ts.

  • If you encounter any issues, check the console for error messages and ensure all dependencies are correctly installed.