Compare commits
25 Commits
120106bfbc
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d2f25ef04 | |||
| 9462a74437 | |||
| 1683c0d467 | |||
| 615292ac24 | |||
| 6bcb41820c | |||
| 6b8c922d5b | |||
| 91e75a2c72 | |||
| fd688021ea | |||
| fcb34aeacc | |||
| a287df5e0c | |||
| 9ca6770cd4 | |||
| 06b7c323ae | |||
| c12181fe16 | |||
| 9664eb07b8 | |||
| f38a34eb2a | |||
| 83c28a8d5e | |||
| f872bec629 | |||
| d4ff2d9480 | |||
| 3e8fbb01bb | |||
| dc4133a705 | |||
| 94ab5c3d8f | |||
| 4112fd795a | |||
| 02b43201b1 | |||
| cdae3cf570 | |||
| 881b7a30f8 |
@@ -10,7 +10,10 @@ generates:
|
|||||||
- "typescript"
|
- "typescript"
|
||||||
- "typescript-operations"
|
- "typescript-operations"
|
||||||
- "typescript-react-apollo"
|
- "typescript-react-apollo"
|
||||||
|
- add:
|
||||||
|
content: "import ObjID from './../types/ObjID'"
|
||||||
config:
|
config:
|
||||||
withHooks: true
|
withHooks: true
|
||||||
scalars:
|
scalars:
|
||||||
DateTime: string
|
DateTime: string
|
||||||
|
objID: ObjID
|
||||||
25
package.json
25
package.json
@@ -4,25 +4,14 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/client": "^3.3.21",
|
"@apollo/client": "^3.3.21",
|
||||||
"@testing-library/jest-dom": "^5.11.4",
|
|
||||||
"@testing-library/react": "^11.1.0",
|
|
||||||
"@testing-library/user-event": "^12.1.10",
|
|
||||||
"@types/jest": "^26.0.15",
|
|
||||||
"@types/node": "^12.0.0",
|
|
||||||
"@types/react": "^17.0.0",
|
|
||||||
"@types/react-dom": "^17.0.0",
|
|
||||||
"@types/react-router-dom": "^5.1.8",
|
|
||||||
"graphql": "^15.5.1",
|
"graphql": "^15.5.1",
|
||||||
"node-sass": "^6.0.1",
|
|
||||||
"prop-types": "^15.7.2",
|
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-contexify": "^5.0.0",
|
"react-contexify": "^5.0.0",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-icons": "^4.2.0",
|
"react-icons": "^4.2.0",
|
||||||
"react-router-dom": "^5.2.0",
|
"react-router-dom": "^5.2.0",
|
||||||
"react-scripts": "4.0.3",
|
"rooks": "^5.7.1",
|
||||||
"typescript": "^4.1.2",
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat"
|
||||||
"web-vitals": "^1.0.1"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "craco start",
|
"start": "craco start",
|
||||||
@@ -52,19 +41,27 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@craco/craco": "^6.2.0",
|
"@craco/craco": "^6.2.0",
|
||||||
|
"@graphql-codegen/add": "^3.1.0",
|
||||||
"@graphql-codegen/cli": "1.21.7",
|
"@graphql-codegen/cli": "1.21.7",
|
||||||
"@graphql-codegen/introspection": "1.18.2",
|
"@graphql-codegen/introspection": "1.18.2",
|
||||||
"@graphql-codegen/typescript": "^1.23.0",
|
"@graphql-codegen/typescript": "^1.23.0",
|
||||||
"@graphql-codegen/typescript-operations": "1.18.4",
|
"@graphql-codegen/typescript-operations": "1.18.4",
|
||||||
"@graphql-codegen/typescript-react-apollo": "2.3.1",
|
"@graphql-codegen/typescript-react-apollo": "2.3.1",
|
||||||
|
"@types/jest": "^26.0.15",
|
||||||
|
"@types/node": "^12.0.0",
|
||||||
|
"@types/react": "^17.0.0",
|
||||||
|
"@types/react-dom": "^17.0.0",
|
||||||
|
"@types/react-router-dom": "^5.1.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
||||||
"@typescript-eslint/parser": "^4.28.4",
|
"@typescript-eslint/parser": "^4.28.4",
|
||||||
"apollo": "^2.33.4",
|
"apollo": "^2.33.4",
|
||||||
"autoprefixer": "^9",
|
"autoprefixer": "^9",
|
||||||
"eslint": "^7.31.0",
|
"eslint": "^7.31.0",
|
||||||
"eslint-plugin-react": "^7.24.0",
|
"eslint-plugin-react": "^7.24.0",
|
||||||
|
"node-sass": "^6.0.1",
|
||||||
"postcss": "^7",
|
"postcss": "^7",
|
||||||
"tailwindcss": "npm:@tailwindcss/postcss7-compat"
|
"react-scripts": "4.0.3",
|
||||||
|
"typescript": "^4.1.2"
|
||||||
},
|
},
|
||||||
"proxy": "http://localhost:8080"
|
"proxy": "http://localhost:8080"
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/App.tsx
47
src/App.tsx
@@ -1,20 +1,57 @@
|
|||||||
import React from "react"
|
import React, { useState } from "react"
|
||||||
import FileBrowser from "./components/FileBrowser"
|
import FileBrowser from "./components/FileBrowser"
|
||||||
import { BrowserRouter as Router, Switch, Route, Redirect } from "react-router-dom"
|
import { BrowserRouter as Router, Switch, Route, Redirect } from "react-router-dom"
|
||||||
import NotFound from "./components/NotFound"
|
import NotFound from "./components/NotFound"
|
||||||
import Login from "./components/Login"
|
import Login from "./components/Login"
|
||||||
|
import { useIsAuthQuery } from "./generated/graphql"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
import BucketSelect from "./components/BucketSelect"
|
||||||
|
|
||||||
const App: React.FC = () => {
|
const App: React.FC = () => {
|
||||||
|
const { data } = useIsAuthQuery()
|
||||||
|
const [isAuth,setIsAuth] = useState(false)
|
||||||
|
const [ready,setReady] = useState(false)
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if (data){
|
||||||
|
setIsAuth(data.authorized)
|
||||||
|
setReady(true)
|
||||||
|
}
|
||||||
|
},[data])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dark:text-gray-300">
|
<div className="dark:text-gray-300 px-2 pt-1">
|
||||||
|
{
|
||||||
|
ready&&
|
||||||
<Router>
|
<Router>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/login" exact component={Login} />
|
{/* Private only routes */}
|
||||||
<Route path="/f/" component={FileBrowser}/>
|
{
|
||||||
<Redirect from="/" exact to="/f/" />
|
isAuth && [
|
||||||
|
<Route path="/f/" exact component={BucketSelect} key={null} />,
|
||||||
|
<Route path="/f/" component={FileBrowser} key={null} />,
|
||||||
|
<Redirect from="/" exact to="/f/" key={null} />,
|
||||||
|
<Redirect from="/login" exact to="/f/" key={null} />,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* Public only routes */}
|
||||||
|
{
|
||||||
|
!isAuth && [
|
||||||
|
<Route path="/login" exact key={null} >
|
||||||
|
<Login onLogin={()=>{
|
||||||
|
setIsAuth(true)
|
||||||
|
}} />
|
||||||
|
</Route>,
|
||||||
|
<Redirect from="*" to="/login" key={null} />
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* Public & private routes */}
|
||||||
<Route path="*" component={NotFound} />
|
<Route path="*" component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
55
src/Cache.ts
Normal file
55
src/Cache.ts
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import { InMemoryCache } from "@apollo/client"
|
||||||
|
import ObjID from "./types/ObjID"
|
||||||
|
|
||||||
|
const cache = new InMemoryCache({
|
||||||
|
typePolicies:{
|
||||||
|
File:{
|
||||||
|
fields:{
|
||||||
|
id:{
|
||||||
|
merge(_,incomming){
|
||||||
|
// HACK: i use the merge function to change the id from a string to ObjID object.
|
||||||
|
// afaik apollo does not yet support custom scalar types.
|
||||||
|
if (!incomming){
|
||||||
|
return incomming
|
||||||
|
}else if (incomming instanceof ObjID){
|
||||||
|
return incomming
|
||||||
|
}else{
|
||||||
|
return ObjID.fromString(incomming as string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Directory:{
|
||||||
|
fields:{
|
||||||
|
id:{
|
||||||
|
merge(_,incomming){
|
||||||
|
if (!incomming){
|
||||||
|
return incomming
|
||||||
|
}else if (incomming instanceof ObjID){
|
||||||
|
return incomming
|
||||||
|
}else{
|
||||||
|
return ObjID.fromString(incomming as string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Query: {
|
||||||
|
fields: {
|
||||||
|
files: {
|
||||||
|
merge(existing, incoming){
|
||||||
|
return incoming
|
||||||
|
}
|
||||||
|
},
|
||||||
|
directorys:{
|
||||||
|
merge(existing, incoming){
|
||||||
|
return incoming
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
export default cache
|
||||||
@@ -1,34 +1,55 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import ObjID from "../types/ObjID"
|
||||||
import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg"
|
import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg"
|
||||||
|
import { Link } from "react-router-dom"
|
||||||
|
|
||||||
interface Props{
|
interface Props{
|
||||||
path: string
|
path?: ObjID
|
||||||
onDirClick?: (path: string) => void
|
onDirClick?: (path: ObjID) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const Breadcrum: React.FC<Props> = (props) => {
|
const Breadcrum: React.FC<Props> = ({path,onDirClick}) => {
|
||||||
const parts = props.path.split("/").filter(e=>e.length > 0)
|
|
||||||
|
if (!path){
|
||||||
|
return <ul className="flex text-gray-500 dark:text-gray-400 text-lg ">
|
||||||
|
<div className="breadcrum-item text-blue-500">
|
||||||
|
<Link to="/f/">
|
||||||
|
Home
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
|
||||||
|
const keyParts = path.key.split("/").filter(e=>e.length > 0)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className="flex text-gray-500 dark:text-gray-400 text-lg">
|
<ul className="flex text-gray-500 dark:text-gray-400 text-lg ">
|
||||||
<li className="inline-flex items-center cursor-pointer">
|
<div className="breadcrum-item">
|
||||||
<a onClick={()=>{
|
<Link to="/f/">
|
||||||
props.onDirClick?.("/")
|
Home
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<div className="breadcrum-item">
|
||||||
|
<BreadcrumImage className="h-5 w-auto text-gray-400 cursor-default" />
|
||||||
|
<li>
|
||||||
|
<a className={!keyParts.length?"text-blue-500":""} onClick={()=>{
|
||||||
|
onDirClick?.(new ObjID(path.bucket,"/"))
|
||||||
}}>
|
}}>
|
||||||
Root
|
{path.bucket}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
</div>
|
||||||
|
|
||||||
{parts.map((e,i,arr)=>{
|
{keyParts.map((e,i,arr)=>{
|
||||||
const last = i == arr.length - 1
|
const last = i == arr.length - 1
|
||||||
return <div key={e} className="inline-flex items-center cursor-pointer">
|
return <div key={e} className="breadcrum-item">
|
||||||
<BreadcrumImage className="h-5 w-auto text-gray-400" />
|
<BreadcrumImage className="h-5 w-auto text-gray-400 cursor-default" />
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
className={`${last?"text-blue-500":""}`}
|
className={`${last?"text-blue-500":""}`}
|
||||||
onClick={()=>{
|
onClick={()=>{
|
||||||
if (!last){
|
if (!last){
|
||||||
props.onDirClick?.("/"+arr.slice(0,i-1).join("/"))
|
onDirClick?.(new ObjID(path.bucket,arr.slice(0,i+1).join("/")))
|
||||||
}
|
}
|
||||||
}}>{e}</a>
|
}}>{e}</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
35
src/components/BucketSelect.tsx
Normal file
35
src/components/BucketSelect.tsx
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import React from "react"
|
||||||
|
import { useHistory } from "react-router-dom"
|
||||||
|
import { useListBucktesQuery } from "../generated/graphql"
|
||||||
|
import Breadcrum from "./Breadcrum"
|
||||||
|
import MoreMenu from "./MoreMenu"
|
||||||
|
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
||||||
|
import Table, { Data } from "./Table"
|
||||||
|
|
||||||
|
const BucketSelect: React.FC = () => {
|
||||||
|
const history = useHistory()
|
||||||
|
const {data: buckets, loading} = useListBucktesQuery()
|
||||||
|
const tableData: Data = {
|
||||||
|
headers:[{name:"Bucket"}],
|
||||||
|
body:(!buckets?[]:buckets.buckets.map(e=>{return {cells:[{name:e||""}],onClick:()=>{history.push(`/f/${e}`)}}}))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="flex justify-between h-12">
|
||||||
|
<Breadcrum />
|
||||||
|
<div className="ml-auto">
|
||||||
|
<MoreMenu />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Table data={tableData}/>
|
||||||
|
{loading &&
|
||||||
|
<div className="flex justify-center mt-4">
|
||||||
|
<Spinner className="animate-spin h-6 w-6 dark:text-white" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BucketSelect
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import { Directory } from "../generated/graphql"
|
|
||||||
import { MdFolderOpen } from "react-icons/md"
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
dir: Directory
|
|
||||||
}
|
|
||||||
|
|
||||||
const DirectoryElement: React.FC<Props> = (props) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<td>
|
|
||||||
<MdFolderOpen className="inline"/> {props.dir.name}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default DirectoryElement
|
|
||||||
@@ -4,41 +4,28 @@ import { useContextMenu } from "react-contexify"
|
|||||||
import { RouteComponentProps } from "react-router-dom"
|
import { RouteComponentProps } from "react-router-dom"
|
||||||
import downloadFile from "../functions/downloadFile"
|
import downloadFile from "../functions/downloadFile"
|
||||||
import genDownloadLink from "../functions/genDownloadLink"
|
import genDownloadLink from "../functions/genDownloadLink"
|
||||||
import normalizeDirPath from "../functions/normalizeDirPath"
|
|
||||||
import uploadFile from "../functions/uploadFile"
|
import uploadFile from "../functions/uploadFile"
|
||||||
import { useCopyMutation, useCreateDirMutation, useDeleteDirMutation, useDeleteFileMutation, useMoveMutation, useOpenDirQuery } from "../generated/graphql"
|
import { useCopyMutation, useCreateDirMutation, useDeleteDirMutation, useDeleteFileMutation, useMoveDirMutation, 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 GlobalDragAndDrop from "./GlobalDragAndDrop"
|
||||||
import FileBrowserContextMenu, { Action, CONTEXT_MENU_DIR, CONTEXT_MENU_FILE } from "./FileBrowserContextMenu"
|
import FileBrowserContextMenu, { Action, CONTEXT_MENU_DIR, CONTEXT_MENU_FILE } from "./FileBrowserContextMenu"
|
||||||
import FileOpen from "./FileOpen"
|
import FileOpen from "./FileOpen"
|
||||||
import FileUploadButton from "./FileUploadButton"
|
import FileUploadButton from "./FileUploadButton"
|
||||||
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
||||||
import FileBrowserList from "./FileBrowserList"
|
import FileBrowserList from "./FileBrowserList"
|
||||||
import pathRename from "../functions/pathRename"
|
import MoreMenu from "./MoreMenu"
|
||||||
|
import ObjID from "../types/ObjID"
|
||||||
function uriToPath(pathname:string) {
|
import cache from "../Cache"
|
||||||
// strip the "/f" from e.g. "/f/dir1/dir2"
|
|
||||||
const path = pathname.substr(2)
|
|
||||||
if (!path.endsWith("/")){
|
|
||||||
return path + "/"
|
|
||||||
}
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
|
|
||||||
function pathToUri(path:string) {
|
|
||||||
return (path.startsWith("/")?"/f":"/f/") + path
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
||||||
const path = uriToPath(props.location.pathname)
|
const path = ObjID.fromURI(props.location.pathname)
|
||||||
|
const [openFileId, setOpenFileId] = useState<ObjID>()
|
||||||
const [openFileId, setOpenFileId] = useState("")
|
|
||||||
const [showFile, setShowFile] = useState(false)
|
const [showFile, setShowFile] = useState(false)
|
||||||
|
|
||||||
const [srcID,setSrcID] = useState("")
|
const [srcID,setSrcID] = useState<ObjID | null>()
|
||||||
const [pasteAction,setPasteAction] = useState<Action>()
|
const [pasteAction,setPasteAction] = useState<Action>()
|
||||||
const [editID,setEditID] = useState("")
|
const [editID,setEditID] = useState<ObjID>()
|
||||||
const [editEnable,setEditEnable] = useState(false)
|
const [editEnable,setEditEnable] = useState(false)
|
||||||
|
|
||||||
const [deleteMutation] = useDeleteFileMutation()
|
const [deleteMutation] = useDeleteFileMutation()
|
||||||
@@ -46,6 +33,7 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
const [moveMutation] = useMoveMutation()
|
const [moveMutation] = useMoveMutation()
|
||||||
const [createDirMutation] = useCreateDirMutation()
|
const [createDirMutation] = useCreateDirMutation()
|
||||||
const [deleteDirMutation] = useDeleteDirMutation()
|
const [deleteDirMutation] = useDeleteDirMutation()
|
||||||
|
const [moveDirMutation] = useMoveDirMutation()
|
||||||
|
|
||||||
const { show: showFileContext } = useContextMenu({
|
const { show: showFileContext } = useContextMenu({
|
||||||
id: CONTEXT_MENU_FILE,
|
id: CONTEXT_MENU_FILE,
|
||||||
@@ -57,7 +45,7 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
|
|
||||||
const { data, loading, refetch: refetchDir } = useOpenDirQuery({
|
const { data, loading, refetch: refetchDir } = useOpenDirQuery({
|
||||||
variables:{
|
variables:{
|
||||||
path
|
path: path
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -65,14 +53,14 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
const wait: Promise<boolean>[] = []
|
const wait: Promise<boolean>[] = []
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
const file = files[i]
|
const file = files[i]
|
||||||
wait.push(uploadFile(file, path + file.name))
|
wait.push(uploadFile(file, new ObjID(path.bucket,path.key + file.name)))
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(wait)
|
await Promise.all(wait)
|
||||||
refetchDir()
|
refetchDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onContextSelect(action:Action, id: string) {
|
async function onContextSelect(action:Action, id: ObjID) {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case Action.FileDelete:
|
case Action.FileDelete:
|
||||||
await deleteMutation({variables:{id}})
|
await deleteMutation({variables:{id}})
|
||||||
@@ -80,19 +68,33 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
break
|
break
|
||||||
case Action.FileCopy:
|
case Action.FileCopy:
|
||||||
case Action.FileMove:
|
case Action.FileMove:
|
||||||
|
case Action.DirMove:
|
||||||
setSrcID(id)
|
setSrcID(id)
|
||||||
setPasteAction(action)
|
setPasteAction(action)
|
||||||
break
|
break
|
||||||
case Action.FilePaste:
|
case Action.FilePaste:
|
||||||
if (pasteAction === Action.FileCopy){
|
if (pasteAction === Action.FileCopy && srcID){
|
||||||
await copyMutation({variables:{src:srcID,dest:path}})
|
await copyMutation({variables:{src:srcID,dest:path}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pasteAction === Action.FileMove){
|
if (pasteAction === Action.FileMove && srcID){
|
||||||
await moveMutation({variables:{src:srcID,dest:path}})
|
await moveMutation({variables:{src:srcID,dest:path}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
|
setSrcID(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pasteAction === Action.DirMove && srcID){
|
||||||
|
await moveDirMutation({variables:{src:srcID,dest:path}})
|
||||||
|
refetchDir()
|
||||||
|
|
||||||
|
cache.evict({
|
||||||
|
id: `Directory:${srcID.toString()}` // TODO: check for a better way to generate cache ids
|
||||||
|
})
|
||||||
|
|
||||||
|
setSrcID(null)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
case Action.DirDelete:
|
case Action.DirDelete:
|
||||||
await deleteDirMutation({variables:{path:id}})
|
await deleteDirMutation({variables:{path:id}})
|
||||||
@@ -116,20 +118,19 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
onSelect={onContextSelect}
|
onSelect={onContextSelect}
|
||||||
pasteActive={!!srcID}
|
pasteActive={!!srcID}
|
||||||
/>
|
/>
|
||||||
<DragAndDrop
|
<GlobalDragAndDrop
|
||||||
handleDrop={async (files)=>{
|
handleDrop={async (files)=>{
|
||||||
await handleDrop(files)
|
await handleDrop(files)
|
||||||
}}
|
}}/>
|
||||||
>
|
<div className="flex justify-between h-12">
|
||||||
<div className="flex justify-between">
|
|
||||||
<Breadcrum path={path} onDirClick={(newPath)=>{
|
<Breadcrum path={path} onDirClick={(newPath)=>{
|
||||||
props.history.push(pathToUri(newPath))
|
props.history.push(newPath.toURI())
|
||||||
}}/>
|
}}/>
|
||||||
<div className="ml-auto">
|
<div className="ml-auto">
|
||||||
<CreateDirButton
|
<CreateDirButton
|
||||||
onPressed={async (dirName)=>{
|
onPressed={async (dirName)=>{
|
||||||
const fullPath = normalizeDirPath(path + dirName)
|
const dirID = new ObjID(path.bucket,path.key + dirName + "/")
|
||||||
await createDirMutation({variables:{path: fullPath}})
|
await createDirMutation({variables:{path: dirID}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -139,15 +140,18 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
onUpload={(files)=>handleDrop(files)}
|
onUpload={(files)=>handleDrop(files)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<MoreMenu />
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<FileBrowserList
|
<FileBrowserList
|
||||||
directorys={data?.directorys || []}
|
directorys={data?.directories || []}
|
||||||
files={data?.files || []}
|
files={data?.files || []}
|
||||||
|
|
||||||
onDirClick={(e,path)=>{
|
onDirClick={(e,path)=>{
|
||||||
props.history.push(pathToUri(path))
|
props.history.push(path.toURI())
|
||||||
}}
|
}}
|
||||||
|
|
||||||
onDirContext={(e,path)=>{
|
onDirContext={(e,path)=>{
|
||||||
@@ -175,7 +179,7 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
// TODO: input check & error handling
|
// TODO: input check & error handling
|
||||||
await moveMutation({variables:{
|
await moveMutation({variables:{
|
||||||
src:id,
|
src:id,
|
||||||
dest: pathRename(id,newName)
|
dest: id.rename(newName)
|
||||||
}})
|
}})
|
||||||
refetchDir()
|
refetchDir()
|
||||||
}
|
}
|
||||||
@@ -190,7 +194,6 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
|
|||||||
<FileOpen id={openFileId} show={showFile} onCloseClick={()=>{
|
<FileOpen id={openFileId} show={showFile} onCloseClick={()=>{
|
||||||
setShowFile(false)
|
setShowFile(false)
|
||||||
}} />
|
}} />
|
||||||
</DragAndDrop>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Item, ItemParams, Menu, Separator } from "react-contexify"
|
import { Item, ItemParams, Menu, Separator } from "react-contexify"
|
||||||
|
import ObjID from "../types/ObjID"
|
||||||
|
|
||||||
export const CONTEXT_MENU_FILE = "CONTEXT_MENU_FILE"
|
export const CONTEXT_MENU_FILE = "CONTEXT_MENU_FILE"
|
||||||
export const CONTEXT_MENU_DIR = "CONTEXT_MENU_DIR"
|
export const CONTEXT_MENU_DIR = "CONTEXT_MENU_DIR"
|
||||||
@@ -12,16 +12,17 @@ export enum Action {
|
|||||||
FileMove,
|
FileMove,
|
||||||
FileDownload,
|
FileDownload,
|
||||||
FileRename,
|
FileRename,
|
||||||
DirDelete
|
DirDelete,
|
||||||
|
DirMove,
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onSelect?: (action: Action, id: string)=>void
|
onSelect?: (action: Action, id: ObjID)=>void
|
||||||
pasteActive?: boolean
|
pasteActive?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileBrowserContextMenu: React.FC<Props> = (props) => {
|
const FileBrowserContextMenu: React.FC<Props> = (props) => {
|
||||||
function onClick({ props: itemProps, data }: ItemParams<{id:string}, Action>) {
|
function onClick({ props: itemProps, data }: ItemParams<{id:ObjID}, Action>) {
|
||||||
if (itemProps?.id && data != null){
|
if (itemProps?.id && data != null){
|
||||||
props.onSelect?.(data,itemProps.id)
|
props.onSelect?.(data,itemProps.id)
|
||||||
}
|
}
|
||||||
@@ -40,7 +41,7 @@ const FileBrowserContextMenu: React.FC<Props> = (props) => {
|
|||||||
</Menu>
|
</Menu>
|
||||||
<Menu id={CONTEXT_MENU_DIR} animation={false} className="dark:bg-gray-400">
|
<Menu id={CONTEXT_MENU_DIR} animation={false} className="dark:bg-gray-400">
|
||||||
<Item onClick={onClick} data={Action.DirDelete} >Delete</Item>
|
<Item onClick={onClick} data={Action.DirDelete} >Delete</Item>
|
||||||
<Item onClick={onClick} >Item 2</Item>
|
<Item onClick={onClick} data={Action.DirMove} >Move</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>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import { Directory, File } from "../generated/graphql"
|
|
||||||
import DirectoryComponent from "./DirectoryElement"
|
|
||||||
import FileElement from "./FileElement"
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
file?: File
|
|
||||||
dir?: Directory
|
|
||||||
onClick?: (event: React.MouseEvent ,data: File | Directory) => void
|
|
||||||
onContextMenu?: (e:React.MouseEvent) => void
|
|
||||||
edit: boolean
|
|
||||||
onRename?: (newName: string)=>void
|
|
||||||
onCancleRename?: ()=>void
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileBrowserElement: React.FC<Props> = (props) => {
|
|
||||||
return (
|
|
||||||
<tr
|
|
||||||
className="hover:bg-gray-100 dark:hover:bg-gray-900 text-lg"
|
|
||||||
onClick={(e)=>{
|
|
||||||
if(props.file){
|
|
||||||
props.onClick?.(e,props.file)
|
|
||||||
}else if(props.dir){
|
|
||||||
props.onClick?.(e,props.dir)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
|
|
||||||
onContextMenu={(e)=>props.onContextMenu?.(e)}
|
|
||||||
|
|
||||||
>
|
|
||||||
{(props.file) ? <FileElement
|
|
||||||
edit={props.edit}
|
|
||||||
file={props.file}
|
|
||||||
onCancleRename={props.onCancleRename}
|
|
||||||
onRename={props.onRename}
|
|
||||||
/>:(props.dir)?<DirectoryComponent
|
|
||||||
dir={props.dir}
|
|
||||||
/>:<></>}
|
|
||||||
</tr>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default FileBrowserElement
|
|
||||||
@@ -1,80 +1,80 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
|
import { FaRegFileAlt } from "react-icons/fa"
|
||||||
|
import { MdFolderOpen } from "react-icons/md"
|
||||||
|
import dateFormat from "../functions/dateFomat"
|
||||||
|
import sizeToReadable from "../functions/sizeToReadable"
|
||||||
import { Directory, File } from "../generated/graphql"
|
import { Directory, File } from "../generated/graphql"
|
||||||
import FileBrowserElement from "./FileBrowserElement"
|
import ObjID from "../types/ObjID"
|
||||||
|
import Renameable from "./Renameable"
|
||||||
|
import Table, { Data, Row } from "./Table"
|
||||||
|
|
||||||
interface Props{
|
interface Props{
|
||||||
directorys: Directory[]
|
directorys: Directory[]
|
||||||
files: File[]
|
files: File[]
|
||||||
|
|
||||||
onFileContext?: (event: React.MouseEvent, id: string)=>void
|
onFileContext?: (event: React.MouseEvent, id: ObjID)=>void
|
||||||
onDirContext?: (event: React.MouseEvent, path: string)=>void
|
onDirContext?: (event: React.MouseEvent, path: ObjID)=>void
|
||||||
onFileClick?: (event: React.MouseEvent,id: string)=>void
|
onFileClick?: (event: React.MouseEvent,id: ObjID)=>void
|
||||||
onDirClick?: (event: React.MouseEvent,path: string)=>void
|
onDirClick?: (event: React.MouseEvent,path: ObjID)=>void
|
||||||
|
|
||||||
editId: string
|
editId?: ObjID
|
||||||
editEnable: boolean
|
editEnable: boolean
|
||||||
onRenameDone?: (id: string, changed: boolean, newName: string)=>void
|
onRenameDone?: (id: ObjID, changed: boolean, newName: string)=>void
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileBrowserList: React.FC<Props> = (props) => {
|
const FileBrowserList: React.FC<Props> = ({
|
||||||
return <>
|
files,directorys,onDirClick,onDirContext,onFileClick,onFileContext,onRenameDone,editId,editEnable
|
||||||
<table className="w-full">
|
}) => {
|
||||||
<thead className="border-b-2 dark:border-gray-900">
|
|
||||||
<tr>
|
|
||||||
<th className="text-left">Name</th>
|
|
||||||
<th className="text-left">Last Modified</th>
|
|
||||||
<th className="text-left">Size</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody className="divide-y dark:divide-gray-900">
|
|
||||||
{ props.directorys.map(v => (<FileBrowserElement
|
|
||||||
key={v.id}
|
|
||||||
dir={v}
|
|
||||||
onClick={(e,dir)=>{
|
|
||||||
props.onDirClick?.(e,dir.id)
|
|
||||||
}}
|
|
||||||
onContextMenu={(e)=>{
|
|
||||||
props.onDirContext?.(e,v.id)
|
|
||||||
}}
|
|
||||||
|
|
||||||
edit={props.editEnable && (v.id === props.editId)}
|
const tableData: Data = {
|
||||||
|
headers: [
|
||||||
|
{name: "Name"},
|
||||||
|
{name: "Last Modified"},
|
||||||
|
{name: "Size"}
|
||||||
|
],
|
||||||
|
body:[
|
||||||
|
...directorys.map((e):Row<Directory>=>{return {
|
||||||
|
cells:[
|
||||||
|
{
|
||||||
|
name:e.name || "",
|
||||||
|
component: <div>
|
||||||
|
<MdFolderOpen className="inline" />
|
||||||
|
<Renameable
|
||||||
|
text={e.name || ""}
|
||||||
|
edit={editEnable && (e.id === editId)}
|
||||||
|
onRename={(newName)=>{e.name != newName?onRenameDone?.(e.id,true,newName):onRenameDone?.(e.id,false,newName)}}
|
||||||
|
onCancleRename={()=>onRenameDone?.(e.id,false,"")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
}],
|
||||||
|
data: e,
|
||||||
|
onClick: ((e,data)=>onDirClick?.(e,data.id)),
|
||||||
|
onContextMenu: ((e,data)=>onDirContext?.(e,data.id))
|
||||||
|
}}),
|
||||||
|
...files.map((e):Row<File>=>{return {
|
||||||
|
cells:[
|
||||||
|
{
|
||||||
|
name:e.name || "",
|
||||||
|
component: <div>
|
||||||
|
<FaRegFileAlt className="inline" />
|
||||||
|
<Renameable
|
||||||
|
text={e.name || ""}
|
||||||
|
edit={editEnable && (e.id === editId)}
|
||||||
|
onRename={(newName)=>{e.name != newName?onRenameDone?.(e.id,true,newName):onRenameDone?.(e.id,false,newName)}}
|
||||||
|
onCancleRename={()=>onRenameDone?.(e.id,false,"")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
},
|
||||||
|
{name:dateFormat(e.lastModified)},{name:sizeToReadable(e.size)}],
|
||||||
|
data: e,
|
||||||
|
onClick: ((e,data)=>onFileClick?.(e,data.id)),
|
||||||
|
onContextMenu: ((e,data)=>onFileContext?.(e,data.id))
|
||||||
|
}}),
|
||||||
|
],
|
||||||
|
|
||||||
onRename={(newName)=>{
|
|
||||||
if (v.name != newName){
|
|
||||||
props.onRenameDone?.(v.id,true,newName)
|
|
||||||
}else{
|
|
||||||
props.onRenameDone?.(v.id,false,newName)
|
|
||||||
}
|
}
|
||||||
}}
|
|
||||||
|
|
||||||
onCancleRename={()=>props.onRenameDone?.(v.id,false,"")}
|
return <Table data={tableData} />
|
||||||
/>))}
|
|
||||||
|
|
||||||
{ props.files.map(v => (<FileBrowserElement
|
|
||||||
key={v.id}
|
|
||||||
file={v}
|
|
||||||
onClick={(e,file)=>{
|
|
||||||
props.onFileClick?.(e,file.id)
|
|
||||||
}}
|
|
||||||
onContextMenu={(e)=>{
|
|
||||||
props.onFileContext?.(e,v.id)
|
|
||||||
}}
|
|
||||||
|
|
||||||
edit={props.editEnable && (v.id === props.editId)}
|
|
||||||
|
|
||||||
onRename={(newName)=>{
|
|
||||||
if (v.name != newName){
|
|
||||||
props.onRenameDone?.(v.id,true,newName)
|
|
||||||
}else{
|
|
||||||
props.onRenameDone?.(v.id,false,newName)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
|
|
||||||
onCancleRename={()=>props.onRenameDone?.(v.id,false,"")}
|
|
||||||
/>))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default FileBrowserList
|
export default FileBrowserList
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
import React from "react"
|
|
||||||
import { File } from "../generated/graphql"
|
|
||||||
import sizeToReadable from "../functions/sizeToReadable"
|
|
||||||
import dateFormat from "../functions/dateFomat"
|
|
||||||
import { FaRegFileAlt } from "react-icons/fa"
|
|
||||||
import Renameable from "./Renameable"
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
file: File,
|
|
||||||
edit: boolean
|
|
||||||
onRename?: (newName: string)=>void
|
|
||||||
onCancleRename?: ()=>void
|
|
||||||
}
|
|
||||||
|
|
||||||
const FileElement: React.FC<Props> = (props) => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<td>
|
|
||||||
<FaRegFileAlt className="inline" />
|
|
||||||
<Renameable
|
|
||||||
text={props.file.name || ""}
|
|
||||||
edit={props.edit}
|
|
||||||
onCancleRename={props.onCancleRename}
|
|
||||||
onRename={props.onRename}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{dateFormat(props.file.lastModified)}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{sizeToReadable(props.file.size)}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default FileElement
|
|
||||||
@@ -4,9 +4,10 @@ import ImageOpener from "./ImageOpener"
|
|||||||
import TextOpener from "./TextOpener"
|
import TextOpener from "./TextOpener"
|
||||||
import Modal from "./Modal"
|
import Modal from "./Modal"
|
||||||
import AudioOpener from "./AudioOpener"
|
import AudioOpener from "./AudioOpener"
|
||||||
|
import ObjID from "../types/ObjID"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
id: string
|
id?: ObjID
|
||||||
show: boolean
|
show: boolean
|
||||||
onCloseClick?: ()=>void
|
onCloseClick?: ()=>void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,10 @@ interface Props {
|
|||||||
handleDrop?: (files: FileList)=>void
|
handleDrop?: (files: FileList)=>void
|
||||||
}
|
}
|
||||||
|
|
||||||
const DragAndDrop: React.FC<Props> = (props) => {
|
const GlobalDragAndDrop: React.FC<Props> = (props) => {
|
||||||
const dropRef = React.createRef<HTMLDivElement>()
|
|
||||||
const [hover,setHover] = useState(false)
|
const [hover,setHover] = useState(false)
|
||||||
|
|
||||||
function handleDragEnter(event: DragEvent) {
|
function handleDragEnter(event: DragEvent) {
|
||||||
// console.debug("dragenter",event)
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
setHover(true)
|
setHover(true)
|
||||||
@@ -23,7 +21,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDragLeave(event: DragEvent) {
|
function handleDragLeave(event: DragEvent) {
|
||||||
// console.debug("dragleave",event)
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
setHover(false)
|
setHover(false)
|
||||||
@@ -38,7 +35,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDrop(event: DragEvent) {
|
function handleDrop(event: DragEvent) {
|
||||||
console.debug("drop",event)
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
setHover(false)
|
setHover(false)
|
||||||
@@ -49,31 +45,25 @@ const DragAndDrop: React.FC<Props> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(dropRef.current){
|
document.addEventListener("dragenter",handleDragEnter)
|
||||||
dropRef.current.addEventListener("dragenter",handleDragEnter)
|
document.addEventListener("dragleave",handleDragLeave)
|
||||||
dropRef.current.addEventListener("dragleave",handleDragLeave)
|
document.addEventListener("dragover",handleDragOver)
|
||||||
dropRef.current.addEventListener("dragover",handleDragOver)
|
document.addEventListener("drop",handleDrop)
|
||||||
dropRef.current.addEventListener("drop",handleDrop)
|
|
||||||
|
|
||||||
return ()=>{
|
return ()=>{
|
||||||
if (dropRef.current){
|
document.removeEventListener("dragenter",handleDragEnter)
|
||||||
dropRef.current.removeEventListener("dragenter",handleDragEnter)
|
document.removeEventListener("dragleave",handleDragLeave)
|
||||||
dropRef.current.removeEventListener("dragleave",handleDragLeave)
|
document.removeEventListener("dragover",handleDragOver)
|
||||||
dropRef.current.removeEventListener("dragover",handleDragOver)
|
document.removeEventListener("drop",handleDrop)
|
||||||
dropRef.current.removeEventListener("drop",handleDrop)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={dropRef}
|
<div className={`fixed top-0 left-0 w-full h-full z-10 pointer-events-none
|
||||||
className={`fixed top-0 left-0 w-full h-full z-10
|
${hover? "border-dashed border-gray-600 border-4":""}`} />
|
||||||
${hover? "border-dashed border-gray-600 border-4":""}`}
|
|
||||||
>
|
|
||||||
{props.children}
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default DragAndDrop
|
export default GlobalDragAndDrop
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { RouteComponentProps } from "react-router-dom"
|
import { useHistory } from "react-router-dom"
|
||||||
import { useLoginMutation } from "../generated/graphql"
|
import { useLoginMutation } from "../generated/graphql"
|
||||||
|
|
||||||
const Login: React.FC<RouteComponentProps> = (props) => {
|
interface Props {
|
||||||
|
onLogin?: ()=>void
|
||||||
|
}
|
||||||
|
|
||||||
|
const Login: React.FC<Props> = (props) => {
|
||||||
|
|
||||||
|
const history = useHistory()
|
||||||
|
|
||||||
const [username,setUsername] = useState("")
|
const [username,setUsername] = useState("")
|
||||||
const [password,setPassword] = useState("")
|
const [password,setPassword] = useState("")
|
||||||
|
|
||||||
@@ -41,7 +48,8 @@ const Login: React.FC<RouteComponentProps> = (props) => {
|
|||||||
|
|
||||||
if (response.ok){
|
if (response.ok){
|
||||||
// Login successful
|
// Login successful
|
||||||
props.history.push("/f/")
|
props.onLogin?.()
|
||||||
|
history.push("/f/")
|
||||||
}else{
|
}else{
|
||||||
setLoginFailed(true)
|
setLoginFailed(true)
|
||||||
}
|
}
|
||||||
|
|||||||
56
src/components/MoreMenu.tsx
Normal file
56
src/components/MoreMenu.tsx
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
import React from "react"
|
||||||
|
import { useState } from "react"
|
||||||
|
import { MdMoreVert } from "react-icons/md"
|
||||||
|
import { useHistory } from "react-router-dom"
|
||||||
|
import { useOutsideClickRef } from "rooks"
|
||||||
|
import logout from "../functions/logout"
|
||||||
|
import MoreMenuEntry from "./MoreMenuEntry"
|
||||||
|
|
||||||
|
const MoreMenu: React.FC = () => {
|
||||||
|
const [showMenu,setShowMenu] = useState(false)
|
||||||
|
const history = useHistory()
|
||||||
|
|
||||||
|
const [outsideRef] = useOutsideClickRef(()=>{
|
||||||
|
setShowMenu(false)
|
||||||
|
})
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<button
|
||||||
|
onClick={()=>{
|
||||||
|
setShowMenu(!showMenu)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdMoreVert size="40"/>
|
||||||
|
</button>
|
||||||
|
<div className="" ref={outsideRef} >
|
||||||
|
{
|
||||||
|
showMenu && (
|
||||||
|
<div className="absolute -ml-32 bg-white dark:bg-gray-800 p-2 border-2 dark:border-gray-900">
|
||||||
|
{/* TODO: there has got to be a better way than "w-36" */}
|
||||||
|
<div className="w-36">
|
||||||
|
<ul>
|
||||||
|
<MoreMenuEntry>
|
||||||
|
Menu 1
|
||||||
|
</MoreMenuEntry>
|
||||||
|
<MoreMenuEntry>
|
||||||
|
Menu 2
|
||||||
|
</MoreMenuEntry>
|
||||||
|
<MoreMenuEntry
|
||||||
|
onclick={async ()=>{
|
||||||
|
setShowMenu(false)
|
||||||
|
await logout()
|
||||||
|
history.push("/login")
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Logout
|
||||||
|
</MoreMenuEntry>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MoreMenu
|
||||||
18
src/components/MoreMenuEntry.tsx
Normal file
18
src/components/MoreMenuEntry.tsx
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
onclick?: ()=>void
|
||||||
|
}
|
||||||
|
|
||||||
|
const MoreMenuEntry: React.FC<Props> = (props) => {
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
className="py-2 px-2 hover:bg-gray-100 dark:hover:bg-gray-900 cursor-pointer text-xl"
|
||||||
|
onClick={props.onclick}
|
||||||
|
>
|
||||||
|
{props.children}
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MoreMenuEntry
|
||||||
61
src/components/Table.tsx
Normal file
61
src/components/Table.tsx
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
export interface Header {
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
export interface Row<T = any> {
|
||||||
|
cells: Cell[]
|
||||||
|
data?: T,
|
||||||
|
// TODO: maybe there is some TS magic to apply here so that rowData has the same type as data without using generics
|
||||||
|
onClick?: (e: React.MouseEvent, rowData: T ) => void
|
||||||
|
onContextMenu?: (e: React.MouseEvent, data: T)=>void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Cell {
|
||||||
|
name: string
|
||||||
|
component?: React.ReactNode
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Data {
|
||||||
|
headers: Header[]
|
||||||
|
body: Row[]
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: Data
|
||||||
|
}
|
||||||
|
|
||||||
|
const Table: React.FC<Props> = ({data:{headers,body}}) => {
|
||||||
|
const numCol = headers.length
|
||||||
|
return (
|
||||||
|
<table className="w-full">
|
||||||
|
<thead className="border-b-2 dark:border-gray-900">
|
||||||
|
<tr>
|
||||||
|
{headers.map((e,i)=><th key={i} className="text-left">{e.name}</th>)}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y dark:divide-gray-900">
|
||||||
|
{body.map((row,rowIndex)=>
|
||||||
|
<tr
|
||||||
|
className="hover:bg-gray-100 dark:hover:bg-gray-900 text-lg"
|
||||||
|
key={rowIndex}
|
||||||
|
onClick={e=>row.onClick?.(e,row.data)}
|
||||||
|
onContextMenu={e=>row.onContextMenu?.(e,row.data)}
|
||||||
|
>
|
||||||
|
{(row.cells.length >= numCol?
|
||||||
|
row.cells:
|
||||||
|
row.cells.concat(Array(numCol - row.cells.length).fill({name:""}))) // Pad array to fit numCol
|
||||||
|
.map((cell,cellIndex)=>
|
||||||
|
<td key={cellIndex}>
|
||||||
|
{cell.component || cell.name}
|
||||||
|
</td>
|
||||||
|
)}
|
||||||
|
</tr>)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Table
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
function genDownloadLink(id:string): string {
|
import ObjID from "../types/ObjID"
|
||||||
return `/api/file?id=${encodeURIComponent(id)}`
|
|
||||||
|
function genDownloadLink(id:ObjID): string {
|
||||||
|
return `/api/file?id=${encodeURIComponent(id.toString())}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default genDownloadLink
|
export default genDownloadLink
|
||||||
|
|||||||
7
src/functions/logout.ts
Normal file
7
src/functions/logout.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
async function logout(): Promise<void> {
|
||||||
|
await fetch("/api/logout",{
|
||||||
|
method:"POST"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default logout
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
function pathRename(id:string, newFilename: string): string {
|
|
||||||
const isDir = id.endsWith("/")
|
|
||||||
const parts = id.split("/")
|
|
||||||
if (!parts.length)
|
|
||||||
throw new Error("Maleformed id")
|
|
||||||
parts[parts.length - (isDir?2:1)] = newFilename
|
|
||||||
|
|
||||||
return parts.join("/")
|
|
||||||
}
|
|
||||||
|
|
||||||
export default pathRename
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
async function uploadFile(file:File,id: string): Promise<boolean> {
|
import ObjID from "../types/ObjID"
|
||||||
const res = await fetch(`/api/file?${new URLSearchParams({id:id}).toString()}`,{
|
|
||||||
|
async function uploadFile(file:File,id: ObjID): Promise<boolean> {
|
||||||
|
const res = await fetch(`/api/file?${new URLSearchParams({id:id.toString()}).toString()}`,{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": file.type
|
"Content-Type": file.type
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import ObjID from "./../types/ObjID"
|
||||||
import { gql } from "@apollo/client"
|
import { gql } from "@apollo/client"
|
||||||
import * as Apollo from "@apollo/client"
|
import * as Apollo from "@apollo/client"
|
||||||
export type Maybe<T> = T | null;
|
export type Maybe<T> = T | null;
|
||||||
@@ -14,6 +15,11 @@ export type Scalars = {
|
|||||||
Float: number;
|
Float: number;
|
||||||
/** DateTime is a DateTime in ISO 8601 format */
|
/** DateTime is a DateTime in ISO 8601 format */
|
||||||
DateTime: string;
|
DateTime: string;
|
||||||
|
/**
|
||||||
|
* String representing a bucket, key and version combination.
|
||||||
|
* Looks like this: "bucketName:/name/of/key" or "bucketName@version:/name/of/key"
|
||||||
|
*/
|
||||||
|
objID: ObjID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -22,7 +28,7 @@ export type Directory = {
|
|||||||
__typename?: "Directory";
|
__typename?: "Directory";
|
||||||
directorys?: Maybe<Array<Maybe<Directory>>>;
|
directorys?: Maybe<Array<Maybe<Directory>>>;
|
||||||
files?: Maybe<Array<Maybe<File>>>;
|
files?: Maybe<Array<Maybe<File>>>;
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
name?: Maybe<Scalars["String"]>;
|
name?: Maybe<Scalars["String"]>;
|
||||||
parent?: Maybe<Directory>;
|
parent?: Maybe<Directory>;
|
||||||
};
|
};
|
||||||
@@ -33,7 +39,7 @@ export type File = {
|
|||||||
contentType?: Maybe<Scalars["String"]>;
|
contentType?: Maybe<Scalars["String"]>;
|
||||||
etag?: Maybe<Scalars["String"]>;
|
etag?: Maybe<Scalars["String"]>;
|
||||||
/** The uniqe ID of the file. Represents the path and the s3 key. */
|
/** The uniqe ID of the file. Represents the path and the s3 key. */
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
lastModified?: Maybe<Scalars["DateTime"]>;
|
lastModified?: Maybe<Scalars["DateTime"]>;
|
||||||
name?: Maybe<Scalars["String"]>;
|
name?: Maybe<Scalars["String"]>;
|
||||||
parent?: Maybe<Directory>;
|
parent?: Maybe<Directory>;
|
||||||
@@ -56,28 +62,29 @@ export type RootMutation = {
|
|||||||
delete?: Maybe<Scalars["String"]>;
|
delete?: Maybe<Scalars["String"]>;
|
||||||
deleteDir: Scalars["String"];
|
deleteDir: Scalars["String"];
|
||||||
login: LoginResut;
|
login: LoginResut;
|
||||||
move?: Maybe<File>;
|
move: File;
|
||||||
|
moveDir: Array<Maybe<File>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootMutationCopyArgs = {
|
export type RootMutationCopyArgs = {
|
||||||
src: Scalars["ID"];
|
src: Scalars["objID"];
|
||||||
dest: Scalars["ID"];
|
dest: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootMutationCreateDirArgs = {
|
export type RootMutationCreateDirArgs = {
|
||||||
path: Scalars["ID"];
|
path: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootMutationDeleteArgs = {
|
export type RootMutationDeleteArgs = {
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootMutationDeleteDirArgs = {
|
export type RootMutationDeleteDirArgs = {
|
||||||
path: Scalars["ID"];
|
path: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -88,35 +95,46 @@ export type RootMutationLoginArgs = {
|
|||||||
|
|
||||||
|
|
||||||
export type RootMutationMoveArgs = {
|
export type RootMutationMoveArgs = {
|
||||||
src: Scalars["ID"];
|
src: Scalars["objID"];
|
||||||
dest: Scalars["ID"];
|
dest: Scalars["objID"];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type RootMutationMoveDirArgs = {
|
||||||
|
src: Scalars["objID"];
|
||||||
|
dest: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RootQuery = {
|
export type RootQuery = {
|
||||||
__typename?: "RootQuery";
|
__typename?: "RootQuery";
|
||||||
directorys: Array<Directory>;
|
/** True if the user is authorized */
|
||||||
|
authorized: Scalars["Boolean"];
|
||||||
|
/** List available buckets */
|
||||||
|
buckets: Array<Maybe<Scalars["String"]>>;
|
||||||
|
directories: Array<Directory>;
|
||||||
file?: Maybe<File>;
|
file?: Maybe<File>;
|
||||||
files: Array<File>;
|
files: Array<File>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootQueryDirectorysArgs = {
|
export type RootQueryDirectoriesArgs = {
|
||||||
path: Scalars["String"];
|
path: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootQueryFileArgs = {
|
export type RootQueryFileArgs = {
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type RootQueryFilesArgs = {
|
export type RootQueryFilesArgs = {
|
||||||
path: Scalars["String"];
|
path: Scalars["objID"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export type CopyMutationVariables = Exact<{
|
export type CopyMutationVariables = Exact<{
|
||||||
src: Scalars["ID"];
|
src: Scalars["objID"];
|
||||||
dest: Scalars["ID"];
|
dest: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -129,7 +147,7 @@ export type CopyMutation = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export type CreateDirMutationVariables = Exact<{
|
export type CreateDirMutationVariables = Exact<{
|
||||||
path: Scalars["ID"];
|
path: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +160,7 @@ export type CreateDirMutation = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export type DeleteDirMutationVariables = Exact<{
|
export type DeleteDirMutationVariables = Exact<{
|
||||||
path: Scalars["ID"];
|
path: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +170,7 @@ export type DeleteDirMutation = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export type DeleteFileMutationVariables = Exact<{
|
export type DeleteFileMutationVariables = Exact<{
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +180,7 @@ export type DeleteFileMutation = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export type GetFileQueryVariables = Exact<{
|
export type GetFileQueryVariables = Exact<{
|
||||||
id: Scalars["ID"];
|
id: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -174,6 +192,22 @@ export type GetFileQuery = (
|
|||||||
)> }
|
)> }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export type IsAuthQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type IsAuthQuery = (
|
||||||
|
{ __typename?: "RootQuery" }
|
||||||
|
& Pick<RootQuery, "authorized">
|
||||||
|
);
|
||||||
|
|
||||||
|
export type ListBucktesQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type ListBucktesQuery = (
|
||||||
|
{ __typename?: "RootQuery" }
|
||||||
|
& Pick<RootQuery, "buckets">
|
||||||
|
);
|
||||||
|
|
||||||
export type LoginMutationVariables = Exact<{
|
export type LoginMutationVariables = Exact<{
|
||||||
username: Scalars["String"];
|
username: Scalars["String"];
|
||||||
password: Scalars["String"];
|
password: Scalars["String"];
|
||||||
@@ -189,21 +223,35 @@ export type LoginMutation = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export type MoveMutationVariables = Exact<{
|
export type MoveMutationVariables = Exact<{
|
||||||
src: Scalars["ID"];
|
src: Scalars["objID"];
|
||||||
dest: Scalars["ID"];
|
dest: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type MoveMutation = (
|
export type MoveMutation = (
|
||||||
{ __typename?: "RootMutation" }
|
{ __typename?: "RootMutation" }
|
||||||
& { move?: Maybe<(
|
& { move: (
|
||||||
{ __typename?: "File" }
|
{ __typename?: "File" }
|
||||||
& Pick<File, "id">
|
& Pick<File, "id">
|
||||||
)> }
|
) }
|
||||||
|
);
|
||||||
|
|
||||||
|
export type MoveDirMutationVariables = Exact<{
|
||||||
|
src: Scalars["objID"];
|
||||||
|
dest: Scalars["objID"];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type MoveDirMutation = (
|
||||||
|
{ __typename?: "RootMutation" }
|
||||||
|
& { moveDir: Array<Maybe<(
|
||||||
|
{ __typename?: "File" }
|
||||||
|
& Pick<File, "id">
|
||||||
|
)>> }
|
||||||
);
|
);
|
||||||
|
|
||||||
export type OpenDirQueryVariables = Exact<{
|
export type OpenDirQueryVariables = Exact<{
|
||||||
path: Scalars["String"];
|
path: Scalars["objID"];
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
|
|
||||||
@@ -212,7 +260,7 @@ export type OpenDirQuery = (
|
|||||||
& { files: Array<(
|
& { files: Array<(
|
||||||
{ __typename?: "File" }
|
{ __typename?: "File" }
|
||||||
& Pick<File, "id" | "name" | "size" | "lastModified">
|
& Pick<File, "id" | "name" | "size" | "lastModified">
|
||||||
)>, directorys: Array<(
|
)>, directories: Array<(
|
||||||
{ __typename?: "Directory" }
|
{ __typename?: "Directory" }
|
||||||
& Pick<Directory, "id" | "name">
|
& Pick<Directory, "id" | "name">
|
||||||
)> }
|
)> }
|
||||||
@@ -220,7 +268,7 @@ export type OpenDirQuery = (
|
|||||||
|
|
||||||
|
|
||||||
export const CopyDocument = gql`
|
export const CopyDocument = gql`
|
||||||
mutation copy($src: ID!, $dest: ID!) {
|
mutation copy($src: objID!, $dest: objID!) {
|
||||||
copy(src: $src, dest: $dest) {
|
copy(src: $src, dest: $dest) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
@@ -254,7 +302,7 @@ export type CopyMutationHookResult = ReturnType<typeof useCopyMutation>;
|
|||||||
export type CopyMutationResult = Apollo.MutationResult<CopyMutation>;
|
export type CopyMutationResult = Apollo.MutationResult<CopyMutation>;
|
||||||
export type CopyMutationOptions = Apollo.BaseMutationOptions<CopyMutation, CopyMutationVariables>;
|
export type CopyMutationOptions = Apollo.BaseMutationOptions<CopyMutation, CopyMutationVariables>;
|
||||||
export const CreateDirDocument = gql`
|
export const CreateDirDocument = gql`
|
||||||
mutation createDir($path: ID!) {
|
mutation createDir($path: objID!) {
|
||||||
createDir(path: $path) {
|
createDir(path: $path) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
@@ -287,7 +335,7 @@ export type CreateDirMutationHookResult = ReturnType<typeof useCreateDirMutation
|
|||||||
export type CreateDirMutationResult = Apollo.MutationResult<CreateDirMutation>;
|
export type CreateDirMutationResult = Apollo.MutationResult<CreateDirMutation>;
|
||||||
export type CreateDirMutationOptions = Apollo.BaseMutationOptions<CreateDirMutation, CreateDirMutationVariables>;
|
export type CreateDirMutationOptions = Apollo.BaseMutationOptions<CreateDirMutation, CreateDirMutationVariables>;
|
||||||
export const DeleteDirDocument = gql`
|
export const DeleteDirDocument = gql`
|
||||||
mutation deleteDir($path: ID!) {
|
mutation deleteDir($path: objID!) {
|
||||||
deleteDir(path: $path)
|
deleteDir(path: $path)
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@@ -318,7 +366,7 @@ export type DeleteDirMutationHookResult = ReturnType<typeof useDeleteDirMutation
|
|||||||
export type DeleteDirMutationResult = Apollo.MutationResult<DeleteDirMutation>;
|
export type DeleteDirMutationResult = Apollo.MutationResult<DeleteDirMutation>;
|
||||||
export type DeleteDirMutationOptions = Apollo.BaseMutationOptions<DeleteDirMutation, DeleteDirMutationVariables>;
|
export type DeleteDirMutationOptions = Apollo.BaseMutationOptions<DeleteDirMutation, DeleteDirMutationVariables>;
|
||||||
export const DeleteFileDocument = gql`
|
export const DeleteFileDocument = gql`
|
||||||
mutation deleteFile($id: ID!) {
|
mutation deleteFile($id: objID!) {
|
||||||
delete(id: $id)
|
delete(id: $id)
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@@ -349,7 +397,7 @@ export type DeleteFileMutationHookResult = ReturnType<typeof useDeleteFileMutati
|
|||||||
export type DeleteFileMutationResult = Apollo.MutationResult<DeleteFileMutation>;
|
export type DeleteFileMutationResult = Apollo.MutationResult<DeleteFileMutation>;
|
||||||
export type DeleteFileMutationOptions = Apollo.BaseMutationOptions<DeleteFileMutation, DeleteFileMutationVariables>;
|
export type DeleteFileMutationOptions = Apollo.BaseMutationOptions<DeleteFileMutation, DeleteFileMutationVariables>;
|
||||||
export const GetFileDocument = gql`
|
export const GetFileDocument = gql`
|
||||||
query getFile($id: ID!) {
|
query getFile($id: objID!) {
|
||||||
file(id: $id) {
|
file(id: $id) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
@@ -387,6 +435,70 @@ export function useGetFileLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Ge
|
|||||||
export type GetFileQueryHookResult = ReturnType<typeof useGetFileQuery>;
|
export type GetFileQueryHookResult = ReturnType<typeof useGetFileQuery>;
|
||||||
export type GetFileLazyQueryHookResult = ReturnType<typeof useGetFileLazyQuery>;
|
export type GetFileLazyQueryHookResult = ReturnType<typeof useGetFileLazyQuery>;
|
||||||
export type GetFileQueryResult = Apollo.QueryResult<GetFileQuery, GetFileQueryVariables>;
|
export type GetFileQueryResult = Apollo.QueryResult<GetFileQuery, GetFileQueryVariables>;
|
||||||
|
export const IsAuthDocument = gql`
|
||||||
|
query isAuth {
|
||||||
|
authorized
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useIsAuthQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useIsAuthQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useIsAuthQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
|
* you can use to render your UI.
|
||||||
|
*
|
||||||
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const { data, loading, error } = useIsAuthQuery({
|
||||||
|
* variables: {
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useIsAuthQuery(baseOptions?: Apollo.QueryHookOptions<IsAuthQuery, IsAuthQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<IsAuthQuery, IsAuthQueryVariables>(IsAuthDocument, options)
|
||||||
|
}
|
||||||
|
export function useIsAuthLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<IsAuthQuery, IsAuthQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<IsAuthQuery, IsAuthQueryVariables>(IsAuthDocument, options)
|
||||||
|
}
|
||||||
|
export type IsAuthQueryHookResult = ReturnType<typeof useIsAuthQuery>;
|
||||||
|
export type IsAuthLazyQueryHookResult = ReturnType<typeof useIsAuthLazyQuery>;
|
||||||
|
export type IsAuthQueryResult = Apollo.QueryResult<IsAuthQuery, IsAuthQueryVariables>;
|
||||||
|
export const ListBucktesDocument = gql`
|
||||||
|
query listBucktes {
|
||||||
|
buckets
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useListBucktesQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useListBucktesQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useListBucktesQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
|
* you can use to render your UI.
|
||||||
|
*
|
||||||
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const { data, loading, error } = useListBucktesQuery({
|
||||||
|
* variables: {
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useListBucktesQuery(baseOptions?: Apollo.QueryHookOptions<ListBucktesQuery, ListBucktesQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<ListBucktesQuery, ListBucktesQueryVariables>(ListBucktesDocument, options)
|
||||||
|
}
|
||||||
|
export function useListBucktesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ListBucktesQuery, ListBucktesQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<ListBucktesQuery, ListBucktesQueryVariables>(ListBucktesDocument, options)
|
||||||
|
}
|
||||||
|
export type ListBucktesQueryHookResult = ReturnType<typeof useListBucktesQuery>;
|
||||||
|
export type ListBucktesLazyQueryHookResult = ReturnType<typeof useListBucktesLazyQuery>;
|
||||||
|
export type ListBucktesQueryResult = Apollo.QueryResult<ListBucktesQuery, ListBucktesQueryVariables>;
|
||||||
export const LoginDocument = gql`
|
export const LoginDocument = gql`
|
||||||
mutation Login($username: String!, $password: String!) {
|
mutation Login($username: String!, $password: String!) {
|
||||||
login(username: $username, password: $password) {
|
login(username: $username, password: $password) {
|
||||||
@@ -423,7 +535,7 @@ export type LoginMutationHookResult = ReturnType<typeof useLoginMutation>;
|
|||||||
export type LoginMutationResult = Apollo.MutationResult<LoginMutation>;
|
export type LoginMutationResult = Apollo.MutationResult<LoginMutation>;
|
||||||
export type LoginMutationOptions = Apollo.BaseMutationOptions<LoginMutation, LoginMutationVariables>;
|
export type LoginMutationOptions = Apollo.BaseMutationOptions<LoginMutation, LoginMutationVariables>;
|
||||||
export const MoveDocument = gql`
|
export const MoveDocument = gql`
|
||||||
mutation move($src: ID!, $dest: ID!) {
|
mutation move($src: objID!, $dest: objID!) {
|
||||||
move(src: $src, dest: $dest) {
|
move(src: $src, dest: $dest) {
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
@@ -456,15 +568,49 @@ export function useMoveMutation(baseOptions?: Apollo.MutationHookOptions<MoveMut
|
|||||||
export type MoveMutationHookResult = ReturnType<typeof useMoveMutation>;
|
export type MoveMutationHookResult = ReturnType<typeof useMoveMutation>;
|
||||||
export type MoveMutationResult = Apollo.MutationResult<MoveMutation>;
|
export type MoveMutationResult = Apollo.MutationResult<MoveMutation>;
|
||||||
export type MoveMutationOptions = Apollo.BaseMutationOptions<MoveMutation, MoveMutationVariables>;
|
export type MoveMutationOptions = Apollo.BaseMutationOptions<MoveMutation, MoveMutationVariables>;
|
||||||
|
export const MoveDirDocument = gql`
|
||||||
|
mutation moveDir($src: objID!, $dest: objID!) {
|
||||||
|
moveDir(src: $src, dest: $dest) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
export type MoveDirMutationFn = Apollo.MutationFunction<MoveDirMutation, MoveDirMutationVariables>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useMoveDirMutation__
|
||||||
|
*
|
||||||
|
* To run a mutation, you first call `useMoveDirMutation` within a React component and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useMoveDirMutation` returns a tuple that includes:
|
||||||
|
* - A mutate function that you can call at any time to execute the mutation
|
||||||
|
* - An object with fields that represent the current status of the mutation's execution
|
||||||
|
*
|
||||||
|
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const [moveDirMutation, { data, loading, error }] = useMoveDirMutation({
|
||||||
|
* variables: {
|
||||||
|
* src: // value for 'src'
|
||||||
|
* dest: // value for 'dest'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useMoveDirMutation(baseOptions?: Apollo.MutationHookOptions<MoveDirMutation, MoveDirMutationVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useMutation<MoveDirMutation, MoveDirMutationVariables>(MoveDirDocument, options)
|
||||||
|
}
|
||||||
|
export type MoveDirMutationHookResult = ReturnType<typeof useMoveDirMutation>;
|
||||||
|
export type MoveDirMutationResult = Apollo.MutationResult<MoveDirMutation>;
|
||||||
|
export type MoveDirMutationOptions = Apollo.BaseMutationOptions<MoveDirMutation, MoveDirMutationVariables>;
|
||||||
export const OpenDirDocument = gql`
|
export const OpenDirDocument = gql`
|
||||||
query openDir($path: String!) {
|
query openDir($path: objID!) {
|
||||||
files(path: $path) {
|
files(path: $path) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
size
|
size
|
||||||
lastModified
|
lastModified
|
||||||
}
|
}
|
||||||
directorys(path: $path) {
|
directories(path: $path) {
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
mutation copy($src: ID!, $dest: ID!) {
|
mutation copy($src: objID!, $dest: objID!) {
|
||||||
copy(src: $src,dest: $dest){
|
copy(src: $src,dest: $dest){
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
mutation createDir($path: ID!){
|
mutation createDir($path: objID!){
|
||||||
createDir(path:$path){
|
createDir(path:$path){
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
mutation deleteDir($path: ID!){
|
mutation deleteDir($path: objID!){
|
||||||
deleteDir(path:$path)
|
deleteDir(path:$path)
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
mutation deleteFile($id: ID!) {
|
mutation deleteFile($id: objID!) {
|
||||||
delete(id:$id)
|
delete(id:$id)
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
query getFile($id: ID!){
|
query getFile($id: objID!){
|
||||||
file(id: $id){
|
file(id: $id){
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
|||||||
3
src/graphql/isAuth.graphql
Normal file
3
src/graphql/isAuth.graphql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
query isAuth{
|
||||||
|
authorized
|
||||||
|
}
|
||||||
3
src/graphql/listBuckets.graphql
Normal file
3
src/graphql/listBuckets.graphql
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
query listBucktes{
|
||||||
|
buckets
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
mutation move($src: ID!, $dest: ID!) {
|
mutation move($src: objID!, $dest: objID!) {
|
||||||
move(src: $src,dest: $dest){
|
move(src: $src,dest: $dest){
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/graphql/moveDir.graphql
Normal file
5
src/graphql/moveDir.graphql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
mutation moveDir($src: objID!, $dest: objID!) {
|
||||||
|
moveDir(src: $src,dest: $dest){
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
query openDir($path: String!) {
|
query openDir($path: objID!) {
|
||||||
files(path:$path){
|
files(path:$path){
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
size
|
size
|
||||||
lastModified
|
lastModified
|
||||||
}
|
}
|
||||||
directorys(path: $path){
|
directories(path: $path){
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,3 +7,7 @@
|
|||||||
.text-input{
|
.text-input{
|
||||||
@apply bg-transparent border-gray-900 dark:border-gray-300 dark:text-gray-300 outline-none border-b
|
@apply bg-transparent border-gray-900 dark:border-gray-300 dark:text-gray-300 outline-none border-b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.breadcrum-item{
|
||||||
|
@apply inline-flex items-center cursor-pointer
|
||||||
|
}
|
||||||
@@ -2,29 +2,13 @@ import React from "react"
|
|||||||
import ReactDOM from "react-dom"
|
import ReactDOM from "react-dom"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
import App from "./App"
|
import App from "./App"
|
||||||
import { ApolloClient, ApolloProvider, InMemoryCache } from "@apollo/client"
|
import { ApolloClient, ApolloProvider } from "@apollo/client"
|
||||||
import "react-contexify/dist/ReactContexify.css"
|
import "react-contexify/dist/ReactContexify.css"
|
||||||
|
import cache from "./Cache"
|
||||||
|
|
||||||
const client = new ApolloClient({
|
const client = new ApolloClient({
|
||||||
uri: "/api/graphql",
|
uri: "/api/graphql",
|
||||||
cache: new InMemoryCache({
|
cache: cache,
|
||||||
typePolicies:{
|
|
||||||
Query: {
|
|
||||||
fields: {
|
|
||||||
files: {
|
|
||||||
merge(existing, incoming){
|
|
||||||
return incoming
|
|
||||||
}
|
|
||||||
},
|
|
||||||
directorys:{
|
|
||||||
merge(existing, incoming){
|
|
||||||
return incoming
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// Disable drag and drop behaviour on document
|
// Disable drag and drop behaviour on document
|
||||||
|
|||||||
106
src/types/ObjID.ts
Normal file
106
src/types/ObjID.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
const stringRegex = /(.*?)(@(.*))?:(.*)/
|
||||||
|
|
||||||
|
class ObjID {
|
||||||
|
public bucket: string
|
||||||
|
public key: string
|
||||||
|
public version?: string
|
||||||
|
|
||||||
|
constructor(bucket: string, key: string, version?: string) {
|
||||||
|
this.bucket = bucket
|
||||||
|
if(!key){
|
||||||
|
this.key = "/"
|
||||||
|
}else{
|
||||||
|
this.key = key
|
||||||
|
}
|
||||||
|
if (version){
|
||||||
|
this.version = version
|
||||||
|
}
|
||||||
|
|
||||||
|
this.normalize()
|
||||||
|
}
|
||||||
|
|
||||||
|
public toString(): string {
|
||||||
|
if (this.version) {
|
||||||
|
return `${this.bucket}@${this.version}:${this.key}`
|
||||||
|
}else{
|
||||||
|
return `${this.bucket}:${this.key}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public normalize(): void{
|
||||||
|
if (!this.key.startsWith("/")){
|
||||||
|
this.key = "/" + this.key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public isDirectory(): boolean {
|
||||||
|
return this.key.endsWith("/")
|
||||||
|
}
|
||||||
|
|
||||||
|
public toURI(): string {
|
||||||
|
return `/f/${this.bucket}${this.key}`
|
||||||
|
}
|
||||||
|
|
||||||
|
public toJSON(): string{
|
||||||
|
// HACK: toJSON is required so that apollo can parse the ObjID back to a string
|
||||||
|
// that can be used in gql query
|
||||||
|
return this.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
public rename(name: string): ObjID{
|
||||||
|
const parts = this.key.split("/")
|
||||||
|
parts[parts.length - (this.isDirectory()?2:1)] = name
|
||||||
|
return new ObjID(this.bucket,parts.join("/"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parent of the object. If Obj is a file then the containing directory
|
||||||
|
* if Obj is a directory it returns the parent
|
||||||
|
* @returns parent ObjID or null if already at root
|
||||||
|
*/
|
||||||
|
public parent(): ObjID | null {
|
||||||
|
if (this.key == "/") {
|
||||||
|
// Already at root. We dont have a parent
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isDirectory()) {
|
||||||
|
const parts = this.key.split("/")
|
||||||
|
const parent = new ObjID(this.bucket, parts.slice(0,-2).join("/") + "/")
|
||||||
|
parent.normalize()
|
||||||
|
return parent
|
||||||
|
} else {
|
||||||
|
const parts = this.key.split("/")
|
||||||
|
const parent = new ObjID(this.bucket, parts.slice(0,-1).join("/") + "/")
|
||||||
|
parent.normalize()
|
||||||
|
return parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static fromString(from: string): ObjID{
|
||||||
|
const match = stringRegex.exec(from)
|
||||||
|
|
||||||
|
if (!match){
|
||||||
|
throw new Error("Failed to parse ObjID")
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ObjID(match[1],match[4],match[3])
|
||||||
|
}
|
||||||
|
|
||||||
|
public static fromURI(uri: string): ObjID{
|
||||||
|
let uri2 = uri
|
||||||
|
|
||||||
|
if (!uri2.endsWith("/")){
|
||||||
|
uri2 += "/"
|
||||||
|
}
|
||||||
|
|
||||||
|
const parts = uri2.split("/")
|
||||||
|
|
||||||
|
const bucket = parts[2]
|
||||||
|
const key = parts.slice(3).join("/")
|
||||||
|
|
||||||
|
return new ObjID(bucket,key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ObjID
|
||||||
132
yarn.lock
132
yarn.lock
@@ -1246,7 +1246,7 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
regenerator-runtime "^0.13.4"
|
regenerator-runtime "^0.13.4"
|
||||||
|
|
||||||
"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4", "@babel/runtime@^7.9.2":
|
"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4":
|
||||||
version "7.14.8"
|
version "7.14.8"
|
||||||
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.8.tgz"
|
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.8.tgz"
|
||||||
integrity sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg==
|
integrity sha512-twj3L8Og5SaCRCErB4x4ajbvBIVV77CGeFglHpeg5WC5FF8TZzBWXtTJ4MqaD9QszLYTtr+IsaAL2rEUevb+eg==
|
||||||
@@ -1392,6 +1392,14 @@
|
|||||||
minimatch "^3.0.4"
|
minimatch "^3.0.4"
|
||||||
strip-json-comments "^3.1.1"
|
strip-json-comments "^3.1.1"
|
||||||
|
|
||||||
|
"@graphql-codegen/add@^3.1.0":
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-3.1.0.tgz#cd02fd6d80a7f62839cb27160b62e48366a237c5"
|
||||||
|
integrity sha512-vRRHpuUFadYXnPrb5RNiIzm3Ao39UxjvrdX760lEfXh2qeG7YddM5QFC+ev2BH3X452R15gv/gf/rXy0+Hqm1A==
|
||||||
|
dependencies:
|
||||||
|
"@graphql-codegen/plugin-helpers" "^2.1.0"
|
||||||
|
tslib "~2.3.0"
|
||||||
|
|
||||||
"@graphql-codegen/cli@1.21.7":
|
"@graphql-codegen/cli@1.21.7":
|
||||||
version "1.21.7"
|
version "1.21.7"
|
||||||
resolved "https://registry.npmjs.org/@graphql-codegen/cli/-/cli-1.21.7.tgz"
|
resolved "https://registry.npmjs.org/@graphql-codegen/cli/-/cli-1.21.7.tgz"
|
||||||
@@ -1466,6 +1474,18 @@
|
|||||||
lodash "~4.17.0"
|
lodash "~4.17.0"
|
||||||
tslib "~2.3.0"
|
tslib "~2.3.0"
|
||||||
|
|
||||||
|
"@graphql-codegen/plugin-helpers@^2.1.0":
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-2.1.1.tgz#fc13e735763574ef308045bbb95c3e7201ec0027"
|
||||||
|
integrity sha512-7jjN9fekMQkpd7cRTbaBxgqt/hkR3CXeOUSsEyHFDDHKtvCrnev3iyc75IeWXpO9tOwDE8mVPTzEZnu4QukrNA==
|
||||||
|
dependencies:
|
||||||
|
"@graphql-tools/utils" "^8.1.1"
|
||||||
|
change-case-all "1.0.14"
|
||||||
|
common-tags "1.8.0"
|
||||||
|
import-from "4.0.0"
|
||||||
|
lodash "~4.17.0"
|
||||||
|
tslib "~2.3.0"
|
||||||
|
|
||||||
"@graphql-codegen/typescript-operations@1.18.4":
|
"@graphql-codegen/typescript-operations@1.18.4":
|
||||||
version "1.18.4"
|
version "1.18.4"
|
||||||
resolved "https://registry.npmjs.org/@graphql-codegen/typescript-operations/-/typescript-operations-1.18.4.tgz"
|
resolved "https://registry.npmjs.org/@graphql-codegen/typescript-operations/-/typescript-operations-1.18.4.tgz"
|
||||||
@@ -1720,6 +1740,13 @@
|
|||||||
camel-case "4.1.2"
|
camel-case "4.1.2"
|
||||||
tslib "~2.2.0"
|
tslib "~2.2.0"
|
||||||
|
|
||||||
|
"@graphql-tools/utils@^8.1.1":
|
||||||
|
version "8.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.2.3.tgz#9d7b9e7e116d11d26c2687f4d9cfb2b54568838b"
|
||||||
|
integrity sha512-RR+aiusf2gIfnPmrDIH1uA45QuPiHB54RD+BmWyMcl88tWAjeJtqZeWPqUTq/1EXrNeocJAJQqogHV4Fbbzx3A==
|
||||||
|
dependencies:
|
||||||
|
tslib "~2.3.0"
|
||||||
|
|
||||||
"@graphql-tools/wrap@^7.0.4":
|
"@graphql-tools/wrap@^7.0.4":
|
||||||
version "7.0.8"
|
version "7.0.8"
|
||||||
resolved "https://registry.npmjs.org/@graphql-tools/wrap/-/wrap-7.0.8.tgz"
|
resolved "https://registry.npmjs.org/@graphql-tools/wrap/-/wrap-7.0.8.tgz"
|
||||||
@@ -2357,60 +2384,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
defer-to-connect "^1.0.1"
|
defer-to-connect "^1.0.1"
|
||||||
|
|
||||||
"@testing-library/dom@^7.28.1":
|
|
||||||
version "7.31.2"
|
|
||||||
resolved "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz"
|
|
||||||
integrity sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==
|
|
||||||
dependencies:
|
|
||||||
"@babel/code-frame" "^7.10.4"
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
"@types/aria-query" "^4.2.0"
|
|
||||||
aria-query "^4.2.2"
|
|
||||||
chalk "^4.1.0"
|
|
||||||
dom-accessibility-api "^0.5.6"
|
|
||||||
lz-string "^1.4.4"
|
|
||||||
pretty-format "^26.6.2"
|
|
||||||
|
|
||||||
"@testing-library/jest-dom@^5.11.4":
|
|
||||||
version "5.14.1"
|
|
||||||
resolved "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.14.1.tgz"
|
|
||||||
integrity sha512-dfB7HVIgTNCxH22M1+KU6viG5of2ldoA5ly8Ar8xkezKHKXjRvznCdbMbqjYGgO2xjRbwnR+rR8MLUIqF3kKbQ==
|
|
||||||
dependencies:
|
|
||||||
"@babel/runtime" "^7.9.2"
|
|
||||||
"@types/testing-library__jest-dom" "^5.9.1"
|
|
||||||
aria-query "^4.2.2"
|
|
||||||
chalk "^3.0.0"
|
|
||||||
css "^3.0.0"
|
|
||||||
css.escape "^1.5.1"
|
|
||||||
dom-accessibility-api "^0.5.6"
|
|
||||||
lodash "^4.17.15"
|
|
||||||
redent "^3.0.0"
|
|
||||||
|
|
||||||
"@testing-library/react@^11.1.0":
|
|
||||||
version "11.2.7"
|
|
||||||
resolved "https://registry.npmjs.org/@testing-library/react/-/react-11.2.7.tgz"
|
|
||||||
integrity sha512-tzRNp7pzd5QmbtXNG/mhdcl7Awfu/Iz1RaVHY75zTdOkmHCuzMhRL83gWHSgOAcjS3CCbyfwUHMZgRJb4kAfpA==
|
|
||||||
dependencies:
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
"@testing-library/dom" "^7.28.1"
|
|
||||||
|
|
||||||
"@testing-library/user-event@^12.1.10":
|
|
||||||
version "12.8.3"
|
|
||||||
resolved "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.8.3.tgz"
|
|
||||||
integrity sha512-IR0iWbFkgd56Bu5ZI/ej8yQwrkCv8Qydx6RzwbKz9faXazR/+5tvYKsZQgyXJiwgpcva127YO6JcWy7YlCfofQ==
|
|
||||||
dependencies:
|
|
||||||
"@babel/runtime" "^7.12.5"
|
|
||||||
|
|
||||||
"@tootallnate/once@1":
|
"@tootallnate/once@1":
|
||||||
version "1.1.2"
|
version "1.1.2"
|
||||||
resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz"
|
resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz"
|
||||||
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
|
integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==
|
||||||
|
|
||||||
"@types/aria-query@^4.2.0":
|
|
||||||
version "4.2.2"
|
|
||||||
resolved "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.2.tgz"
|
|
||||||
integrity sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==
|
|
||||||
|
|
||||||
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
|
"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7":
|
||||||
version "7.1.15"
|
version "7.1.15"
|
||||||
resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.15.tgz"
|
resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.15.tgz"
|
||||||
@@ -2513,7 +2491,7 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/istanbul-lib-report" "*"
|
"@types/istanbul-lib-report" "*"
|
||||||
|
|
||||||
"@types/jest@*", "@types/jest@^26.0.15":
|
"@types/jest@^26.0.15":
|
||||||
version "26.0.24"
|
version "26.0.24"
|
||||||
resolved "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz"
|
resolved "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz"
|
||||||
integrity sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w==
|
integrity sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w==
|
||||||
@@ -2656,13 +2634,6 @@
|
|||||||
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.8.tgz"
|
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.8.tgz"
|
||||||
integrity sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==
|
integrity sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==
|
||||||
|
|
||||||
"@types/testing-library__jest-dom@^5.9.1":
|
|
||||||
version "5.14.1"
|
|
||||||
resolved "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.1.tgz"
|
|
||||||
integrity sha512-Gk9vaXfbzc5zCXI9eYE9BI5BNHEp4D3FWjgqBE/ePGYElLAP+KvxBcsdkwfIVvezs605oiyd/VrpiHe3Oeg+Aw==
|
|
||||||
dependencies:
|
|
||||||
"@types/jest" "*"
|
|
||||||
|
|
||||||
"@types/uglify-js@*":
|
"@types/uglify-js@*":
|
||||||
version "3.13.1"
|
version "3.13.1"
|
||||||
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.1.tgz"
|
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.13.1.tgz"
|
||||||
@@ -5341,11 +5312,6 @@ css-what@^5.0.0:
|
|||||||
resolved "https://registry.npmjs.org/css-what/-/css-what-5.0.1.tgz"
|
resolved "https://registry.npmjs.org/css-what/-/css-what-5.0.1.tgz"
|
||||||
integrity sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==
|
integrity sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==
|
||||||
|
|
||||||
css.escape@^1.5.1:
|
|
||||||
version "1.5.1"
|
|
||||||
resolved "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz"
|
|
||||||
integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=
|
|
||||||
|
|
||||||
css@^2.0.0:
|
css@^2.0.0:
|
||||||
version "2.2.4"
|
version "2.2.4"
|
||||||
resolved "https://registry.npmjs.org/css/-/css-2.2.4.tgz"
|
resolved "https://registry.npmjs.org/css/-/css-2.2.4.tgz"
|
||||||
@@ -5356,15 +5322,6 @@ css@^2.0.0:
|
|||||||
source-map-resolve "^0.5.2"
|
source-map-resolve "^0.5.2"
|
||||||
urix "^0.1.0"
|
urix "^0.1.0"
|
||||||
|
|
||||||
css@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.npmjs.org/css/-/css-3.0.0.tgz"
|
|
||||||
integrity sha512-DG9pFfwOrzc+hawpmqX/dHYHJG+Bsdb0klhyi1sDneOgGOXy9wQIC8hzyVp1e4NRYDBdxcylvywPkkXCHAzTyQ==
|
|
||||||
dependencies:
|
|
||||||
inherits "^2.0.4"
|
|
||||||
source-map "^0.6.1"
|
|
||||||
source-map-resolve "^0.6.0"
|
|
||||||
|
|
||||||
cssdb@^4.4.0:
|
cssdb@^4.4.0:
|
||||||
version "4.4.0"
|
version "4.4.0"
|
||||||
resolved "https://registry.npmjs.org/cssdb/-/cssdb-4.4.0.tgz"
|
resolved "https://registry.npmjs.org/cssdb/-/cssdb-4.4.0.tgz"
|
||||||
@@ -5804,11 +5761,6 @@ doctrine@^3.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
esutils "^2.0.2"
|
esutils "^2.0.2"
|
||||||
|
|
||||||
dom-accessibility-api@^0.5.6:
|
|
||||||
version "0.5.6"
|
|
||||||
resolved "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.6.tgz"
|
|
||||||
integrity sha512-DplGLZd8L1lN64jlT27N9TVSESFR5STaEJvX+thCby7fuCHonfPpAlodYc3vuUYbDuDec5w8AMP7oCM5TWFsqw==
|
|
||||||
|
|
||||||
dom-converter@^0.2.0:
|
dom-converter@^0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz"
|
resolved "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz"
|
||||||
@@ -9582,11 +9534,6 @@ lru-cache@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist "^4.0.0"
|
yallist "^4.0.0"
|
||||||
|
|
||||||
lz-string@^1.4.4:
|
|
||||||
version "1.4.4"
|
|
||||||
resolved "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz"
|
|
||||||
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
|
|
||||||
|
|
||||||
magic-string@^0.25.0, magic-string@^0.25.7:
|
magic-string@^0.25.0, magic-string@^0.25.7:
|
||||||
version "0.25.7"
|
version "0.25.7"
|
||||||
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz"
|
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz"
|
||||||
@@ -12684,6 +12631,14 @@ rollup@^1.31.1:
|
|||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
acorn "^7.1.0"
|
acorn "^7.1.0"
|
||||||
|
|
||||||
|
rooks@^5.7.1:
|
||||||
|
version "5.7.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/rooks/-/rooks-5.7.1.tgz#a9c91e94e760e21a9df5afc1de4ba07d09a6156d"
|
||||||
|
integrity sha512-Gztycgm+e+bS0vqLMSGlGe8f7rkXMxjfPj3FucM06/xu1CEFQx1pZ0zMVdWVxDeMXRePaQ2/g1K7ArIlGKyHbQ==
|
||||||
|
dependencies:
|
||||||
|
lodash.debounce "^4.0.8"
|
||||||
|
raf "^3.4.1"
|
||||||
|
|
||||||
rsvp@^4.8.4:
|
rsvp@^4.8.4:
|
||||||
version "4.8.5"
|
version "4.8.5"
|
||||||
resolved "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz"
|
resolved "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz"
|
||||||
@@ -13172,14 +13127,6 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2:
|
|||||||
source-map-url "^0.4.0"
|
source-map-url "^0.4.0"
|
||||||
urix "^0.1.0"
|
urix "^0.1.0"
|
||||||
|
|
||||||
source-map-resolve@^0.6.0:
|
|
||||||
version "0.6.0"
|
|
||||||
resolved "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz"
|
|
||||||
integrity sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==
|
|
||||||
dependencies:
|
|
||||||
atob "^2.1.2"
|
|
||||||
decode-uri-component "^0.2.0"
|
|
||||||
|
|
||||||
source-map-support@^0.5.17, source-map-support@^0.5.6, source-map-support@~0.5.12, source-map-support@~0.5.19:
|
source-map-support@^0.5.17, source-map-support@^0.5.6, source-map-support@~0.5.12, source-map-support@~0.5.19:
|
||||||
version "0.5.19"
|
version "0.5.19"
|
||||||
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz"
|
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz"
|
||||||
@@ -14648,11 +14595,6 @@ wbuf@^1.1.0, wbuf@^1.7.3:
|
|||||||
dependencies:
|
dependencies:
|
||||||
minimalistic-assert "^1.0.0"
|
minimalistic-assert "^1.0.0"
|
||||||
|
|
||||||
web-vitals@^1.0.1:
|
|
||||||
version "1.1.2"
|
|
||||||
resolved "https://registry.npmjs.org/web-vitals/-/web-vitals-1.1.2.tgz"
|
|
||||||
integrity sha512-PFMKIY+bRSXlMxVAQ+m2aw9c/ioUYfDgrYot0YUa+/xa0sakubWhSDyxAKwzymvXVdF4CZI71g06W+mqhzu6ig==
|
|
||||||
|
|
||||||
webidl-conversions@^5.0.0:
|
webidl-conversions@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz"
|
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz"
|
||||||
|
|||||||
Reference in New Issue
Block a user