FN-6098: add workspace file creation actions

Add workspace file and folder creation to the dashboard file browser.

- add dashboard API helpers and backend route support for creating workspace directories and empty files
- add New File and New Folder header actions in FileBrowser with dialog handling and responsive header styling
- cover create flows with FileBrowser and route tests and document the new browser actions

Files changed:
 docs/dashboard-guide.md                            |  1 +
 packages/dashboard/app/api/legacy.ts               | 29 ++++++-
 packages/dashboard/app/components/FileBrowser.css  | 32 ++++++++
 packages/dashboard/app/components/FileBrowser.tsx  | 75 ++++++++++++++----
 packages/dashboard/app/components/__tests__/FileBrowser.test.tsx  | 92 ++++++++++++++++++++++
 packages/dashboard/src/__tests__/routes-git.test.ts     | 55 +++++++++++++
 packages/dashboard/src/file-service.ts             | 69 +++++++++++++++-
 packages/dashboard/src/routes/README.md            |  8 +-
 packages/dashboard/src/routes/register-file-workspace-routes.ts   | 34 +++++++-
 9 files changed, 372 insertions(+), 23 deletions(-)

Fusion-Task-Id: FN-6098
Fusion-Task-Lineage: 9a2a1ca1-8b5d-4e95-ba76-e7166621c898
This commit is contained in:
gsxdsm
2026-06-09 11:28:50 -07:00
parent c98f27f525
commit 2e48e8627a
9 changed files with 372 additions and 23 deletions

View File

@@ -3242,12 +3242,37 @@ export function searchFiles(query: string, workspace?: string, projectId?: strin
return api<FileSearchResult>(`/files/search?${params.toString()}`);
}
// --- Workspace File Operations API (Copy, Move, Delete, Rename, Download) ---
// --- Workspace File Operations API (Create, Copy, Move, Delete, Rename, Download) ---
/** File operation response for copy/move/delete/rename operations */
/** File operation response for create/copy/move/delete/rename operations */
export interface FileOperationResponse {
success: true;
message?: string;
path?: string;
}
/** Create a directory within a workspace. */
export function createWorkspaceDirectory(workspace: string, dirPath: string, projectId?: string): Promise<FileOperationResponse> {
const query = new URLSearchParams({ workspace });
if (projectId) {
query.set("projectId", projectId);
}
return api<FileOperationResponse>(`/files/mkdir?${query.toString()}`, {
method: "POST",
body: JSON.stringify({ path: dirPath }),
});
}
/** Create an empty file within a workspace. */
export function createWorkspaceFile(workspace: string, filePath: string, projectId?: string): Promise<FileOperationResponse> {
const query = new URLSearchParams({ workspace });
if (projectId) {
query.set("projectId", projectId);
}
return api<FileOperationResponse>(`/files/${encodeURIComponent(filePath)}?${query.toString()}`, {
method: "POST",
body: JSON.stringify({ content: "" }),
});
}
/** Copy a file or directory to a new location within a workspace. */