Skip to content

Commit 13fcb9b

Browse files
committed
[FEATURE] example data for local testing
Start with 'npm run dev:fixtures' to get a test config + map data Signed-off-by: Michael Wyraz <michael@wyraz.de>
1 parent c5a930b commit 13fcb9b

5 files changed

Lines changed: 466 additions & 3 deletions

File tree

DEVELOPMENT.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313

1414
Hint: You can start a development server with `npm run dev`
1515

16+
### Local fixture mode
17+
18+
If you want to work against a committed local dummy dataset without touching `public/config.json`, use:
19+
20+
`npm run dev:fixtures`
21+
22+
This mode serves `dev-fixtures/config.json` as `/config.json` and `dev-fixtures/meshviewer.json` as `/fixtures/meshviewer.json` only in the Vite dev server. The files stay outside `public/` and are therefore not included in regular builds or release artifacts.
23+
24+
For timestamps in `dev-fixtures/meshviewer.json` you can use relative markers like `@now`, `@now-6d`, `@now-28h` or `@now-1w+2d`. They are expanded to ISO timestamps when the fixture endpoint is requested.
25+
1626
### Build and run using Docker
1727

1828
You have to copy `config.example.json` to `public/config.json`.

dev-fixtures/config.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"siteName": "Meshviewer Local Fixtures",
3+
"dataPath": ["/fixtures/"],
4+
"fixedCenter": [
5+
[52.54, 13.0],
6+
[52.48, 13.45]
7+
],
8+
"mapLayers": [
9+
{
10+
"name": "CartoDB",
11+
"url": "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
12+
"config": {
13+
"maxZoom": 22,
14+
"attribution": "&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, &copy; | <a href=\"https://carto.com/attribution\">CARTO</a>"
15+
}
16+
}
17+
]
18+
}

