Skip to content

Commit 884a591

Browse files
committed
docs: add basic diagram & README
1 parent a689b2c commit 884a591

File tree

3 files changed

+212
-2
lines changed

3 files changed

+212
-2
lines changed

ui/README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
1-
# leios-visual
2-
Visualizations for Leios data.
1+
# Rust Simulation UI - Web App
2+
3+
This UI web app is designed to read and display simulation traces generated by
4+
the `sim-rs` project.
5+
6+
## Prerequisites
7+
8+
Before you can run the UI, ensure you have the following installed:
9+
10+
- [Bun](https://bun.sh/) - A fast JavaScript runtime.
11+
12+
## Setup Instructions
13+
14+
1. **Install Bun**
15+
16+
Follow the instructions on the [Bun website](https://bun.sh/) to install Bun
17+
on your system.
18+
19+
2. **Generate a Trace**
20+
21+
Before running the UI, you need to generate a trace using the `sim-rs`
22+
simulation. Navigate to the `sim-rs` directory and run the following command:
23+
24+
```bash
25+
cargo run --release test_data/thousand.toml output/messages.jsonl -s 30
26+
```
27+
28+
This command will generate a trace file at `output/messages.jsonl`.
29+
30+
3. **Run the UI**
31+
32+
With Bun installed and the trace generated, navigate to the UI project
33+
directory and start the development server:
34+
35+
```bash
36+
bun dev
37+
```
38+
39+
This will launch the simulation in your browser.
40+
41+
## Additional Information
42+
43+
- Ensure that the path to the trace file (`output/messages.jsonl`) is correctly
44+
set in the UI project. This is typically defined in a utility file such as
45+
`ui/src/app/api/utils.ts`.
46+
47+
- If you encounter any issues, check the console for error messages and ensure
48+
all dependencies are correctly installed.

ui/docs/component.d2

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
title: {
2+
label: "UI Web App - Component Diagram"
3+
near: top-center
4+
shape: text
5+
style.font-size: 24
6+
style.bold: true
7+
}
8+
9+
# Styles
10+
classes: {
11+
component: {
12+
style: {
13+
stroke: "#2a2a2a"
14+
fill: "#ffffff"
15+
font-color: "#2a2a2a"
16+
border-radius: 10
17+
shadow: true
18+
}
19+
}
20+
container: {
21+
style: {
22+
stroke: "#2a2a2a"
23+
fill: "#f5f5f5"
24+
font-color: "#2a2a2a"
25+
border-radius: 10
26+
shadow: true
27+
}
28+
}
29+
subcomponent: {
30+
style: {
31+
stroke: "#666666"
32+
fill: "#ffffff"
33+
font-color: "#2a2a2a"
34+
border-radius: 5
35+
shadow: false
36+
}
37+
}
38+
}
39+
40+
# Main Containers
41+
ui-app: {
42+
class: container
43+
label: "UI Web App"
44+
45+
frontend: {
46+
class: component
47+
label: "Frontend\n- React Components\n- State Management\n- UI Rendering"
48+
49+
components: {
50+
class: subcomponent
51+
label: "UI Components\n- Buttons\n- Charts\n- Tables"
52+
}
53+
54+
state: {
55+
class: subcomponent
56+
label: "State Management\n- Redux\n- Context API"
57+
}
58+
}
59+
60+
backend: {
61+
class: component
62+
label: "Backend API\n- Data Fetching\n- Trace Processing"
63+
64+
api_routes: {
65+
class: subcomponent
66+
label: "API Routes\n- /api/messages\n- /api/trace"
67+
}
68+
69+
data_processing: {
70+
class: subcomponent
71+
label: "Data Processing\n- JSON Parsing\n- Data Transformation"
72+
}
73+
}
74+
}
75+
76+
external-systems: {
77+
class: container
78+
label: "Rust Simulation"
79+
80+
sim-rs: {
81+
class: component
82+
label: "sim-rs\n- Trace Generation\n- Simulation Engine"
83+
}
84+
}
85+
86+
# Relationships
87+
ui-app.frontend -> ui-app.backend: "Fetches data from"
88+
ui-app.backend -> external-systems.sim-rs: "Reads trace data from"
89+
ui-app.frontend.components -> ui-app.frontend.state: "Uses for state management"
90+
ui-app.backend.api_routes -> ui-app.backend.data_processing: "Processes data for"

ui/docs/container.d2

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
title: {
2+
label: "UI Web App - Container Diagram"
3+
near: top-center
4+
shape: text
5+
style.font-size: 24
6+
style.bold: true
7+
}
8+
9+
# Styles
10+
classes: {
11+
container: {
12+
style: {
13+
stroke: "#2a2a2a"
14+
fill: "#f5f5f5"
15+
font-color: "#2a2a2a"
16+
border-radius: 10
17+
shadow: true
18+
}
19+
}
20+
component: {
21+
style: {
22+
stroke: "#2a2a2a"
23+
fill: "#ffffff"
24+
font-color: "#2a2a2a"
25+
border-radius: 10
26+
shadow: true
27+
}
28+
}
29+
external: {
30+
style: {
31+
stroke: "#666666"
32+
fill: "#e0e0e0"
33+
font-color: "#2a2a2a"
34+
border-radius: 5
35+
shadow: false
36+
}
37+
}
38+
}
39+
40+
# Main Containers
41+
ui-web-app: {
42+
class: container
43+
label: "UI Web App"
44+
45+
browser: {
46+
class: component
47+
label: "Web Browser\n- User Interface\n- Data Visualization"
48+
}
49+
50+
server: {
51+
class: component
52+
label: "Backend Server\n- API Endpoints\n- Data Processing"
53+
}
54+
}
55+
56+
external-systems: {
57+
class: container
58+
label: "Rust Simulation"
59+
60+
sim-rs: {
61+
class: external
62+
label: "sim-rs\n- Trace Generation"
63+
}
64+
65+
trace-file: {
66+
class: external
67+
label: "Trace File\n- messages.jsonl"
68+
}
69+
}
70+
71+
# Relationships
72+
ui-web-app.browser -> ui-web-app.server: "Requests data from"
73+
ui-web-app.server -> external-systems.trace-file: "Reads data from"
74+
external-systems.sim-rs -> external-systems.trace-file: "Generates"

0 commit comments

Comments
 (0)