Skip to content

Commit dcc3f21

Browse files
authored
Merge pull request #622 from input-output-hk/ch1bo/revive-ui
Revive Leios visualization
2 parents cff63e1 + 8c04b78 commit dcc3f21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+7958
-15345
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
ui/public/traces/1xsummary.jsonl.gz filter=lfs diff=lfs merge=lfs -text
22
ui/public/traces/100xsummary.jsonl.gz filter=lfs diff=lfs merge=lfs -text
33
ui/public/traces/10xsummary.jsonl.gz filter=lfs diff=lfs merge=lfs -text
4+
ui/public/traces/example.jsonl.gz filter=lfs diff=lfs merge=lfs -text
5+
ui/public/traces/small-1txkbs-nocpu.jsonl.gz filter=lfs diff=lfs merge=lfs -text
6+
ui/public/traces/small-200txkbs-nocpu.jsonl.gz filter=lfs diff=lfs merge=lfs -text

.github/workflows/docs.yaml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,15 @@ jobs:
111111
fetch-depth: 2
112112

113113
- name: 🛠️ Setup Node.js
114-
uses: actions/setup-node@v4
115-
with:
116-
node-version: 22
117-
cache: "yarn"
118-
cache-dependency-path: ./ui/yarn.lock
114+
uses: actions/setup-node@v6
119115

120116
- name: 📦 Install dependencies
121117
working-directory: ui
122-
run: yarn install
118+
run: npm install
123119

124120
- name: 🏗️ Build visualizer
125121
working-directory: ui
126-
run: |
127-
yarn build
122+
run: npm run build
128123

129124
- name: 🚢 Upload visualizer static site
130125
id: upload_viz

nix/outputs.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ in
1919
pkgs.nodePackages.prettier
2020
];
2121
};
22+
23+
devShells.ui = import ../ui/shell.nix { inherit pkgs; };
2224
}
2325
]

ui/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ dist-ssr
2323
*.sln
2424
*.sw?
2525

26-
# files used for debugging
27-
public/traces/*.jsonl
26+
# Lots of data
27+
public/traces/*

ui/README.md

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,69 @@
1-
# Rust Simulation UI - Web App
1+
# Leios visualization UI
22

3-
This UI web app is designed to read and display simulation traces generated by
4-
the `sim-rs` project.
3+
User interface to display Leios traffic in traces produced by simulations,
4+
prototypes and node implementations.
55

6-
## Prerequisites
6+
## Getting started
77

8-
Before you can run the UI, ensure you have the following installed:
8+
Example traces are available via Git LFS. Fetch them first:
99

10-
- [Bun](https://bun.sh/) - A fast JavaScript runtime.
10+
```bash
11+
git lfs fetch
12+
git lfs checkout
13+
```
1114

12-
## Setup Instructions
15+
Install dependencies and build the project with:
1316

14-
1. **Install Bun**
17+
```bash
18+
npm install
19+
npm run build
20+
```
1521

16-
Follow the instructions on the [Bun website](https://bun.sh/) to install Bun
17-
on your system.
22+
Or run the development server with:
1823

19-
2. **Generate a Trace**
24+
```bash
25+
npm start
26+
```
2027

21-
Before running the UI, you need to prepare a scenario for it to visualize. Add the following to a file named `public/scenarios.json`:
28+
## Add a scenario from sim-rs
2229

23-
```json
24-
{
25-
"scenarios": [
26-
{
27-
"name": "My Scenario",
28-
"topology": "topologies/thousand.yaml",
29-
"duration": 30.0,
30-
"trace": "traces/myscenario.jsonl"
31-
}
32-
]
33-
}
34-
```
30+
To prepare a scenario to visualize, find or add the topology to the public directory, for example:
3531

36-
Now add that topology to the public directory:
32+
```sh
33+
mkdir -p public/topologies
34+
ln -sr ../sim-rs/test_data/small.yaml public/topologies/small.yaml
35+
```
3736

38-
```sh
39-
mkdir -p public/topologies
40-
cp ../sim-rs/test-data/thousand.yaml public/topologies
41-
```
37+
And generate a trace to visualize using the built `sim-rs`, for example using the CIP scenario:
4238

43-
And generate a trace to visualize from the `sim-rs` directory:
39+
```bash
40+
mkdir -p public/traces
41+
cat ../analysis/sims/cip/experiments/NA,0.200/config.yaml \
42+
| jq '."tx-start-time" = 20' > public/traces/config-200txkbs.json
43+
../sim-rs/target/release/sim-cli -p public/traces/config-200txkbs.json public/topologies/small.yaml public/traces/small-200txkbs.jsonl -s 120
44+
```
4445

45-
```bash
46-
mkdir -p ../ui/public/traces
47-
cargo run --release test_data/thousand.yaml ../ui/public/traces/myscenario.jsonl -s 30
48-
```
46+
You might want to filter out `Cpu` events (not visualized) and, in case you want to store it, use gzip and git lfs:
4947

50-
3. **Run the UI**
48+
```bash
49+
grep -v 'Cpu' < public/traces/small-200txkbs.jsonl > public/traces/small-200txkbs-nocpu.jsonl
50+
gzip public/traces/small-200txkbs-nocpu.jsonl
51+
git lfs track public/traces/small-200txkbs-nocpu.jsonl.gz
52+
```
5153

52-
With Bun installed and the trace generated, navigate to the UI project
53-
directory and start the development server:
54+
Then update `public/scenarios.json` accordingly:
5455

55-
```bash
56-
bun dev
57-
```
56+
```json
57+
{
58+
"scenarios": [
59+
{
60+
"name": "200 TxkB/s",
61+
"topology": "topologies/small.yaml",
62+
"duration": 120,
63+
"trace": "traces/small-200txkbs-nocpu.jsonl.gz"
64+
}
65+
]
66+
}
67+
```
5868

59-
This will launch the simulation in your browser.
60-
61-
## Additional Information
62-
63-
- Ensure that the path to the trace file (`output/messages.jsonl`) is correctly
64-
set in the UI project. This is typically defined in a utility file such as
65-
`ui/src/app/api/utils.ts`.
66-
67-
- If you encounter any issues, check the console for error messages and ensure
68-
all dependencies are correctly installed.
69+
Now add that

0 commit comments

Comments
 (0)