dev-fixtures/meshviewer.json

Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
{
2+
"timestamp": "@now",
3+
"nodes": [
4+
{
5+
"node_id": "021122334401",
6+
"hostname": "Sirius",
7+
"domain": "lab",
8+
"firstseen": "@now-6d",
9+
"lastseen": "@now",
10+
"is_online": true,
11+
"location": {
12+
"latitude": 52.5119,
13+
"longitude": 13.3041
14+
},
15+
"firmware": {
16+
"release": "1.0.0",
17+
"base": "openwrt"
18+
},
19+
"uptime": "@now-1d",
20+
"nproc": 1,
21+
"loadavg": 0.12,
22+
"memory_usage": 0.32,
23+
"model": "TP-Link Archer C7 v2",
24+
"clients": 4,
25+
"clients_wifi24": 2,
26+
"clients_wifi5": 1,
27+
"clients_other": 1,
28+
"is_gateway": false,
29+
"addresses": ["fd00::11", "10.0.0.11"],
30+
"gateway_nexthop": "021122334402",
31+
"gateway": "021122334402",
32+
"gateway6": "021122334402",
33+
"autoupdater": {
34+
"enabled": true,
35+
"branch": "stable"
36+
}
37+
},
38+
{
39+
"node_id": "021122334402",
40+
"hostname": "Vega",
41+
"domain": "lab",
42+
"firstseen": "@now-7d",
43+
"lastseen": "@now",
44+
"is_online": true,
45+
"location": {
46+
"latitude": 52.5127,
47+
"longitude": 13.3056
48+
},
49+
"firmware": {
50+
"release": "1.0.0",
51+
"base": "openwrt"
52+
},
53+
"uptime": "@now-2d",
54+
"nproc": 1,
55+
"loadavg": 0.2,
56+
"memory_usage": 0.28,
57+
"model": "Ubiquiti NanoStation M5",
58+
"clients": 3,
59+
"clients_wifi24": 1,
60+
"clients_wifi5": 2,
61+
"clients_other": 0,
62+
"is_gateway": true,
63+
"addresses": ["fd00::12", "10.0.0.12"],
64+
"gateway_nexthop": "021122334402",
65+
"gateway": "021122334402",
66+
"gateway6": "021122334402",
67+
"autoupdater": {
68+
"enabled": true,
69+
"branch": "stable"
70+
}
71+
},
72+
{
73+
"node_id": "021122334403",
74+
"hostname": "Arktur",
75+
"domain": "lab",
76+
"firstseen": "@now-38d",
77+
"lastseen": "@now",
78+
"is_online": true,
79+
"location": {
80+
"latitude": 52.5219,
81+
"longitude": 13.4132
82+
},
83+
"firmware": {
84+
"release": "1.0.0",
85+
"base": "openwrt"
86+
},
87+
"uptime": "@now-3d",
88+
"nproc": 1,
89+
"loadavg": 0.16,
90+
"memory_usage": 0.27,
91+
"model": "MikroTik hAP ac2",
92+
"clients": 6,
93+
"clients_wifi24": 2,
94+
"clients_wifi5": 3,
95+
"clients_other": 1,
96+
"is_gateway": true,
97+
"addresses": ["fd00::13", "10.0.0.13"],
98+
"gateway_nexthop": "021122334403",
99+
"gateway": "021122334403",
100+
"gateway6": "021122334403",
101+
"autoupdater": {
102+
"enabled": true,
103+
"branch": "stable"
104+
}
105+
},
106+
{
107+
"node_id": "021122334404",
108+
"hostname": "Aldebaran",
109+
"domain": "lab",
110+
"firstseen": "@now-39d",
111+
"lastseen": "@now",
112+
"is_online": true,
113+
"location": {
114+
"latitude": 52.5212,
115+
"longitude": 13.4148
116+
},
117+
"firmware": {
118+
"release": "1.0.0",
119+
"base": "openwrt"
120+
},
121+
"uptime": "@now-12h",
122+
"nproc": 1,
123+
"loadavg": 0.08,
124+
"memory_usage": 0.21,
125+
"model": "AVM FRITZ!Box 4040",
126+
"clients": 2,
127+
"clients_wifi24": 1,
128+
"clients_wifi5": 1,
129+
"clients_other": 0,
130+
"is_gateway": false,
131+
"addresses": ["fd00::14", "10.0.0.14"],
132+
"gateway_nexthop": "021122334403",
133+
"gateway": "021122334403",
134+
"gateway6": "021122334403",
135+
"autoupdater": {
136+
"enabled": true,
137+
"branch": "stable"
138+
}
139+
},
140+
{
141+
"node_id": "021122334405",
142+
"hostname": "Rigel",
143+
"domain": "lab",
144+
"firstseen": "@now-10d",
145+
"lastseen": "@now",
146+
"is_online": true,
147+
"location": {
148+
"latitude": 52.4987,
149+
"longitude": 13.4035
150+
},
151+
"firmware": {
152+
"release": "1.0.0",
153+
"base": "openwrt"
154+
},
155+
"uptime": "@now-4d",
156+
"nproc": 1,
157+
"loadavg": 0.24,
158+
"memory_usage": 0.31,
159+
"model": "TP-Link EAP225",
160+
"clients": 8,
161+
"clients_wifi24": 3,
162+
"clients_wifi5": 4,
163+
"clients_other": 1,
164+
"is_gateway": true,
165+
"addresses": ["fd00::15", "10.0.0.15"],
166+
"gateway_nexthop": "021122334405",
167+
"gateway": "021122334405",
168+
"gateway6": "021122334405",
169+
"autoupdater": {
170+
"enabled": true,
171+
"branch": "stable"
172+
}
173+
},
174+
{
175+
"node_id": "021122334406",
176+
"hostname": "Deneb",
177+
"domain": "lab",
178+
"firstseen": "@now-11d",
179+
"lastseen": "@now-28h",
180+
"is_online": false,
181+
"location": {
182+
"latitude": 52.5001,
183+
"longitude": 13.4067
184+
},
185+
"firmware": {
186+
"release": "1.0.0",
187+
"base": "openwrt"
188+
},
189+
"uptime": "@now-46h",
190+
"nproc": 1,
191+
"loadavg": 0.05,
192+
"memory_usage": 0.19,
193+
"model": "GL.iNet GL-B1300",
194+
"clients": 0,
195+
"clients_wifi24": 0,
196+
"clients_wifi5": 0,
197+
"clients_other": 0,
198+
"is_gateway": false,
199+
"addresses": ["fd00::16", "10.0.0.16"],
200+
"gateway_nexthop": "021122334405",
201+
"gateway": "021122334405",
202+
"gateway6": "021122334405",
203+
"autoupdater": {
204+
"enabled": false,
205+
"branch": "stable"
206+
}
207+
},
208+
{
209+
"node_id": "021122334407",
210+
"hostname": "Capella",
211+
"domain": "lab",
212+
"firstseen": "@now-12d",
213+
"lastseen": "@now-54h",
214+
"is_online": false,
215+
"location": {
216+
"latitude": 52.5074,
217+
"longitude": 13.3221
218+
},
219+
"firmware": {
220+
"release": "1.0.0",
221+
"base": "openwrt"
222+
},
223+
"uptime": "@now-62h",
224+
"nproc": 1,
225+
"loadavg": 0.03,
226+
"memory_usage": 0.17,
227+
"model": "Linksys EA8300",
228+
"clients": 0,
229+
"clients_wifi24": 0,
230+
"clients_wifi5": 0,
231+
"clients_other": 0,
232+
"is_gateway": false,
233+
"addresses": ["fd00::17", "10.0.0.17"],
234+
"gateway_nexthop": "021122334405",
235+
"gateway": "021122334405",
236+
"gateway6": "021122334405",
237+
"autoupdater": {
238+
"enabled": false,
239+
"branch": "stable"
240+
}
241+
},
242+
{
243+
"node_id": "021122334408",
244+
"hostname": "Antares",
245+
"domain": "lab",
246+
"firstseen": "@now-13d",
247+
"lastseen": "@now",
248+
"is_online": true,
249+
"location": {
250+
"latitude": 52.4995,
251+
"longitude": 13.4051
252+
},
253+
"firmware": {
254+
"release": "1.0.0",
255+
"base": "openwrt"
256+
},
257+
"uptime": "@now-36h",
258+
"nproc": 1,
259+
"loadavg": 0.14,
260+
"memory_usage": 0.26,
261+
"model": "CPE210 v3",
262+
"clients": 2,
263+
"clients_wifi24": 1,
264+
"clients_wifi5": 1,
265+
"clients_other": 0,
266+
"is_gateway": false,
267+
"addresses": ["fd00::18", "10.0.0.18"],
268+
"gateway_nexthop": "021122334405",
269+
"gateway": "021122334405",
270+
"gateway6": "021122334405",
271+
"autoupdater": {
272+
"enabled": true,
273+
"branch": "stable"
274+
}
275+
},
276+
{
277+
"node_id": "021122334409",
278+
"hostname": "Alderaan",
279+
"domain": "lab",
280+
"firstseen": "@now-120d",
281+
"lastseen": "@now-20d",
282+
"is_online": false,
283+
"location": {
284+
"latitude": 52.4892,
285+
"longitude": 13.3914
286+
},
287+
"firmware": {
288+
"release": "1.0.0",
289+
"base": "openwrt"
290+
},
291+
"uptime": "@now-24d",
292+
"nproc": 1,
293+
"loadavg": 0.01,
294+
"memory_usage": 0.15,
295+
"model": "Netgear EX6150",
296+
"clients": 0,
297+
"clients_wifi24": 0,
298+
"clients_wifi5": 0,
299+
"clients_other": 0,
300+
"is_gateway": false,
301+
"addresses": ["fd00::19", "10.0.0.19"],
302+
"gateway_nexthop": "021122334405",
303+
"gateway": "021122334405",
304+
"gateway6": "021122334405",
305+
"autoupdater": {
306+
"enabled": false,
307+
"branch": "stable"
308+
}
309+
}
310+
],
311+
"links": [
312+
{
313+
"type": "wifi24",
314+
"source": "021122334401",
315+
"target": "021122334402",
316+
"source_addr": "02:11:22:33:44:01",
317+
"target_addr": "02:11:22:33:44:02",
318+
"source_tq": 0.93,
319+
"target_tq": 0.91
320+
},
321+
{
322+
"type": "wifi24",
323+
"source": "021122334403",
324+
"target": "021122334404",
325+
"source_addr": "02:11:22:33:44:03",
326+
"target_addr": "02:11:22:33:44:04",
327+
"source_tq": 0.91,
328+
"target_tq": 0.89
329+
},
330+
{
331+
"type": "wifi5",
332+
"source": "021122334405",
333+
"target": "021122334408",
334+
"source_addr": "02:11:22:33:44:05",
335+
"target_addr": "02:11:22:33:44:08",
336+
"source_tq": 0.95,
337+
"target_tq": 0.93
338+
}
339+
]
340+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
},
6060
"scripts": {
6161
"dev": "vite",
62+
"dev:fixtures": "vite --mode fixtures",
6263
"build": "vite build",
6364
"preview": "vite preview",
6465
"lint": "npm run lint:prettier && npm run lint:eslint",

0 commit comments

Comments
 (0)