88 */
99
1010import { useEffect , useState , useCallback } from 'react' ;
11+ import { open } from '@tauri-apps/plugin-dialog' ;
1112import {
1213 ChevronDown ,
1314 ChevronRight ,
@@ -17,6 +18,7 @@ import {
1718 Loader2 ,
1819 Clock ,
1920 FileJson ,
21+ FolderOpen ,
2022} from 'lucide-react' ;
2123import { ServerActionMenu } from './ServerActionMenu' ;
2224import type { ServerViewModel , ServerDefinition , InstalledServerState , InputDefinition } from '../../types/registry' ;
@@ -1338,16 +1340,67 @@ export function ServersPage() {
13381340 className = "input w-full"
13391341 />
13401342 ) ;
1341- case 'password ' :
1343+ case 'select ' :
13421344 return (
1343- < input
1344- type = "password"
1345+ < select
13451346 value = { currentValue }
13461347 onChange = { ( e ) => handleChange ( e . target . value ) }
1347- placeholder = { input . placeholder || `Enter ${ input . label . toLowerCase ( ) } ...` }
13481348 className = "input w-full"
13491349 data-testid = { `config-input-${ input . id } ` }
1350- />
1350+ >
1351+ < option value = "" > { input . placeholder || `Select ${ input . label . toLowerCase ( ) } ...` } </ option >
1352+ { ( input . options ?? [ ] ) . map ( ( opt ) => (
1353+ < option key = { opt . value } value = { opt . value } >
1354+ { opt . label }
1355+ </ option >
1356+ ) ) }
1357+ </ select >
1358+ ) ;
1359+ case 'file_path' :
1360+ return (
1361+ < div className = "flex gap-2" >
1362+ < input
1363+ type = "text"
1364+ value = { currentValue }
1365+ onChange = { ( e ) => handleChange ( e . target . value ) }
1366+ placeholder = { input . placeholder || 'Select a file...' }
1367+ className = "input w-full"
1368+ data-testid = { `config-input-${ input . id } ` }
1369+ />
1370+ < button
1371+ type = "button"
1372+ className = "btn btn-secondary shrink-0 px-2"
1373+ onClick = { async ( ) => {
1374+ const selected = await open ( { multiple : false } ) ;
1375+ if ( selected ) handleChange ( selected ) ;
1376+ } }
1377+ >
1378+ < FolderOpen className = "w-4 h-4" />
1379+ </ button >
1380+ </ div >
1381+ ) ;
1382+ case 'directory_path' :
1383+ return (
1384+ < div className = "flex gap-2" >
1385+ < input
1386+ type = "text"
1387+ value = { currentValue }
1388+ onChange = { ( e ) => handleChange ( e . target . value ) }
1389+ placeholder = { input . placeholder || 'Select a directory...' }
1390+ className = "input w-full"
1391+ data-testid = { `config-input-${ input . id } ` }
1392+ />
1393+ < button
1394+ type = "button"
1395+ className = "btn btn-secondary shrink-0 px-2"
1396+ onClick = { async ( ) => {
1397+ const selected = await open ( { directory : true } ) ;
1398+ if ( selected ) handleChange ( selected ) ;
1399+ } }
1400+ >
1401+ < FolderOpen className = "w-4 h-4" />
1402+ </ button >
1403+ </ div >
13511404 ) ;
13521405 case 'text' :
13531406 default :
0 commit comments