fix: update tasks API endpoint and enhance FileListView props for selection change

This commit is contained in:
shiyu
2025-08-25 10:41:18 +08:00
parent 96541cba42
commit 130d3be7f9
3 changed files with 6 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ export type AutomationTaskUpdate = Partial<AutomationTaskCreate>;
export const tasksApi = {
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 }),
remove: (id: number) => request<void>(`/tasks/${id}`, { method: 'DELETE' }),
};

View File

@@ -29,7 +29,7 @@ const FileExplorerPage = memo(function FileExplorerPage() {
// --- Hooks ---
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 { appWindows, openFileWithDefaultApp, confirmOpenWithApp, closeWindow, toggleMax, bringToFront, updateWindow } = useAppWindows(path);
const { ctxMenu, blankCtxMenu, openContextMenu, openBlankContextMenu, closeContextMenus } = useContextMenu();
@@ -126,6 +126,7 @@ const FileExplorerPage = memo(function FileExplorerPage() {
loading={loading}
selectedEntries={selectedEntries}
onRowClick={(r, e) => handleSelect(r, e.ctrlKey || e.metaKey)}
onSelectionChange={setSelectedEntries}
onOpen={handleOpenEntry}
onOpenWith={(entry, appKey) => confirmOpenWithApp(entry, { key: appKey, name: '' } as any)}
onRename={setRenaming}

View File

@@ -10,6 +10,7 @@ interface FileListViewProps {
loading: boolean;
selectedEntries: string[];
onRowClick: (entry: VfsEntry, e: React.MouseEvent) => void;
onSelectionChange: (selectedKeys: string[]) => void;
onOpen: (entry: VfsEntry) => void;
onOpenWith: (entry: VfsEntry, appKey: string) => void;
onRename: (entry: VfsEntry) => void;
@@ -22,6 +23,7 @@ export const FileListView: React.FC<FileListViewProps> = ({
loading,
selectedEntries,
onRowClick,
onSelectionChange,
onOpen,
onOpenWith,
onRename,
@@ -99,8 +101,7 @@ export const FileListView: React.FC<FileListViewProps> = ({
rowClassName={(r) => selectedEntries.includes(r.name) ? 'row-selected' : ''}
rowSelection={{
selectedRowKeys: selectedEntries,
onChange: () => {
}
onChange: (keys) => onSelectionChange(keys as string[]),
}}
/>
);