Commit 5104952
committed
Add log level setting in UI
* This fixes modelcontextprotocol#188
* In App.tsx
- import LoggingLevel from sdk
- add [logLevel, setLogLevel] useState with value of type LoggingLevel initialized to "debug"
- add useEffect that stores the new logLevel in localStorage as "logLevel"
- added sendLogLevelRequest function that takes a level argument of type LoggingLevel and sends the appropriate request. It calls setLogLevel when done, to update the local UI
- pass logLevel and sendLogLevelRequest to Sidebar component as props
* In Sidebar.tsx
- Import LoggingLevel and LoggingLevelSchema from sdk
- add props and prop types for logLevel and sendLogLevelRequest and loggingSupported
- add Select component populated with the enum values of LoggingLevelSchema, shown only if loggingSupported is true and connectionStatus is "connected"
*1 parent cedf02d commit 5104952
2 files changed
+50
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
412 | 414 | | |
413 | 415 | | |
414 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
415 | 428 | | |
416 | 429 | | |
417 | 430 | | |
| |||
430 | 443 | | |
431 | 444 | | |
432 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
433 | 451 | | |
434 | 452 | | |
435 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
42 | 49 | | |
43 | 50 | | |
44 | 51 | | |
| |||
57 | 64 | | |
58 | 65 | | |
59 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| |||
290 | 300 | | |
291 | 301 | | |
292 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
293 | 325 | | |
294 | 326 | | |
295 | 327 | | |
| |||
0 commit comments