mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-09-05 23:57:19 +08:00
fix: update tasks API endpoint and enhance FileListView props for selection change
This commit is contained in:
@@ -16,7 +16,7 @@ export type AutomationTaskUpdate = Partial<AutomationTaskCreate>;
|
|||||||
|
|
||||||
export const tasksApi = {
|
export const tasksApi = {
|
||||||
list: () => request<AutomationTask[]>('/tasks/'),
|
list: () => request<AutomationTask[]>('/tasks/'),
|
||||||
create: (payload: AutomationTaskCreate) => request<AutomationTask>('/tasks', { method: 'POST', json: payload }),
|
create: (payload: AutomationTaskCreate) => request<AutomationTask>('/tasks/', { method: 'POST', json: payload }),
|
||||||
update: (id: number, payload: AutomationTaskUpdate) => request<AutomationTask>(`/tasks/${id}`, { method: 'PUT', json: payload }),
|
update: (id: number, payload: AutomationTaskUpdate) => request<AutomationTask>(`/tasks/${id}`, { method: 'PUT', json: payload }),
|
||||||
remove: (id: number) => request<void>(`/tasks/${id}`, { method: 'DELETE' }),
|
remove: (id: number) => request<void>(`/tasks/${id}`, { method: 'DELETE' }),
|
||||||
};
|
};
|
||||||
@@ -29,7 +29,7 @@ const FileExplorerPage = memo(function FileExplorerPage() {
|
|||||||
|
|
||||||
// --- Hooks ---
|
// --- Hooks ---
|
||||||
const { path, entries, loading, pagination, processorTypes, load, navigateTo, goUp, handlePaginationChange, refresh } = useFileExplorer(navKey);
|
const { path, entries, loading, pagination, processorTypes, load, navigateTo, goUp, handlePaginationChange, refresh } = useFileExplorer(navKey);
|
||||||
const { selectedEntries, handleSelect, handleSelectRange, clearSelection } = useFileSelection();
|
const { selectedEntries, handleSelect, handleSelectRange, clearSelection, setSelectedEntries } = useFileSelection();
|
||||||
const { uploading, fileInputRef, doCreateDir, doDelete, doRename, doDownload, doShare, handleUploadClick, handleFilesSelected } = useFileActions({ path, refresh, clearSelection, onShare: (entries) => setSharingEntries(entries) });
|
const { uploading, fileInputRef, doCreateDir, doDelete, doRename, doDownload, doShare, handleUploadClick, handleFilesSelected } = useFileActions({ path, refresh, clearSelection, onShare: (entries) => setSharingEntries(entries) });
|
||||||
const { appWindows, openFileWithDefaultApp, confirmOpenWithApp, closeWindow, toggleMax, bringToFront, updateWindow } = useAppWindows(path);
|
const { appWindows, openFileWithDefaultApp, confirmOpenWithApp, closeWindow, toggleMax, bringToFront, updateWindow } = useAppWindows(path);
|
||||||
const { ctxMenu, blankCtxMenu, openContextMenu, openBlankContextMenu, closeContextMenus } = useContextMenu();
|
const { ctxMenu, blankCtxMenu, openContextMenu, openBlankContextMenu, closeContextMenus } = useContextMenu();
|
||||||
@@ -126,6 +126,7 @@ const FileExplorerPage = memo(function FileExplorerPage() {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
selectedEntries={selectedEntries}
|
selectedEntries={selectedEntries}
|
||||||
onRowClick={(r, e) => handleSelect(r, e.ctrlKey || e.metaKey)}
|
onRowClick={(r, e) => handleSelect(r, e.ctrlKey || e.metaKey)}
|
||||||
|
onSelectionChange={setSelectedEntries}
|
||||||
onOpen={handleOpenEntry}
|
onOpen={handleOpenEntry}
|
||||||
onOpenWith={(entry, appKey) => confirmOpenWithApp(entry, { key: appKey, name: '' } as any)}
|
onOpenWith={(entry, appKey) => confirmOpenWithApp(entry, { key: appKey, name: '' } as any)}
|
||||||
onRename={setRenaming}
|
onRename={setRenaming}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ interface FileListViewProps {
|
|||||||
loading: boolean;
|
loading: boolean;
|
||||||
selectedEntries: string[];
|
selectedEntries: string[];
|
||||||
onRowClick: (entry: VfsEntry, e: React.MouseEvent) => void;
|
onRowClick: (entry: VfsEntry, e: React.MouseEvent) => void;
|
||||||
|
onSelectionChange: (selectedKeys: string[]) => void;
|
||||||
onOpen: (entry: VfsEntry) => void;
|
onOpen: (entry: VfsEntry) => void;
|
||||||
onOpenWith: (entry: VfsEntry, appKey: string) => void;
|
onOpenWith: (entry: VfsEntry, appKey: string) => void;
|
||||||
onRename: (entry: VfsEntry) => void;
|
onRename: (entry: VfsEntry) => void;
|
||||||
@@ -22,6 +23,7 @@ export const FileListView: React.FC<FileListViewProps> = ({
|
|||||||
loading,
|
loading,
|
||||||
selectedEntries,
|
selectedEntries,
|
||||||
onRowClick,
|
onRowClick,
|
||||||
|
onSelectionChange,
|
||||||
onOpen,
|
onOpen,
|
||||||
onOpenWith,
|
onOpenWith,
|
||||||
onRename,
|
onRename,
|
||||||
@@ -99,8 +101,7 @@ export const FileListView: React.FC<FileListViewProps> = ({
|
|||||||
rowClassName={(r) => selectedEntries.includes(r.name) ? 'row-selected' : ''}
|
rowClassName={(r) => selectedEntries.includes(r.name) ? 'row-selected' : ''}
|
||||||
rowSelection={{
|
rowSelection={{
|
||||||
selectedRowKeys: selectedEntries,
|
selectedRowKeys: selectedEntries,
|
||||||
onChange: () => {
|
onChange: (keys) => onSelectionChange(keys as string[]),
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user