update: dir tree

This commit is contained in:
tao.chen
2026-08-14 15:02:55 +08:00
parent 4530811441
commit 65d14b8610
6 changed files with 73 additions and 21 deletions
@@ -19,6 +19,7 @@ type TreeContextMenuProps = {
onChooseUpload: (parentPath: string) => void;
onRemoveDirectory: (path: string) => void;
onCopyResourcePath?: (jupyterPath: string) => void;
onRemoveResource?: (resourceId: string) => void;
onClose: () => void;
};
@@ -32,6 +33,7 @@ export function TreeContextMenu({
onChooseUpload,
onRemoveDirectory,
onCopyResourcePath,
onRemoveResource,
onClose,
}: TreeContextMenuProps) {
if (!contextMenu) return null;
@@ -55,19 +57,36 @@ export function TreeContextMenu({
{contextMenu.kind === "file" && contextMenu.script ? (
<>
{isDataResource ? (
<button
type="button"
role="menuitem"
onClick={() => {
if (onCopyResourcePath) {
onCopyResourcePath(contextMenu.script!.relative_path);
}
onClose();
}}
>
<Icon name="database" size={16} />
Jupyter
</button>
<>
<button
type="button"
role="menuitem"
onClick={() => {
if (onCopyResourcePath) {
onCopyResourcePath(contextMenu.script!.relative_path);
}
onClose();
}}
>
<Icon name="database" size={16} />
Jupyter
</button>
{onRemoveResource && (
<button
className="is-danger"
type="button"
role="menuitem"
onClick={() => {
const id = contextMenu.script!.script_id.replace(/^data:/, "");
onRemoveResource(id);
onClose();
}}
>
<Icon name="close" size={16} />
</button>
)}
</>
) : (
<>
<button