feat: add file browsing functionality to IECPage for boot disk selection
This commit is contained in:
parent
3f7cc16ce1
commit
aadd29e554
|
|
@ -1,9 +1,14 @@
|
|||
import { useState } from 'react';
|
||||
import { FolderOpen } from 'lucide-react';
|
||||
import FileBrowser from './FileBrowser';
|
||||
|
||||
interface IECPageProps {
|
||||
config: any;
|
||||
setConfig: (config: any) => void;
|
||||
}
|
||||
|
||||
export default function IECPage({ config, setConfig }: IECPageProps) {
|
||||
const [showFileBrowser, setShowFileBrowser] = useState(false);
|
||||
const updateSetting = (path: string[], value: any) => {
|
||||
const newConfig = JSON.parse(JSON.stringify(config));
|
||||
let current = newConfig;
|
||||
|
|
@ -57,15 +62,35 @@ export default function IECPage({ config, setConfig }: IECPageProps) {
|
|||
|
||||
<div className="p-4">
|
||||
<label className="text-sm text-neutral-500 block mb-2">Boot Disk</label>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
type="text"
|
||||
value={iec.boot_disk || ''}
|
||||
onChange={(e) => updateSetting(['iec', 'boot_disk'], e.target.value)}
|
||||
className="w-full px-3 py-2 border border-neutral-300 rounded-lg"
|
||||
className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
|
||||
/>
|
||||
<button
|
||||
onClick={() => setShowFileBrowser(true)}
|
||||
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
|
||||
title="Browse files"
|
||||
>
|
||||
<FolderOpen className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showFileBrowser && (
|
||||
<FileBrowser
|
||||
currentPath={iec.boot_disk || '/'}
|
||||
onSelect={(path) => {
|
||||
updateSetting(['iec', 'boot_disk'], path);
|
||||
setShowFileBrowser(false);
|
||||
}}
|
||||
onClose={() => setShowFileBrowser(false)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h2 className="text-sm text-neutral-500 pt-4">Directory Settings</h2>
|
||||
|
||||
<div className="bg-white border border-neutral-200 rounded-lg divide-y divide-neutral-200">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user