deleteDir
This commit is contained in:
parent
8789fee962
commit
2747a833dd
@ -2,7 +2,7 @@ import React from "react"
|
|||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { useContextMenu } from "react-contexify"
|
import { useContextMenu } from "react-contexify"
|
||||||
import uploadFile from "../functions/uploadFile"
|
import uploadFile from "../functions/uploadFile"
|
||||||
import { useCopyMutation, useCreateDirMutation, useDeleteFileMutation, useMoveMutation, useOpenDirQuery } from "../generated/graphql"
|
import { useCopyMutation, useCreateDirMutation, useDeleteDirMutation, useDeleteFileMutation, useMoveMutation, useOpenDirQuery } from "../generated/graphql"
|
||||||
import Breadcrum from "./Breadcrum"
|
import Breadcrum from "./Breadcrum"
|
||||||
import CreateDirButton from "./CreateDirButton"
|
import CreateDirButton from "./CreateDirButton"
|
||||||
import DragAndDrop from "./DragAndDrop"
|
import DragAndDrop from "./DragAndDrop"
|
||||||
@ -23,6 +23,7 @@ const FileBrowser: React.FC = () => {
|
|||||||
const [copyMutation] = useCopyMutation()
|
const [copyMutation] = useCopyMutation()
|
||||||
const [moveMutation] = useMoveMutation()
|
const [moveMutation] = useMoveMutation()
|
||||||
const [createDirMutation] = useCreateDirMutation()
|
const [createDirMutation] = useCreateDirMutation()
|
||||||
|
const [deleteDirMutation] = useDeleteDirMutation()
|
||||||
|
|
||||||
const { show: showFileContext } = useContextMenu({
|
const { show: showFileContext } = useContextMenu({
|
||||||
id: CONTEXT_MENU_FILE,
|
id: CONTEXT_MENU_FILE,
|
||||||
@ -89,6 +90,10 @@ const FileBrowser: React.FC = () => {
|
|||||||
refetchDir()
|
refetchDir()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case Action.DirDelete:
|
||||||
|
await deleteDirMutation({variables:{path:id}})
|
||||||
|
refetchDir()
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ export enum Action {
|
|||||||
FileDelete,
|
FileDelete,
|
||||||
FileCopy,
|
FileCopy,
|
||||||
FilePaste,
|
FilePaste,
|
||||||
FileMove
|
FileMove,
|
||||||
|
DirDelete
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -35,7 +36,7 @@ const FileBrowserContextMenu: React.FC<Props> = (props) => {
|
|||||||
<Item onClick={onClick} data={Action.FilePaste} disabled={!props.pasteActive}>Paste</Item>
|
<Item onClick={onClick} data={Action.FilePaste} disabled={!props.pasteActive}>Paste</Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Menu id={CONTEXT_MENU_DIR} animation={false}>
|
<Menu id={CONTEXT_MENU_DIR} animation={false}>
|
||||||
<Item onClick={onClick} >Item 1</Item>
|
<Item onClick={onClick} data={Action.DirDelete} >Delete</Item>
|
||||||
<Item onClick={onClick} >Item 2</Item>
|
<Item onClick={onClick} >Item 2</Item>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Item onClick={onClick} data={Action.FilePaste} disabled={!props.pasteActive}>Paste</Item>
|
<Item onClick={onClick} data={Action.FilePaste} disabled={!props.pasteActive}>Paste</Item>
|
||||||
|
Loading…
Reference in New Issue
Block a user