diff --git a/src/app/App.tsx b/src/app/App.tsx index 6708012..c168a7a 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { Cpu, Settings, Wifi, Network, HardDrive, Activity, MoreHorizontal, Search, Wrench, User, LogOut, Bell, FileText, AppWindow, Folder, Edit, Eye, Database, Upload, Download, Code2, LayoutList, Image, ChevronLeft, Loader2, Check, AlertCircle, RefreshCw, Terminal, Link } from 'lucide-react'; +import { Cpu, Settings, Wifi, Network, HardDrive, Activity, MoreHorizontal, Search, Wrench, User, LogOut, Bell, FileText, AppWindow, Folder, Edit, Eye, Database, Upload, Download, Code2, LayoutList, Image, ChevronLeft, Loader2, Check, AlertCircle, RefreshCw, Terminal, Link, Printer } from 'lucide-react'; import { Toaster } from 'sonner'; import StatusPage from './components/StatusPage'; import DevicesPage from './components/DevicesPage'; @@ -17,6 +17,7 @@ type Page = 'status' | 'devices' | 'iec' | 'network' | 'other' | 'general' | 'to type AppId = | 'file-manager' + | 'print-manager' | 'serial-console' | 'directory-editor' | 'sector-editor' @@ -60,6 +61,7 @@ export default function App() {

Management

} label="File Manager" onClick={() => setCurrentPage('file-manager')} /> + } label="Print Manager" onClick={() => setCurrentPage('print-manager')} /> } label="Serial Console" onClick={() => setCurrentPage('serial-console')} /> } label="Short Codes" onClick={() => setCurrentPage('serial-console')} />
@@ -115,6 +117,13 @@ export default function App() { setConfig={setConfig} onNavigateToDevice={(id) => { setCurrentPage('devices'); setDevicesOpenId(id); }} />, + 'print-manager': setCurrentPage('apps')} + config={config} + setConfig={setConfig} + />, 'serial-console': setCurrentPage('apps')} />, 'directory-editor': setCurrentPage('apps')} />, 'sector-editor': setCurrentPage('apps')} />, diff --git a/src/app/components/FileManager.tsx b/src/app/components/FileManager.tsx index c922cdc..407e8dd 100644 --- a/src/app/components/FileManager.tsx +++ b/src/app/components/FileManager.tsx @@ -247,6 +247,8 @@ function EntryIcon({ entry }: { entry: EntryInfo }) { interface FileManagerProps { initialPath?: string; + rootPath?: string; + title?: string; config?: any; setConfig?: (c: any) => void; onBack?: () => void; @@ -303,8 +305,9 @@ async function _getEntryBytes(entry: EntryInfo): Promise { const FM_PATH_KEY = 'fileManager.path'; -export default function FileManager({ initialPath = '/', config, setConfig, onBack, onNavigateToDevice }: FileManagerProps) { - const [path, setPath] = useState(() => normalizePath(localStorage.getItem(FM_PATH_KEY) || initialPath)); +export default function FileManager({ initialPath = '/', rootPath, title, config, setConfig, onBack, onNavigateToDevice }: FileManagerProps) { + const pathKey = rootPath ? `fileManager.path:${rootPath}` : FM_PATH_KEY; + const [path, setPath] = useState(() => normalizePath(localStorage.getItem(pathKey) || rootPath || initialPath)); const [entries, setEntries] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); @@ -357,12 +360,13 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa useEffect(() => { localStorage.setItem('fileManager.sortAsc', String(sortAsc)); }, [sortAsc]); const navigateTo = (p: string) => { - const norm = normalizePath(p); - localStorage.setItem(FM_PATH_KEY, norm); + let norm = normalizePath(p); + if (rootPath && !norm.startsWith(rootPath)) norm = rootPath; + localStorage.setItem(pathKey, norm); setPath(norm); setFilter(''); }; - const navigateUp = () => { if (path !== '/') navigateTo(splitPath(path).parent); }; + const navigateUp = () => { if (path !== (rootPath ?? '/')) navigateTo(splitPath(path).parent); }; // ── Sort + filter ──────────────────────────────────────────────────────── @@ -674,7 +678,7 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa )} -

File Manager

+

{title ?? 'File Manager'}

@@ -689,7 +693,7 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa {/* Breadcrumb */}
- {pathParts.map((part, i) => (