mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
Fix: 添加Eslint config, 修正所有的eslint error 和 warning (#20)
* Fix: 添加Eslint config, 修正所有的eslint error 和 warning。添加husky pre-commit 和 pre-push 钩子 * Fix: Disable react-hooks/exhaustive-deps eslint * Fix: 添加修复react-hooks/rules-of-hooks
This commit is contained in:
parent
6d23b07b7a
commit
755796939f
|
|
@ -0,0 +1,28 @@
|
|||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:react/recommended
|
||||
plugins:
|
||||
- react
|
||||
- react-hooks
|
||||
parser: babel-eslint
|
||||
parserOptions:
|
||||
sourceType: module
|
||||
ecmaVersion: 2020
|
||||
ecmaFeatures:
|
||||
jsx: true
|
||||
env:
|
||||
es6: true
|
||||
browser: true
|
||||
node: true
|
||||
jest: true
|
||||
|
||||
settings:
|
||||
react:
|
||||
version: detect
|
||||
ignorePatterns:
|
||||
- node_modules
|
||||
rules:
|
||||
react/prop-types: 0
|
||||
react-hooks/rules-of-hooks: "error"
|
||||
# TODO: 修改添加deps后出现的死循环
|
||||
react-hooks/exhaustive-deps: 0
|
||||
|
|
@ -362,7 +362,6 @@ module.exports = function(webpackEnv) {
|
|||
formatter: require.resolve('react-dev-utils/eslintFormatter'),
|
||||
eslintPath: require.resolve('eslint'),
|
||||
resolvePluginsRelativeTo: __dirname,
|
||||
|
||||
},
|
||||
loader: require.resolve('eslint-loader'),
|
||||
},
|
||||
|
|
|
|||
21
package.json
21
package.json
|
|
@ -23,19 +23,19 @@
|
|||
"css-loader": "2.1.1",
|
||||
"dotenv": "6.2.0",
|
||||
"dotenv-expand": "5.1.0",
|
||||
"eslint": "^6.1.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-react-app": "^5.0.2",
|
||||
"eslint-loader": "3.0.2",
|
||||
"eslint-plugin-flowtype": "3.13.0",
|
||||
"eslint-plugin-import": "2.18.2",
|
||||
"eslint-plugin-jsx-a11y": "6.2.3",
|
||||
"eslint-plugin-react": "7.14.3",
|
||||
"eslint-plugin-react-hooks": "^1.6.1",
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"file-loader": "3.0.1",
|
||||
"for-editor": "^0.3.5",
|
||||
"fs-extra": "7.0.1",
|
||||
"html-webpack-plugin": "4.0.0-beta.5",
|
||||
"http-proxy-middleware": "^0.20.0",
|
||||
"husky": "^4.2.5",
|
||||
"identity-obj-proxy": "3.0.0",
|
||||
"is-wsl": "^1.1.0",
|
||||
"jest": "24.9.0",
|
||||
|
|
@ -92,10 +92,9 @@
|
|||
"scripts": {
|
||||
"start": "node scripts/start.js",
|
||||
"build": "node scripts/build.js",
|
||||
"test": "node scripts/test.js"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
"test": "node scripts/test.js",
|
||||
"eslint": "eslint src/** --fix",
|
||||
"postinstall": "node node_modules/husky/lib/installer/bin install"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
@ -163,6 +162,12 @@
|
|||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^5.1.1"
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"eslint-plugin-react-hooks": "^4.0.0"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "npm run eslint"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import React, { Suspense, useEffect, useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { CssBaseline, makeStyles } from "@material-ui/core";
|
||||
import AlertBar from "./component/Common/Snackbar";
|
||||
import Dashboard from "./component/Admin/Dashboard";
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputAdornment from "@material-ui/core/InputAdornment";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
|
||||
export default function DomainInput({onChange,value,required,label}){
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputAdornment from "@material-ui/core/InputAdornment";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import React, { useCallback, useState, useRef } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
|
||||
const unitTransform = (v)=>{
|
||||
if(v<1024){
|
||||
|
|
@ -34,13 +34,13 @@ export default function SizeInput({onChange,min,value,required,label,max,suffix}
|
|||
|
||||
|
||||
const [unit,setUnit] = useState(1);
|
||||
let first = true;
|
||||
let first = useRef(true);
|
||||
|
||||
const transform = useCallback(()=>{
|
||||
let res = unitTransform(value);
|
||||
if(first && value !== 0){
|
||||
setUnit(res[1]);
|
||||
first = false;
|
||||
first.current = false;
|
||||
}
|
||||
return res;
|
||||
},[value]);
|
||||
|
|
|
|||
|
|
@ -1,40 +1,30 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import { lighten, makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import Drawer from "@material-ui/core/Drawer";
|
||||
import { withStyles } from "@material-ui/core";
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import List from "@material-ui/core/List";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import Drawer from "@material-ui/core/Drawer";
|
||||
import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||
import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||
import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import MenuIcon from "@material-ui/icons/Menu";
|
||||
import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
|
||||
import ChevronRightIcon from "@material-ui/icons/ChevronRight";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import UserAvatar from "../Navbar/UserAvatar";
|
||||
import {
|
||||
Contacts,
|
||||
Home,
|
||||
Language,
|
||||
Settings,
|
||||
Mail,
|
||||
SettingsEthernet,
|
||||
AttachMoney,
|
||||
Palette,
|
||||
CloudDownload, Image, Storage, Group, Person, InsertDriveFile, Share, ShoppingCart, Assignment, ListAlt
|
||||
} from "@material-ui/icons";
|
||||
import { withStyles } from "@material-ui/core";
|
||||
import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||
import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||
import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||
import { lighten, makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Assignment, CloudDownload, Contacts, Group, Home, Image, InsertDriveFile, Language, ListAlt, Mail, Palette, Person, Settings, SettingsEthernet, Share, Storage } from "@material-ui/icons";
|
||||
import ChevronLeftIcon from "@material-ui/icons/ChevronLeft";
|
||||
import ChevronRightIcon from "@material-ui/icons/ChevronRight";
|
||||
import MenuIcon from "@material-ui/icons/Menu";
|
||||
import clsx from "clsx";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory, useLocation } from "react-router";
|
||||
import { useRouteMatch } from "react-router-dom";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle } from "../../actions";
|
||||
import pathHelper from "../../utils/page";
|
||||
import UserAvatar from "../Navbar/UserAvatar";
|
||||
|
||||
const ExpansionPanel = withStyles({
|
||||
root: {
|
||||
|
|
@ -367,6 +357,7 @@ export default function Dashboard({ content }) {
|
|||
}
|
||||
return (
|
||||
<ExpansionPanel
|
||||
key={item.title}
|
||||
square
|
||||
expanded={menuOpen === item.title}
|
||||
onChange={(event, isExpanded) => {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
formContainer: {
|
||||
margin: "8px 0 8px 0"
|
||||
}
|
||||
|
|
@ -42,7 +41,7 @@ export default function AddGroup({ open, onClose, onSubmit }) {
|
|||
.then(response => {
|
||||
setGroups(response.data);
|
||||
})
|
||||
.catch(error => {});
|
||||
.catch(() => {});
|
||||
}
|
||||
// eslint-disable-next-line
|
||||
}, [open]);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import FormControl from "@material-ui/core/FormControl";
|
|||
import SizeInput from "../Common/SizeInput";
|
||||
import {makeStyles} from "@material-ui/core/styles";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
|
||||
formContainer: {
|
||||
margin:"8px 0 8px 0",
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
import React from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import Card from "@material-ui/core/Card";
|
||||
import CardActionArea from "@material-ui/core/CardActionArea";
|
||||
import {makeStyles} from "@material-ui/core/styles";
|
||||
import CardMedia from "@material-ui/core/CardMedia";
|
||||
import CardContent from "@material-ui/core/CardContent";
|
||||
import {useHistory, useLocation} from "react-router";
|
||||
import CardMedia from "@material-ui/core/CardMedia";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React from "react";
|
||||
import { useHistory } from "react-router";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
cardContainer:{
|
||||
|
|
@ -91,7 +90,7 @@ export default function AddPolicy({open, onClose }) {
|
|||
<DialogContent dividers className={classes.bg}>
|
||||
<Grid container spacing={2}>
|
||||
{policies.map(v=>(
|
||||
<Grid item sm={12} md={6}>
|
||||
<Grid item sm={12} md={6} key={v.path}>
|
||||
<Card className={classes.card}>
|
||||
<CardActionArea
|
||||
onClick={()=>{
|
||||
|
|
|
|||
|
|
@ -1,23 +1,22 @@
|
|||
import React, {useCallback, useState} from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
import {makeStyles} from "@material-ui/core/styles";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
|
||||
formContainer: {
|
||||
margin:"8px 0 8px 0",
|
||||
|
|
@ -124,7 +123,7 @@ export default function AddRedeem({ open, onClose,products ,onSuccess}) {
|
|||
}}
|
||||
>
|
||||
{products.map(v=>(
|
||||
<MenuItem value={v.id} data-type={"1"}>{v.name}</MenuItem>
|
||||
<MenuItem key={v.id} value={v.id} data-type={"1"}>{v.name}</MenuItem>
|
||||
))}
|
||||
<MenuItem value={0}>积分</MenuItem>
|
||||
</Select>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import { CompactPicker } from "react-color";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import Fab from "@material-ui/core/Fab";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import { createMuiTheme, makeStyles } from "@material-ui/core/styles";
|
||||
import AppBar from "@material-ui/core/AppBar";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import { createMuiTheme, makeStyles } from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Add, Menu } from "@material-ui/icons";
|
||||
import { ThemeProvider } from "@material-ui/styles";
|
||||
import Fab from "@material-ui/core/Fab";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { CompactPicker } from "react-color";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
picker: {
|
||||
|
|
@ -121,7 +121,7 @@ export default function CreateTheme({ open, onClose,onSubmit }) {
|
|||
"#9c27b0"
|
||||
]}
|
||||
color={theme.palette.primary.main}
|
||||
onChangeComplete={(c, e) => {
|
||||
onChangeComplete={(c) => {
|
||||
setTheme({
|
||||
...theme,
|
||||
palette: {
|
||||
|
|
@ -197,7 +197,7 @@ export default function CreateTheme({ open, onClose,onSubmit }) {
|
|||
"#d500f9"
|
||||
]}
|
||||
color={theme.palette.secondary.main}
|
||||
onChangeComplete={(c, e) => {
|
||||
onChangeComplete={(c) => {
|
||||
setTheme({
|
||||
...theme,
|
||||
palette: {
|
||||
|
|
@ -235,7 +235,7 @@ export default function CreateTheme({ open, onClose,onSubmit }) {
|
|||
<div className={classes.picker}>
|
||||
<CompactPicker
|
||||
color={theme.palette.primary.contrastText}
|
||||
onChangeComplete={(c, e) => {
|
||||
onChangeComplete={(c) => {
|
||||
setTheme({
|
||||
...theme,
|
||||
palette: {
|
||||
|
|
@ -273,7 +273,7 @@ export default function CreateTheme({ open, onClose,onSubmit }) {
|
|||
<div className={classes.picker}>
|
||||
<CompactPicker
|
||||
color={theme.palette.secondary.contrastText}
|
||||
onChangeComplete={(c, e) => {
|
||||
onChangeComplete={(c) => {
|
||||
setTheme({
|
||||
...theme,
|
||||
palette: {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import API from "../../../middleware/Api";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
export default function FileFilter({setFilter,setSearch,open, onClose }) {
|
||||
const [input,setInput] = useState({
|
||||
|
|
@ -49,7 +47,7 @@ export default function FileFilter({setFilter,setSearch,open, onClose }) {
|
|||
});
|
||||
},[])
|
||||
|
||||
const submit = e => {
|
||||
const submit = () => {
|
||||
let res = {};
|
||||
Object.keys(input).forEach(v=>{
|
||||
if(input[v] !== "all" && input[v] !== ""){
|
||||
|
|
|
|||
|
|
@ -1,26 +1,17 @@
|
|||
import React from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import {makeStyles} from "@material-ui/core/styles";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
|
||||
}));
|
||||
import React from "react";
|
||||
|
||||
export default function MagicVar({isFile, open, onClose, isSlave }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,14 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import API from "../../../middleware/Api";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import React, { useState } from "react";
|
||||
|
||||
export default function ShareFilter({setFilter,setSearch,open, onClose }) {
|
||||
const [input,setInput] = useState({
|
||||
|
|
@ -22,18 +17,11 @@ export default function ShareFilter({setFilter,setSearch,open, onClose }) {
|
|||
});
|
||||
const [keywords,setKeywords] = useState("");
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const handleChange = name => event => {
|
||||
setInput({...input,[name]:event.target.value})
|
||||
}
|
||||
|
||||
const submit = e => {
|
||||
const submit = () => {
|
||||
let res = {};
|
||||
Object.keys(input).forEach(v=>{
|
||||
if(input[v] !== "all" && input[v] !== ""){
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import API from "../../../middleware/Api";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
export default function UserFilter({setFilter,setSearch,open, onClose }) {
|
||||
const [input,setInput] = useState({
|
||||
|
|
@ -44,7 +42,7 @@ export default function UserFilter({setFilter,setSearch,open, onClose }) {
|
|||
});
|
||||
},[])
|
||||
|
||||
const submit = e => {
|
||||
const submit = () => {
|
||||
let res = {};
|
||||
Object.keys(input).forEach(v=>{
|
||||
if(input[v] !== "all"){
|
||||
|
|
|
|||
|
|
@ -1,36 +1,29 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import { policyTypeMap } from "../../../config";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import AddPolicy from "../Dialogs/AddPolicy";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import { useHistory, useLocation } from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import { Block, Delete, DeleteForever, Edit, FilterList } from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Popover from "@material-ui/core/Popover";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { lighten } from "@material-ui/core";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import UserFilter from "../Dialogs/UserFilter";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Delete, DeleteForever, FilterList } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import FileFilter from "../Dialogs/FileFilter";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
|
|
@ -78,10 +71,6 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function useQuery() {
|
||||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function File() {
|
||||
const classes = useStyles();
|
||||
const [files, setFiles] = useState([]);
|
||||
|
|
@ -97,12 +86,14 @@ export default function File() {
|
|||
const [loading,setLoading] = useState(false);
|
||||
|
||||
let history = useHistory();
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const loadList = () => {
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/file/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
|
|
@ -119,12 +110,16 @@ export default function File() {
|
|||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/file/delete",{id:[id]})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "删除任务将在后台执行", "success");
|
||||
})
|
||||
|
|
@ -135,10 +130,10 @@ export default function File() {
|
|||
});
|
||||
};
|
||||
|
||||
const deleteBatch =force => e =>{
|
||||
const deleteBatch =force => () =>{
|
||||
setLoading(true);
|
||||
API.post("/admin/file/delete",{id:selected,force:force})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "删除任务将在后台执行", "success");
|
||||
})
|
||||
|
|
@ -148,12 +143,6 @@ export default function File() {
|
|||
setLoading(false);
|
||||
});
|
||||
}
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const handleSelectAllClick = event => {
|
||||
if (event.target.checked) {
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import { Dialog } from "@material-ui/core";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import Chip from "@material-ui/core/Chip";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import Fade from "@material-ui/core/Fade";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputAdornment from "@material-ui/core/InputAdornment";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Popper from "@material-ui/core/Popper";
|
||||
import InputAdornment from "@material-ui/core/InputAdornment";
|
||||
import Chip from "@material-ui/core/Chip";
|
||||
import { Dialog } from "@material-ui/core";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import PathSelector from "../../FileManager/PathSelector";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import PathSelector from "../../FileManager/PathSelector";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -116,7 +116,7 @@ export default function Import() {
|
|||
dst: options.dst,
|
||||
recursive: options.recursive
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
history.push("/admin/file");
|
||||
ToggleSnackbar(
|
||||
|
|
@ -187,7 +187,7 @@ export default function Import() {
|
|||
folder.path === "/"
|
||||
? folder.path + folder.name
|
||||
: folder.path + "/" + folder.name;
|
||||
setter(path == "//" ? "/" : path);
|
||||
setter(path === "//" ? "/" : path);
|
||||
};
|
||||
|
||||
const openPathSelector = isSrcSelect => {
|
||||
|
|
@ -355,6 +355,7 @@ export default function Import() {
|
|||
>
|
||||
{users.map(u => (
|
||||
<MenuItem
|
||||
key={u.Email}
|
||||
onClick={() =>
|
||||
selectUser(u)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,22 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import { policyTypeMap } from "../../../config";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import AddPolicy from "../Dialogs/AddPolicy";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import {useHistory, useLocation} from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import {Delete, Edit} from "@material-ui/icons";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Popover from "@material-ui/core/Popover";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import { Delete, Edit } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory, useLocation } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import { sizeToString } from "../../../utils";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -78,30 +72,40 @@ function useQuery() {
|
|||
|
||||
export default function Group() {
|
||||
const classes = useStyles();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [tab, setTab] = useState(0);
|
||||
const [groups, setGroups] = useState([]);
|
||||
const [statics, setStatics] = useState([]);
|
||||
const [page, setPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(10);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [addDialog, setAddDialog] = useState(false);
|
||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
||||
const [editID, setEditID] = React.useState(0);
|
||||
const [policies, setPolicies] = React.useState({});
|
||||
|
||||
let location = useLocation();
|
||||
let history = useHistory();
|
||||
let query = useQuery();
|
||||
|
||||
const handleClick = event => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/group/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: "id desc",
|
||||
})
|
||||
.then(response => {
|
||||
setGroups(response.data.items);
|
||||
setStatics(response.data.statics);
|
||||
setTotal(response.data.total);
|
||||
setPolicies(response.data.policies);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(()=>{
|
||||
if(query.get("code") === "0"){
|
||||
|
|
@ -116,26 +120,9 @@ export default function Group() {
|
|||
loadList();
|
||||
}, [page, pageSize]);
|
||||
|
||||
const loadList = () => {
|
||||
API.post("/admin/group/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: "id desc",
|
||||
})
|
||||
.then(response => {
|
||||
setGroups(response.data.items);
|
||||
setStatics(response.data.statics);
|
||||
setTotal(response.data.total);
|
||||
setPolicies(response.data.policies);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
|
||||
const deletePolicy = (id) =>{
|
||||
API.delete("/admin/group/" + id,)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "用户组已删除", "success");
|
||||
})
|
||||
|
|
@ -144,15 +131,6 @@ export default function Group() {
|
|||
});
|
||||
}
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const open = Boolean(anchorEl);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={classes.header}>
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Chip from "@material-ui/core/Chip";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import {useHistory} from "react-router";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -37,14 +36,14 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function getStyles(name, personName, theme) {
|
||||
return {
|
||||
fontWeight:
|
||||
personName.indexOf(name) === -1
|
||||
? theme.typography.fontWeightRegular
|
||||
: theme.typography.fontWeightMedium
|
||||
};
|
||||
}
|
||||
// function getStyles(name, personName, theme) {
|
||||
// return {
|
||||
// fontWeight:
|
||||
// personName.indexOf(name) === -1
|
||||
// ? theme.typography.fontWeightRegular
|
||||
// : theme.typography.fontWeightMedium
|
||||
// };
|
||||
// }
|
||||
|
||||
export default function GroupForm(props) {
|
||||
const classes = useStyles();
|
||||
|
|
@ -71,9 +70,15 @@ export default function GroupForm(props) {
|
|||
);
|
||||
const [policies, setPolicies] = useState({});
|
||||
|
||||
const theme = useTheme();
|
||||
let history = useHistory();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
API.post("/admin/policy/list", {
|
||||
page: 1,
|
||||
|
|
@ -129,13 +134,6 @@ export default function GroupForm(props) {
|
|||
});
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const submit = e => {
|
||||
e.preventDefault();
|
||||
let groupCopy = {
|
||||
|
|
@ -184,7 +182,7 @@ export default function GroupForm(props) {
|
|||
API.post("/admin/group", {
|
||||
group: groupCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
history.push("/admin/group");
|
||||
ToggleSnackbar("top", "right", "用户组已"+ (props.group ? "保存" : "添加"), "success");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,50 +1,32 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import {
|
||||
LineChart,
|
||||
Line,
|
||||
XAxis,
|
||||
YAxis,
|
||||
CartesianGrid,
|
||||
Tooltip,
|
||||
Legend
|
||||
} from "recharts";
|
||||
import ResponsiveContainer from "recharts/lib/component/ResponsiveContainer";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import pathHelper from "../../utils/page";
|
||||
import API from "../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Avatar from "@material-ui/core/Avatar";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Chip from "@material-ui/core/Chip";
|
||||
import { blue, green, red, yellow } from "@material-ui/core/colors";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import ListItemAvatar from "@material-ui/core/ListItemAvatar";
|
||||
import Avatar from "@material-ui/core/Avatar";
|
||||
import {
|
||||
FileCopy,
|
||||
Forum,
|
||||
GitHub,
|
||||
Home,
|
||||
Launch,
|
||||
Lock,
|
||||
People,
|
||||
Public,
|
||||
Telegram
|
||||
} from "@material-ui/icons";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||
import { blue, green, red, yellow } from "@material-ui/core/colors";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { FileCopy, Forum, GitHub, Home, Launch, Lock, People, Public, Telegram } from "@material-ui/icons";
|
||||
import axios from "axios";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { CartesianGrid, Legend, Line, LineChart, Tooltip, XAxis, YAxis } from "recharts";
|
||||
import ResponsiveContainer from "recharts/lib/component/ResponsiveContainer";
|
||||
import TimeAgo from "timeago-react";
|
||||
import Chip from "@material-ui/core/Chip";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import API from "../../middleware/Api";
|
||||
import pathHelper from "../../utils/page";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
paper: {
|
||||
|
|
@ -124,7 +106,7 @@ export default function Index() {
|
|||
value:window.location.origin,
|
||||
}],
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setSiteURL(window.location.origin);
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
|
|
@ -303,6 +285,7 @@ export default function Index() {
|
|||
<Paper>
|
||||
<div className={classes.logoContainer}>
|
||||
<img
|
||||
alt="cloudreve"
|
||||
className={classes.logo}
|
||||
src={"/static/img/cloudreve.svg"}
|
||||
/>
|
||||
|
|
@ -385,7 +368,7 @@ export default function Index() {
|
|||
<Grid item xs={12} md={8} lg={9}>
|
||||
<Paper className={classes.paper}>
|
||||
<List>
|
||||
{news && news.map((v, k) => (
|
||||
{news && news.map((v) => (
|
||||
<>
|
||||
<ListItem button alignItems="flex-start"
|
||||
onClick={()=>window.open("https://forum.cloudreve.org/d/" + v.id)}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import React, {useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import {useParams} from "react-router";
|
||||
import LocalGuide from "./Guid/LocalGuide";
|
||||
import RemoteGuide from "./Guid/RemoteGuide";
|
||||
import QiniuGuide from "./Guid/QiniuGuide";
|
||||
import OSSGuide from "./Guid/OSSGuide";
|
||||
import UpyunGuide from "./Guid/UpyunGuide";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import React from "react";
|
||||
import { useParams } from "react-router";
|
||||
import COSGuide from "./Guid/COSGuide";
|
||||
import LocalGuide from "./Guid/LocalGuide";
|
||||
import OneDriveGuide from "./Guid/OneDriveGuide";
|
||||
import OSSGuide from "./Guid/OSSGuide";
|
||||
import QiniuGuide from "./Guid/QiniuGuide";
|
||||
import RemoteGuide from "./Guid/RemoteGuide";
|
||||
import UpyunGuide from "./Guid/UpyunGuide";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -25,7 +25,6 @@ const useStyles = makeStyles(theme => ({
|
|||
|
||||
export default function AddPolicyParent( ) {
|
||||
const classes = useStyles();
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
let { type } = useParams();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
import React, {useCallback, useEffect, useState} from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import {useParams} from "react-router";
|
||||
import LocalGuide from "./Guid/LocalGuide";
|
||||
import RemoteGuide from "./Guid/RemoteGuide";
|
||||
import QiniuGuide from "./Guid/QiniuGuide";
|
||||
import OSSGuide from "./Guid/OSSGuide";
|
||||
import UpyunGuide from "./Guid/UpyunGuide";
|
||||
import COSGuide from "./Guid/COSGuide";
|
||||
import OneDriveGuide from "./Guid/OneDriveGuide";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useParams } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import {useDispatch} from "react-redux";
|
||||
import {toggleSnackbar} from "../../../actions";
|
||||
import COSGuide from "./Guid/COSGuide";
|
||||
import EditPro from "./Guid/EditPro";
|
||||
import LocalGuide from "./Guid/LocalGuide";
|
||||
import OneDriveGuide from "./Guid/OneDriveGuide";
|
||||
import OSSGuide from "./Guid/OSSGuide";
|
||||
import QiniuGuide from "./Guid/QiniuGuide";
|
||||
import RemoteGuide from "./Guid/RemoteGuide";
|
||||
import UpyunGuide from "./Guid/UpyunGuide";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -29,7 +29,6 @@ const useStyles = makeStyles(theme => ({
|
|||
|
||||
export default function EditPolicyPreload( ) {
|
||||
const classes = useStyles();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [type,setType] = useState("");
|
||||
const [policy,setPolicy] = useState({});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import { getNumber } from "../../../../utils";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {getNumber, randomStr} from "../../../../utils";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -219,7 +217,7 @@ export default function COSGuide(props) {
|
|||
API.post("/admin/policy/cors", {
|
||||
id: policyID
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "跨域策略已添加", "success");
|
||||
setActiveStep(5);
|
||||
})
|
||||
|
|
@ -238,7 +236,7 @@ export default function COSGuide(props) {
|
|||
id: policyID,
|
||||
region:region,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "回调云函数已添加", "success");
|
||||
setActiveStep(6);
|
||||
})
|
||||
|
|
@ -569,8 +567,10 @@ export default function COSGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -602,8 +602,10 @@ export default function COSGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,81 +1,68 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from '../../../../actions';
|
||||
import API from "../../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
padding: "16px 32px 16px 32px"
|
||||
},
|
||||
form: {
|
||||
maxWidth: 400,
|
||||
marginTop: 20
|
||||
},
|
||||
formContainer: {
|
||||
[theme.breakpoints.up("md")]: {
|
||||
padding: "0px 24px 0 24px"
|
||||
}
|
||||
},
|
||||
subStepContainer: {
|
||||
display: "flex",
|
||||
marginBottom: 20,
|
||||
padding: 10,
|
||||
transition: theme.transitions.create("background-color", {
|
||||
easing: theme.transitions.easing.sharp,
|
||||
duration: theme.transitions.duration.leavingScreen
|
||||
}),
|
||||
"&:focus-within": {
|
||||
backgroundColor: theme.palette.background.default
|
||||
}
|
||||
},
|
||||
stepNumber: {
|
||||
width: 20,
|
||||
height: 20,
|
||||
backgroundColor: lighten(theme.palette.secondary.light, 0.2),
|
||||
color: theme.palette.secondary.contrastText,
|
||||
textAlign: "center",
|
||||
borderRadius: " 50%"
|
||||
},
|
||||
stepNumberContainer: {
|
||||
marginRight: 10
|
||||
},
|
||||
stepFooter: {
|
||||
marginTop: 32
|
||||
},
|
||||
button: {
|
||||
marginRight: theme.spacing(1)
|
||||
}
|
||||
}));
|
||||
|
||||
// const useStyles = makeStyles(theme => ({
|
||||
// stepContent: {
|
||||
// padding: "16px 32px 16px 32px"
|
||||
// },
|
||||
// form: {
|
||||
// maxWidth: 400,
|
||||
// marginTop: 20
|
||||
// },
|
||||
// formContainer: {
|
||||
// [theme.breakpoints.up("md")]: {
|
||||
// padding: "0px 24px 0 24px"
|
||||
// }
|
||||
// },
|
||||
// subStepContainer: {
|
||||
// display: "flex",
|
||||
// marginBottom: 20,
|
||||
// padding: 10,
|
||||
// transition: theme.transitions.create("background-color", {
|
||||
// easing: theme.transitions.easing.sharp,
|
||||
// duration: theme.transitions.duration.leavingScreen
|
||||
// }),
|
||||
// "&:focus-within": {
|
||||
// backgroundColor: theme.palette.background.default
|
||||
// }
|
||||
// },
|
||||
// stepNumber: {
|
||||
// width: 20,
|
||||
// height: 20,
|
||||
// backgroundColor: lighten(theme.palette.secondary.light, 0.2),
|
||||
// color: theme.palette.secondary.contrastText,
|
||||
// textAlign: "center",
|
||||
// borderRadius: " 50%"
|
||||
// },
|
||||
// stepNumberContainer: {
|
||||
// marginRight: 10
|
||||
// },
|
||||
// stepFooter: {
|
||||
// marginTop: 32
|
||||
// },
|
||||
// button: {
|
||||
// marginRight: theme.spacing(1)
|
||||
// }
|
||||
// }));
|
||||
|
||||
export default function EditPro(props) {
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [, setLoading] = useState(false);
|
||||
const [policy, setPolicy] = useState(props.policy);
|
||||
|
||||
const handleChange = name => event => {
|
||||
|
|
@ -128,7 +115,7 @@ export default function EditPro(props) {
|
|||
API.post("/admin/policy", {
|
||||
policy: policyCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -90,7 +90,7 @@ export default function LocalGuide(props) {
|
|||
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [skipped, setSkipped] = React.useState(new Set());
|
||||
const [skipped] = React.useState(new Set());
|
||||
const [magicVar, setMagicVar] = useState("");
|
||||
const [useCDN, setUseCDN] = useState("false");
|
||||
const [policy, setPolicy] = useState(
|
||||
|
|
@ -148,7 +148,7 @@ export default function LocalGuide(props) {
|
|||
API.post("/admin/policy/test/path", {
|
||||
path: policy.DirNameRule
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setActiveStep(1);
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -190,7 +190,7 @@ export default function LocalGuide(props) {
|
|||
API.post("/admin/policy", {
|
||||
policy: policyCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -249,8 +249,10 @@ export default function LocalGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -282,8 +284,10 @@ export default function LocalGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,26 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import { getNumber } from "../../../../utils";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {getNumber, randomStr} from "../../../../utils";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -211,7 +210,7 @@ export default function OSSGuide(props) {
|
|||
API.post("/admin/policy/cors", {
|
||||
id: policyID
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "跨域策略已添加", "success");
|
||||
setActiveStep(5);
|
||||
})
|
||||
|
|
@ -546,8 +545,10 @@ export default function OSSGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -579,8 +580,10 @@ export default function OSSGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,25 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {getNumber, randomStr} from "../../../../utils";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import AlertDialog from "../../Dialogs/Alert";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -108,7 +105,7 @@ export default function OneDriveGuide(props) {
|
|||
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [skipped, setSkipped] = React.useState(new Set());
|
||||
const [skipped,] = React.useState(new Set());
|
||||
const [magicVar, setMagicVar] = useState("");
|
||||
const [policy, setPolicy] = useState(props.policy
|
||||
? props.policy
|
||||
|
|
@ -185,7 +182,7 @@ export default function OneDriveGuide(props) {
|
|||
});
|
||||
},[]);
|
||||
|
||||
const statOAuth = e =>{
|
||||
const statOAuth = () =>{
|
||||
setLoading(true);
|
||||
API.get("/admin/policy/" + policyID + "/oauth", )
|
||||
.then(response => {
|
||||
|
|
@ -475,8 +472,10 @@ export default function OneDriveGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -508,8 +507,10 @@ export default function OneDriveGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,26 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import { getNumber } from "../../../../utils";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {getNumber, randomStr} from "../../../../utils";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -96,9 +95,9 @@ export default function RemoteGuide(props) {
|
|||
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [skipped, setSkipped] = React.useState(new Set());
|
||||
const [skipped,] = React.useState(new Set());
|
||||
const [magicVar, setMagicVar] = useState("");
|
||||
const [useCDN, setUseCDN] = useState("false");
|
||||
// const [useCDN, setUseCDN] = useState("false");
|
||||
const [policy, setPolicy] = useState(props.policy?props.policy:{
|
||||
Type: "qiniu",
|
||||
Name: "",
|
||||
|
|
@ -171,7 +170,7 @@ export default function RemoteGuide(props) {
|
|||
API.post("/admin/policy", {
|
||||
policy: policyCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "存储策略已"+ (props.policy ? "保存" : "添加"), "success");
|
||||
setActiveStep(5);
|
||||
})
|
||||
|
|
@ -395,8 +394,10 @@ export default function RemoteGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -428,8 +429,10 @@ export default function RemoteGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import { randomStr } from "../../../../utils";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import {useHistory} from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {randomStr} from "../../../../utils";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -117,7 +117,7 @@ export default function RemoteGuide(props) {
|
|||
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [skipped, setSkipped] = React.useState(new Set());
|
||||
const [skipped,] = React.useState(new Set());
|
||||
const [magicVar,setMagicVar] = useState("");
|
||||
const [useCDN,setUseCDN] = useState("false");
|
||||
const [policy, setPolicy] = useState(props.policy?props.policy:{
|
||||
|
|
@ -173,7 +173,7 @@ export default function RemoteGuide(props) {
|
|||
server: policy.Server,
|
||||
secret:policy.SecretKey,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "通信正常", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -209,7 +209,7 @@ export default function RemoteGuide(props) {
|
|||
API.post("/admin/policy", {
|
||||
policy: policyCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "存储策略已" + (props.policy ? "保存" : "添加"), "success");
|
||||
setActiveStep(5);
|
||||
})
|
||||
|
|
@ -422,8 +422,10 @@ export default function RemoteGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -455,8 +457,10 @@ export default function RemoteGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,25 @@
|
|||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../../../actions";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Collapse from "@material-ui/core/Collapse";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Radio from "@material-ui/core/Radio";
|
||||
import RadioGroup from "@material-ui/core/RadioGroup";
|
||||
import Step from "@material-ui/core/Step";
|
||||
import StepLabel from "@material-ui/core/StepLabel";
|
||||
import Stepper from "@material-ui/core/Stepper";
|
||||
import { lighten, makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../../actions";
|
||||
import API from "../../../../middleware/Api";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
import DomainInput from "../../Common/DomainInput";
|
||||
import SizeInput from "../../Common/SizeInput";
|
||||
import { useHistory } from "react-router";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import {getNumber, randomStr} from "../../../../utils";
|
||||
import MagicVar from "../../Dialogs/MagicVar";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
stepContent: {
|
||||
|
|
@ -96,7 +94,7 @@ export default function UpyunGuide(props) {
|
|||
|
||||
const [activeStep, setActiveStep] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [skipped, setSkipped] = React.useState(new Set());
|
||||
const [skipped,] = React.useState(new Set());
|
||||
const [magicVar, setMagicVar] = useState("");
|
||||
const [policy, setPolicy] = useState(props.policy?props.policy:{
|
||||
Type: "upyun",
|
||||
|
|
@ -170,7 +168,7 @@ export default function UpyunGuide(props) {
|
|||
API.post("/admin/policy", {
|
||||
policy: policyCopy
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "存储策略已"+ (props.policy ? "保存" : "添加"), "success");
|
||||
setActiveStep(5);
|
||||
})
|
||||
|
|
@ -427,8 +425,10 @@ export default function UpyunGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("path")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("path")
|
||||
}}
|
||||
>
|
||||
路径魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
@ -460,8 +460,10 @@ export default function UpyunGuide(props) {
|
|||
可用魔法变量可参考{" "}
|
||||
<Link
|
||||
color={"secondary"}
|
||||
href={"javascript:void()"}
|
||||
onClick={() => setMagicVar("file")}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
setMagicVar("file")
|
||||
}}
|
||||
>
|
||||
文件名魔法变量列表
|
||||
</Link>{" "}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import { policyTypeMap } from "../../../config";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import AddPolicy from "../Dialogs/AddPolicy";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import {useHistory, useLocation} from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import {Delete, Edit} from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Popover from "@material-ui/core/Popover";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import { Delete, Edit } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory, useLocation } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import { policyTypeMap } from "../../../config";
|
||||
import API from "../../../middleware/Api";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import AddPolicy from "../Dialogs/AddPolicy";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -78,8 +77,8 @@ function useQuery() {
|
|||
|
||||
export default function Policy() {
|
||||
const classes = useStyles();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [tab, setTab] = useState(0);
|
||||
// const [loading, setLoading] = useState(false);
|
||||
// const [tab, setTab] = useState(0);
|
||||
const [policies, setPolicies] = useState([]);
|
||||
const [statics, setStatics] = useState([]);
|
||||
const [page, setPage] = useState(1);
|
||||
|
|
@ -102,6 +101,12 @@ export default function Policy() {
|
|||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
useEffect(()=>{
|
||||
if(query.get("code") === "0"){
|
||||
|
|
@ -112,30 +117,30 @@ export default function Policy() {
|
|||
|
||||
},[location])
|
||||
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/policy/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: "id desc",
|
||||
conditions: filter === "all" ? {} : { type: filter }
|
||||
})
|
||||
.then(response => {
|
||||
setPolicies(response.data.items);
|
||||
setStatics(response.data.statics);
|
||||
setTotal(response.data.total);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize,filter]);
|
||||
|
||||
const loadList = () => {
|
||||
API.post("/admin/policy/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: "id desc",
|
||||
conditions: filter === "all" ? {} : { type: filter }
|
||||
})
|
||||
.then(response => {
|
||||
setPolicies(response.data.items);
|
||||
setStatics(response.data.statics);
|
||||
setTotal(response.data.total);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
|
||||
const deletePolicy = (id) =>{
|
||||
API.delete("/admin/policy/" + id,)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "存储策略已删除", "success");
|
||||
})
|
||||
|
|
@ -144,13 +149,6 @@ export default function Policy() {
|
|||
});
|
||||
}
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const open = Boolean(anchorEl);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -1,20 +1,19 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import API from "../../../middleware/Api";
|
||||
import AlertDialog from "../Dialogs/Alert";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -116,7 +115,7 @@ export default function Access() {
|
|||
API.patch("/admin/setting", {
|
||||
options: option
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Box from "@material-ui/core/Box";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -75,7 +72,7 @@ export default function Aria2() {
|
|||
|
||||
const reload = () => {
|
||||
API.get("/admin/reload/aria2")
|
||||
.then(response => {})
|
||||
.then(() => {})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
|
|
@ -111,7 +108,7 @@ export default function Aria2() {
|
|||
API.patch("/admin/setting",{
|
||||
options:option,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
reload();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import API from "../../../middleware/Api";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
|
|
@ -91,7 +91,7 @@ export default function ImageSetting() {
|
|||
API.patch("/admin/setting",{
|
||||
options:option,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Dialog from "@material-ui/core/Dialog";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import DialogContent from "@material-ui/core/DialogContent";
|
||||
import DialogContentText from "@material-ui/core/DialogContentText";
|
||||
import DialogTitle from "@material-ui/core/DialogTitle";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import DialogActions from "@material-ui/core/DialogActions";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -88,7 +88,7 @@ export default function Mail() {
|
|||
API.post("/admin/mailTest", {
|
||||
to: tesInput
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "测试邮件已发送", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -101,7 +101,7 @@ export default function Mail() {
|
|||
|
||||
const reload = () => {
|
||||
API.get("/admin/reload/email")
|
||||
.then(response => {})
|
||||
.then(() => {})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
|
|
@ -121,7 +121,7 @@ export default function Mail() {
|
|||
API.patch("/admin/setting", {
|
||||
options: option
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
reload();
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -89,7 +88,7 @@ export default function SiteInformation() {
|
|||
API.patch("/admin/setting",{
|
||||
options:option,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
|
|
@ -1,26 +1,26 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Delete } from "@material-ui/icons";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import { Delete } from "@material-ui/icons";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import TextField from "@material-ui/core/TextField";
|
||||
import API from "../../../middleware/Api";
|
||||
import CreateTheme from "../Dialogs/CreateTheme";
|
||||
import Alert from "@material-ui/lab/Alert";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -103,7 +103,7 @@ export default function Theme() {
|
|||
let res = JSON.parse(options.themes);
|
||||
let themeString = {};
|
||||
|
||||
Object.keys(res).map(k => {
|
||||
Object.keys(res).forEach(k => {
|
||||
themeString[k] = JSON.stringify(res[k]);
|
||||
});
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ export default function Theme() {
|
|||
API.patch("/admin/setting", {
|
||||
options: option
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -243,7 +243,7 @@ export default function Theme() {
|
|||
!('secondary' in res.palette) ||
|
||||
!('main' in res.palette.secondary)
|
||||
){
|
||||
throw "error";
|
||||
throw e
|
||||
}
|
||||
setTheme({
|
||||
...theme,
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import API from "../../../middleware/Api";
|
||||
import SizeInput from "../Common/SizeInput";
|
||||
import FormControlLabel from "@material-ui/core/FormControlLabel";
|
||||
import Switch from "@material-ui/core/Switch";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -106,7 +104,7 @@ export default function UploadDownload() {
|
|||
API.patch("/admin/setting",{
|
||||
options:option,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "设置已更改", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,27 @@
|
|||
import { lighten } from "@material-ui/core";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Delete, FilterList } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import { useLocation } from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import { Delete, FilterList } from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { lighten } from "@material-ui/core";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import API from "../../../middleware/Api";
|
||||
import ShareFilter from "../Dialogs/ShareFilter";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
|
|
@ -69,10 +68,6 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function useQuery() {
|
||||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function Share() {
|
||||
const classes = useStyles();
|
||||
const [shares, setShares] = useState([]);
|
||||
|
|
@ -88,11 +83,13 @@ export default function Share() {
|
|||
const [selected, setSelected] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const loadList = () => {
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/share/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
|
|
@ -110,12 +107,16 @@ export default function Share() {
|
|||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/share/delete", { id: [id] })
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "分享已删除", "success");
|
||||
})
|
||||
|
|
@ -127,10 +128,10 @@ export default function Share() {
|
|||
});
|
||||
};
|
||||
|
||||
const deleteBatch = e => {
|
||||
const deleteBatch = () => {
|
||||
setLoading(true);
|
||||
API.post("/admin/share/delete", { id: selected })
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "分享已删除", "success");
|
||||
})
|
||||
|
|
@ -142,13 +143,6 @@ export default function Share() {
|
|||
});
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const handleSelectAllClick = event => {
|
||||
if (event.target.checked) {
|
||||
const newSelecteds = shares.map(n => n.ID);
|
||||
|
|
|
|||
|
|
@ -1,30 +1,28 @@
|
|||
import { lighten } from "@material-ui/core";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Delete } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import { useLocation } from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import { Delete, FilterList } from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { lighten } from "@material-ui/core";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import API from "../../../middleware/Api";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import ShareFilter from "../Dialogs/ShareFilter";
|
||||
import {sizeToString} from "../../../utils";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -70,10 +68,6 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function useQuery() {
|
||||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function Download() {
|
||||
const classes = useStyles();
|
||||
const [downloads, setDownloads] = useState([]);
|
||||
|
|
@ -88,59 +82,6 @@ export default function Download() {
|
|||
const [selected, setSelected] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const loadList = () => {
|
||||
API.post("/admin/download/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: orderBy.join(" "),
|
||||
conditions: filter,
|
||||
searches: search
|
||||
})
|
||||
.then(response => {
|
||||
setUsers(response.data.users);
|
||||
setDownloads(response.data.items);
|
||||
setTotal(response.data.total);
|
||||
setSelected([]);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/download/delete", { id: [id] })
|
||||
.then(response => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const deleteBatch = e => {
|
||||
setLoading(true);
|
||||
API.post("/admin/download/delete", { id: selected })
|
||||
.then(response => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
|
|
@ -148,6 +89,59 @@ export default function Download() {
|
|||
[dispatch]
|
||||
);
|
||||
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/download/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
order_by: orderBy.join(" "),
|
||||
conditions: filter,
|
||||
searches: search
|
||||
})
|
||||
.then(response => {
|
||||
setUsers(response.data.users);
|
||||
setDownloads(response.data.items);
|
||||
setTotal(response.data.total);
|
||||
setSelected([]);
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/download/delete", { id: [id] })
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const deleteBatch = () => {
|
||||
setLoading(true);
|
||||
API.post("/admin/download/delete", { id: selected })
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
})
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const handleSelectAllClick = event => {
|
||||
if (event.target.checked) {
|
||||
const newSelecteds = downloads.map(n => n.ID);
|
||||
|
|
|
|||
|
|
@ -1,31 +1,28 @@
|
|||
import { lighten } from "@material-ui/core";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Delete } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import { useLocation } from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import { Delete, FilterList } from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { lighten } from "@material-ui/core";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import { getTaskProgress, getTaskStatus, getTaskType } from "../../../config";
|
||||
import API from "../../../middleware/Api";
|
||||
import ShareFilter from "../Dialogs/ShareFilter";
|
||||
import {sizeToString} from "../../../utils";
|
||||
import {getTaskProgress, getTaskStatus, getTaskType} from "../../../config";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -71,10 +68,6 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function useQuery() {
|
||||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function Task() {
|
||||
const classes = useStyles();
|
||||
const [tasks, setTasks] = useState([]);
|
||||
|
|
@ -89,11 +82,14 @@ export default function Task() {
|
|||
const [selected, setSelected] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const loadList = () => {
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/task/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
|
|
@ -110,12 +106,16 @@ export default function Task() {
|
|||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/task/delete", { id: [id] })
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
|
|
@ -127,10 +127,10 @@ export default function Task() {
|
|||
});
|
||||
};
|
||||
|
||||
const deleteBatch = e => {
|
||||
const deleteBatch = () => {
|
||||
setLoading(true);
|
||||
API.post("/admin/task/delete", { id: selected })
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "任务已删除", "success");
|
||||
})
|
||||
|
|
@ -142,13 +142,6 @@ export default function Task() {
|
|||
});
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const handleSelectAllClick = event => {
|
||||
if (event.target.checked) {
|
||||
const newSelecteds = tasks.map(n => n.ID);
|
||||
|
|
|
|||
|
|
@ -1,36 +1,30 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import { policyTypeMap } from "../../../config";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import AddPolicy from "../Dialogs/AddPolicy";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import { useHistory, useLocation } from "react-router";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import {Block, Delete, Edit, FilterList} from "@material-ui/icons";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Popover from "@material-ui/core/Popover";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { lighten } from "@material-ui/core";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import UserFilter from "../Dialogs/UserFilter";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Checkbox from "@material-ui/core/Checkbox";
|
||||
import IconButton from "@material-ui/core/IconButton";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableContainer from "@material-ui/core/TableContainer";
|
||||
import TableHead from "@material-ui/core/TableHead";
|
||||
import TablePagination from "@material-ui/core/TablePagination";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import Toolbar from "@material-ui/core/Toolbar";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { Block, Delete, Edit, FilterList } from "@material-ui/icons";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
import { sizeToString } from "../../../utils";
|
||||
import UserFilter from "../Dialogs/UserFilter";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -76,10 +70,6 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
function useQuery() {
|
||||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function Group() {
|
||||
const classes = useStyles();
|
||||
const [users, setUsers] = useState([]);
|
||||
|
|
@ -93,16 +83,17 @@ export default function Group() {
|
|||
const [selected, setSelected] = useState([]);
|
||||
const [loading,setLoading] = useState(false);
|
||||
|
||||
let location = useLocation();
|
||||
let history = useHistory();
|
||||
let query = useQuery();
|
||||
let theme = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const loadList = () => {
|
||||
const loadList = useCallback(() => {
|
||||
API.post("/admin/user/list", {
|
||||
page: page,
|
||||
page_size: pageSize,
|
||||
|
|
@ -118,12 +109,16 @@ export default function Group() {
|
|||
.catch(error => {
|
||||
ToggleSnackbar("top", "right", error.message, "error");
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadList();
|
||||
}, [page, pageSize, orderBy, filter, search]);
|
||||
|
||||
const deletePolicy = id => {
|
||||
setLoading(true);
|
||||
API.post("/admin/user/delete",{id:[id]})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "用户已删除", "success");
|
||||
})
|
||||
|
|
@ -134,10 +129,10 @@ export default function Group() {
|
|||
});
|
||||
};
|
||||
|
||||
const deleteBatch = e =>{
|
||||
const deleteBatch = () =>{
|
||||
setLoading(true);
|
||||
API.post("/admin/user/delete",{id:selected})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
loadList();
|
||||
ToggleSnackbar("top", "right", "用户已删除", "success");
|
||||
})
|
||||
|
|
@ -167,13 +162,6 @@ export default function Group() {
|
|||
});
|
||||
}
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const handleSelectAllClick = event => {
|
||||
if (event.target.checked) {
|
||||
const newSelecteds = users.map(n => n.ID);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { makeStyles, useTheme } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import API from "../../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import FormHelperText from "@material-ui/core/FormHelperText";
|
||||
import Input from "@material-ui/core/Input";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useHistory } from "react-router";
|
||||
import { toggleSnackbar } from "../../../actions";
|
||||
import API from "../../../middleware/Api";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
|
|
@ -48,9 +48,15 @@ export default function UserForm(props) {
|
|||
);
|
||||
const [groups, setGroups] = useState([]);
|
||||
|
||||
const theme = useTheme();
|
||||
let history = useHistory();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
API.get("/admin/groups")
|
||||
.then(response => {
|
||||
|
|
@ -68,13 +74,6 @@ export default function UserForm(props) {
|
|||
});
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const submit = e => {
|
||||
e.preventDefault();
|
||||
let userCopy = {...user};
|
||||
|
|
@ -89,7 +88,7 @@ export default function UserForm(props) {
|
|||
user: userCopy,
|
||||
password:userCopy.Password,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
history.push("/admin/user");
|
||||
ToggleSnackbar("top", "right", "用户已"+ (props.user ? "保存" : "添加"), "success");
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
import React, { useEffect, useState } from "react"
|
||||
import { useSelector } from "react-redux"
|
||||
import { Link, makeStyles, useMediaQuery, useTheme } from "@material-ui/core";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useLocation } from "react-router";
|
||||
import {
|
||||
makeStyles,
|
||||
Link,
|
||||
useTheme,
|
||||
useMediaQuery,
|
||||
} from "@material-ui/core"
|
||||
import pageHelper from '../../utils/page'
|
||||
import pageHelper from '../../utils/page';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
icp: {
|
||||
padding: '8px 24px',
|
||||
textAlign: 'right',
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const mapStateToProps = state => {
|
|||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = () => {
|
||||
return {
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +107,7 @@ class SnackbarCompoment extends Component {
|
|||
open:false,
|
||||
}
|
||||
|
||||
componentWillReceiveProps = (nextProps)=>{
|
||||
UNSAFE_componentWillReceiveProps = (nextProps)=>{
|
||||
if(nextProps.snackbar.toggle !== this.props.snackbar.toggle){
|
||||
this.setState({open:true});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,6 @@ function AutoHidden ({ children, enable }){
|
|||
{children}
|
||||
</Zoom>
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
export default AutoHidden
|
||||
|
|
@ -1,14 +1,9 @@
|
|||
import { Button, IconButton, Typography, withStyles } from "@material-ui/core";
|
||||
import RefreshIcon from "@material-ui/icons/Refresh";
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import RefreshIcon from "@material-ui/icons/Refresh";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import API from "../../middleware/Api";
|
||||
import {
|
||||
withStyles,
|
||||
Typography,
|
||||
Button,
|
||||
IconButton
|
||||
} from "@material-ui/core";
|
||||
import DownloadingCard from "./DownloadingCard";
|
||||
import FinishedCard from "./FinishedCard";
|
||||
|
||||
|
|
@ -60,7 +55,7 @@ const styles = theme => ({
|
|||
marginTop:theme.spacing(2),
|
||||
}
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
@ -131,7 +126,7 @@ class DownloadComponent extends Component {
|
|||
continue: response.data.length >= 10
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.props.toggleSnackbar("top", "right", "加载失败", "error");
|
||||
this.setState({
|
||||
loading: false
|
||||
|
|
|
|||
|
|
@ -1,37 +1,27 @@
|
|||
import React, { useCallback, useEffect } from "react";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
darken,
|
||||
IconButton,
|
||||
lighten,
|
||||
LinearProgress,
|
||||
makeStyles,
|
||||
Typography,
|
||||
useTheme
|
||||
} from "@material-ui/core";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import { hex2bin, sizeToString } from "../../utils";
|
||||
import PermMediaIcon from "@material-ui/icons/PermMedia";
|
||||
import TypeIcon from "../FileManager/TypeIcon";
|
||||
import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||
import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||
import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import { ExpandMore, HighlightOff } from "@material-ui/icons";
|
||||
import classNames from "classnames";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import { Card, CardContent, darken, IconButton, lighten, LinearProgress, makeStyles, Typography, useTheme } from "@material-ui/core";
|
||||
import Badge from "@material-ui/core/Badge";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import API from "../../middleware/Api";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||
import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||
import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||
import Grid from "@material-ui/core/Grid";
|
||||
import withStyles from "@material-ui/core/styles/withStyles";
|
||||
import Table from "@material-ui/core/Table";
|
||||
import TableBody from "@material-ui/core/TableBody";
|
||||
import TableCell from "@material-ui/core/TableCell";
|
||||
import TableRow from "@material-ui/core/TableRow";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
import { ExpandMore, HighlightOff } from "@material-ui/icons";
|
||||
import PermMediaIcon from "@material-ui/icons/PermMedia";
|
||||
import classNames from "classnames";
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import TimeAgo from "timeago-react";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import API from "../../middleware/Api";
|
||||
import { hex2bin, sizeToString } from "../../utils";
|
||||
import TypeIcon from "../FileManager/TypeIcon";
|
||||
import SelectFileDialog from "../Modals/SelectFile";
|
||||
|
||||
const ExpansionPanel = withStyles({
|
||||
|
|
@ -235,7 +225,7 @@ export default function DownloadingCard(props) {
|
|||
API.put("/aria2/select/" + task.info.gid, {
|
||||
indexes: newIndex
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setTask({
|
||||
...task,
|
||||
info: {
|
||||
|
|
@ -282,10 +272,10 @@ export default function DownloadingCard(props) {
|
|||
// eslint-disable-next-line
|
||||
}, [task, classes]);
|
||||
|
||||
const cancel = e => {
|
||||
const cancel = () => {
|
||||
setLoading(true);
|
||||
API.delete("/aria2/task/" + task.info.gid, )
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "任务已取消,状态会在稍后更新", "success");
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
@ -301,7 +291,7 @@ export default function DownloadingCard(props) {
|
|||
API.put("/aria2/select/" + task.info.gid, {
|
||||
indexes: fileIndex
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar("top", "right", "操作成功,状态会在稍后更新", "success");
|
||||
setSelectDialogOpen(false);
|
||||
})
|
||||
|
|
@ -392,7 +382,7 @@ export default function DownloadingCard(props) {
|
|||
<div className={classes.scroll}>
|
||||
<Table size="small">
|
||||
<TableBody>
|
||||
{activeFiles().map((value, key) => {
|
||||
{activeFiles().map((value) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={value.index}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import {
|
|||
Typography,
|
||||
useTheme
|
||||
} from "@material-ui/core";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { toggleSnackbar } from "../../actions";
|
||||
import { sizeToString } from "../../utils";
|
||||
import PermMediaIcon from "@material-ui/icons/PermMedia";
|
||||
import TypeIcon from "../FileManager/TypeIcon";
|
||||
|
|
@ -151,19 +149,12 @@ export default function FinishedCard(props) {
|
|||
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
|
||||
const handleChange = panel => (event, newExpanded) => {
|
||||
const handleChange = () => (event, newExpanded) => {
|
||||
setExpanded(!!newExpanded);
|
||||
};
|
||||
|
||||
const dispatch = useDispatch();
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
dispatch(toggleSnackbar(vertical, horizontal, msg, color)),
|
||||
[dispatch]
|
||||
);
|
||||
|
||||
const getPercent = (completed, total) => {
|
||||
if (total == 0) {
|
||||
if (total === 0) {
|
||||
return 0;
|
||||
}
|
||||
return (completed / total) * 100;
|
||||
|
|
@ -306,7 +297,7 @@ export default function FinishedCard(props) {
|
|||
<div className={classes.scroll}>
|
||||
<Table>
|
||||
<TableBody>
|
||||
{activeFiles().map((value, key) => {
|
||||
{activeFiles().map((value) => {
|
||||
return (
|
||||
<TableRow
|
||||
key={value.index}
|
||||
|
|
|
|||
|
|
@ -1,56 +1,30 @@
|
|||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
changeContextMenu,
|
||||
setNavigatorLoadingStatus,
|
||||
navitateTo,
|
||||
openCreateFolderDialog,
|
||||
openRenameDialog,
|
||||
openMoveDialog,
|
||||
openRemoveDialog,
|
||||
openShareDialog,
|
||||
showImgPreivew,
|
||||
openMusicDialog,
|
||||
toggleSnackbar,
|
||||
openRemoteDownloadDialog,
|
||||
openTorrentDownloadDialog,
|
||||
openGetSourceDialog,
|
||||
openCopyDialog,
|
||||
openLoadingDialog,
|
||||
setSelectedTarget,
|
||||
openDecompressDialog
|
||||
} from "../../actions/index";
|
||||
import { isCompressFile, isPreviewable, isTorrent } from "../../config";
|
||||
import { allowSharePreview } from "../../utils/index";
|
||||
import UploadIcon from "@material-ui/icons/CloudUpload";
|
||||
import DownloadIcon from "@material-ui/icons/CloudDownload";
|
||||
import NewFolderIcon from "@material-ui/icons/CreateNewFolder";
|
||||
import OpenFolderIcon from "@material-ui/icons/FolderOpen";
|
||||
import FileCopyIcon from "@material-ui/icons/FileCopy";
|
||||
import ShareIcon from "@material-ui/icons/Share";
|
||||
import { Divider, ListItemIcon, MenuItem, Typography, withStyles } from "@material-ui/core";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import { Archive, Unarchive } from "@material-ui/icons";
|
||||
import RenameIcon from "@material-ui/icons/BorderColor";
|
||||
import DownloadIcon from "@material-ui/icons/CloudDownload";
|
||||
import UploadIcon from "@material-ui/icons/CloudUpload";
|
||||
import NewFolderIcon from "@material-ui/icons/CreateNewFolder";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import FileCopyIcon from "@material-ui/icons/FileCopy";
|
||||
import OpenFolderIcon from "@material-ui/icons/FolderOpen";
|
||||
import MoveIcon from "@material-ui/icons/Input";
|
||||
import LinkIcon from "@material-ui/icons/InsertLink";
|
||||
import DeleteIcon from "@material-ui/icons/Delete";
|
||||
import OpenIcon from "@material-ui/icons/OpenInNew";
|
||||
import { MagnetOn } from "mdi-material-ui";
|
||||
import {
|
||||
withStyles,
|
||||
Typography,
|
||||
MenuItem,
|
||||
Divider,
|
||||
ListItemIcon
|
||||
} from "@material-ui/core";
|
||||
import pathHelper from "../../utils/page";
|
||||
import ShareIcon from "@material-ui/icons/Share";
|
||||
import { FolderUpload, MagnetOn } from "mdi-material-ui";
|
||||
import PropTypes from "prop-types";
|
||||
import React, { Component } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import { Archive, Unarchive } from "@material-ui/icons";
|
||||
import { openCompressDialog } from "../../actions";
|
||||
import Menu from "@material-ui/core/Menu";
|
||||
import {FolderUpload} from "mdi-material-ui";
|
||||
import { changeContextMenu, navitateTo, openCopyDialog, openCreateFolderDialog, openDecompressDialog, openGetSourceDialog, openLoadingDialog, openMoveDialog, openMusicDialog, openRemoteDownloadDialog, openRemoveDialog, openRenameDialog, openShareDialog, openTorrentDownloadDialog, setNavigatorLoadingStatus, setSelectedTarget, showImgPreivew, toggleSnackbar } from "../../actions/index";
|
||||
import { isCompressFile, isPreviewable, isTorrent } from "../../config";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import { allowSharePreview } from "../../utils/index";
|
||||
import pathHelper from "../../utils/page";
|
||||
|
||||
const styles = theme => ({
|
||||
const styles = () => ({
|
||||
propover: {
|
||||
minWidth: "200px!important"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import FileIcon from "../FileIcon";
|
|||
import { useSelector } from "react-redux";
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
dragging:{
|
||||
width:"200px",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,37 +1,19 @@
|
|||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
navitateTo,
|
||||
changeContextMenu,
|
||||
navitateUp,
|
||||
setSelectedTarget,
|
||||
openRemoveDialog,
|
||||
changeSortMethod,
|
||||
} from "../../actions/index";
|
||||
import ObjectIcon from "./ObjectIcon";
|
||||
import ContextMenu from "./ContextMenu";
|
||||
import EmptyIcon from "@material-ui/icons/Unarchive";
|
||||
import SadIcon from "@material-ui/icons/SentimentVeryDissatisfied";
|
||||
import classNames from "classnames";
|
||||
import ImgPreivew from "./ImgPreview";
|
||||
import pathHelper from "../../utils/page";
|
||||
import { isMac } from "../../utils"
|
||||
import { withRouter } from "react-router-dom";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableRow,
|
||||
withStyles,
|
||||
Typography,
|
||||
Grid,
|
||||
CircularProgress,
|
||||
Paper,
|
||||
} from "@material-ui/core";
|
||||
import { GlobalHotKeys, configure } from "react-hotkeys";
|
||||
import { CircularProgress, Grid, Paper, Table, TableBody, TableCell, TableHead, TableRow, Typography, withStyles } from "@material-ui/core";
|
||||
import TableSortLabel from "@material-ui/core/TableSortLabel";
|
||||
import SadIcon from "@material-ui/icons/SentimentVeryDissatisfied";
|
||||
import EmptyIcon from "@material-ui/icons/Unarchive";
|
||||
import classNames from "classnames";
|
||||
import PropTypes from "prop-types";
|
||||
import React, { Component } from "react";
|
||||
import { configure, GlobalHotKeys } from "react-hotkeys";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { changeContextMenu, changeSortMethod, navitateTo, navitateUp, openRemoveDialog, setSelectedTarget } from "../../actions/index";
|
||||
import { isMac } from "../../utils";
|
||||
import pathHelper from "../../utils/page";
|
||||
import ContextMenu from "./ContextMenu";
|
||||
import ImgPreivew from "./ImgPreview";
|
||||
import ObjectIcon from "./ObjectIcon";
|
||||
|
||||
const styles = theme => ({
|
||||
paper: {
|
||||
|
|
@ -220,7 +202,7 @@ class ExplorerCompoment extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
componentDidUpdate() {
|
||||
this.away = 0;
|
||||
}
|
||||
|
||||
|
|
@ -407,6 +389,7 @@ class ExplorerCompoment extends Component {
|
|||
{this.props.dirList.map(
|
||||
(value, index) => (
|
||||
<Grid
|
||||
key={value.id}
|
||||
item
|
||||
xs={6}
|
||||
md={3}
|
||||
|
|
@ -443,6 +426,7 @@ class ExplorerCompoment extends Component {
|
|||
{this.props.fileList.map(
|
||||
(value, index) => (
|
||||
<Grid
|
||||
key={value.id}
|
||||
item
|
||||
xs={6}
|
||||
md={3}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
import React, { Component } from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { connect } from "react-redux";
|
||||
import classNames from "classnames";
|
||||
import { LazyLoadImage } from "react-lazy-load-image-component";
|
||||
import ContentLoader from "react-content-loader";
|
||||
import { baseURL } from "../../middleware/Api";
|
||||
import {
|
||||
withStyles,
|
||||
ButtonBase,
|
||||
Typography,
|
||||
Divider,
|
||||
Tooltip
|
||||
} from "@material-ui/core";
|
||||
import TypeIcon from "./TypeIcon";
|
||||
import { ButtonBase, Divider, Tooltip, Typography, withStyles } from "@material-ui/core";
|
||||
import { lighten } from "@material-ui/core/styles";
|
||||
import classNames from "classnames";
|
||||
import PropTypes from "prop-types";
|
||||
import React, { Component } from "react";
|
||||
import ContentLoader from "react-content-loader";
|
||||
import { LazyLoadImage } from "react-lazy-load-image-component";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router";
|
||||
import { baseURL } from "../../middleware/Api";
|
||||
import pathHelper from "../../utils/page";
|
||||
import TypeIcon from "./TypeIcon";
|
||||
|
||||
const styles = theme => ({
|
||||
container: {
|
||||
|
|
@ -123,7 +117,7 @@ const mapStateToProps = state => {
|
|||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,14 @@
|
|||
import React, { Component } from 'react'
|
||||
|
||||
import Navigator from "./Navigator/Navigator"
|
||||
import { DndProvider } from 'react-dnd'
|
||||
import HTML5Backend from 'react-dnd-html5-backend'
|
||||
import { connect } from "react-redux"
|
||||
import { withRouter } from "react-router-dom"
|
||||
import { changeSubTitle, closeAllModals, navitateTo, setSelectedTarget, toggleSnackbar } from "../../actions"
|
||||
import pathHelper from "../../utils/page"
|
||||
import DragLayer from "./DnD/DragLayer"
|
||||
import Explorer from "./Explorer"
|
||||
import Modals from "./Modals"
|
||||
import {decode} from "../../utils/index"
|
||||
import { withStyles } from '@material-ui/core';
|
||||
import {connect} from "react-redux";
|
||||
import {
|
||||
changeSubTitle, closeAllModals, navitateTo, setSelectedTarget, toggleSnackbar,
|
||||
} from "../../actions";
|
||||
import {withRouter} from "react-router-dom";
|
||||
import pathHelper from "../../utils/page";
|
||||
const styles = theme => ({
|
||||
|
||||
})
|
||||
import Navigator from "./Navigator/Navigator"
|
||||
|
||||
const mapStateToProps = ()=>{
|
||||
|
||||
|
|
@ -43,15 +35,10 @@ const mapDispatchToProps = dispatch => {
|
|||
};
|
||||
|
||||
class FileManager extends Component {
|
||||
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.image = React.createRef();
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.props.setSelectedTarget([]);
|
||||
this.props.closeAllModals();
|
||||
|
|
@ -83,4 +70,4 @@ FileManager.propTypes = {
|
|||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withStyles(styles)(withRouter(FileManager)));
|
||||
)((withRouter(FileManager)));
|
||||
|
|
@ -10,7 +10,7 @@ import {withRouter} from "react-router";
|
|||
import {PhotoSlider} from "react-photo-view";
|
||||
import 'react-photo-view/dist/index.css';
|
||||
|
||||
const styles = theme => ({});
|
||||
const styles = () => ({});
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
|
@ -34,7 +34,7 @@ class ImagPreviewComponent extends Component {
|
|||
isOpen: false
|
||||
};
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
let items = [];
|
||||
let firstOne = 0;
|
||||
if (nextProps.first !== null) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import "react-image-lightbox/style.css";
|
|||
import pathHelper from "../../utils/page";
|
||||
import {withRouter} from "react-router";
|
||||
|
||||
const styles = theme => ({});
|
||||
const styles = () => ({});
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
|
@ -34,7 +34,7 @@ class ImgPreviewCompoment extends Component {
|
|||
isOpen: false
|
||||
};
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
let items = [];
|
||||
let firstOne = 0;
|
||||
if (nextProps.first !== null) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import CopyDialog from "../Modals/Copy";
|
|||
import CreatShare from "../Modals/CreateShare";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import pathHelper from "../../utils/page";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import DecompressDialog from "../Modals/Decompress";
|
||||
import CompressDialog from "../Modals/Compress";
|
||||
|
||||
|
|
@ -112,7 +111,7 @@ class ModalsCompoment extends Component {
|
|||
newNameSuffix = "";
|
||||
downloaded = false;
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
if (this.props.dndSignale !== nextProps.dndSignale) {
|
||||
this.dragMove(nextProps.dndSource, nextProps.dndTarget);
|
||||
return;
|
||||
|
|
@ -330,7 +329,7 @@ class ModalsCompoment extends Component {
|
|||
? "/"
|
||||
: this.state.selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.onClose();
|
||||
this.props.refreshFileList();
|
||||
this.props.setModalsLoading(false);
|
||||
|
|
@ -401,10 +400,10 @@ class ModalsCompoment extends Component {
|
|||
|
||||
// 检查重名
|
||||
if (
|
||||
this.props.dirList.findIndex((value, index) => {
|
||||
this.props.dirList.findIndex((value) => {
|
||||
return value.name === newName;
|
||||
}) !== -1 ||
|
||||
this.props.fileList.findIndex((value, index) => {
|
||||
this.props.fileList.findIndex((value) => {
|
||||
return value.name === newName;
|
||||
}) !== -1
|
||||
) {
|
||||
|
|
@ -421,7 +420,7 @@ class ModalsCompoment extends Component {
|
|||
src: src,
|
||||
new_name: newName
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.onClose();
|
||||
this.props.refreshFileList();
|
||||
this.props.setModalsLoading(false);
|
||||
|
|
@ -442,7 +441,7 @@ class ModalsCompoment extends Component {
|
|||
e.preventDefault();
|
||||
this.props.setModalsLoading(true);
|
||||
if (
|
||||
this.props.dirList.findIndex((value, index) => {
|
||||
this.props.dirList.findIndex((value) => {
|
||||
return value.name === this.state.newFolderName;
|
||||
}) !== -1
|
||||
) {
|
||||
|
|
@ -460,7 +459,7 @@ class ModalsCompoment extends Component {
|
|||
"/" +
|
||||
this.state.newFolderName
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.onClose();
|
||||
this.props.refreshFileList();
|
||||
this.props.setModalsLoading(false);
|
||||
|
|
@ -486,7 +485,7 @@ class ModalsCompoment extends Component {
|
|||
.post("/aria2/torrent/" + this.props.selected[0].id, {
|
||||
dst: this.state.selectedPath === "//" ? "/" : this.state.selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -515,7 +514,7 @@ class ModalsCompoment extends Component {
|
|||
url: this.state.downloadURL,
|
||||
dst: this.state.selectedPath === "//" ? "/" : this.state.selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ export default function DropDown(props) {
|
|||
<>
|
||||
{props.folders.map((folder, id) => (
|
||||
<DropDownItem
|
||||
key={id}
|
||||
path={"/" + props.folders.slice(0, id).join("/")}
|
||||
navigateTo={props.navigateTo}
|
||||
id={id}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import {
|
|||
IconButton
|
||||
} from "@material-ui/core";
|
||||
import PathButton from "./PathButton";
|
||||
import SaveIcon from '@material-ui/icons/Save';
|
||||
import DropDown from "./DropDown";
|
||||
import pathHelper from "../../../utils/page";
|
||||
import classNames from "classnames";
|
||||
|
|
@ -186,7 +185,7 @@ class NavigatorComponent extends Component {
|
|||
}
|
||||
|
||||
// 后退操作时重新导航
|
||||
window.onpopstate = event => {
|
||||
window.onpopstate = () => {
|
||||
var url = new URL(fixUrlHash(window.location.href));
|
||||
var c = url.searchParams.get("path");
|
||||
if (c !== null && c !== this.props.path) {
|
||||
|
|
@ -238,7 +237,7 @@ class NavigatorComponent extends Component {
|
|||
this.renderPath(path);
|
||||
};
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
if (this.props.keywords !== nextProps.keywords) {
|
||||
this.keywords = nextProps.keywords;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import { useHistory, useLocation } from "react-router-dom";
|
|||
import Auth from "../../middleware/Auth";
|
||||
import { pathBack } from "../../utils";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
container: {
|
||||
padding: "7px"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import classNames from 'classnames';
|
|||
import {
|
||||
toggleSnackbar,
|
||||
} from "../../actions/index"
|
||||
import axios from 'axios'
|
||||
|
||||
import {
|
||||
MenuList,
|
||||
|
|
@ -20,7 +19,6 @@ import {
|
|||
ListItemSecondaryAction,
|
||||
} from '@material-ui/core';
|
||||
import API from '../../middleware/Api'
|
||||
import { Api } from 'mdi-material-ui';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const styles = theme => ({
|
|||
border: "1px solid #d0d0d0",
|
||||
},
|
||||
backgroundColor:
|
||||
theme.palette.type == "dark"
|
||||
theme.palette.type === "dark"
|
||||
? "#fff"
|
||||
: lighten(theme.palette.primary.main,0.8),
|
||||
},
|
||||
|
|
@ -49,7 +49,7 @@ const styles = theme => ({
|
|||
color: theme.palette.text.secondary,
|
||||
},
|
||||
folderNameSelected: {
|
||||
color: theme.palette.type == "dark" ? theme.palette.background.paper : theme.palette.primary.dark,
|
||||
color: theme.palette.type === "dark" ? theme.palette.background.paper : theme.palette.primary.dark,
|
||||
fontWeight: "500",
|
||||
},
|
||||
folderNameNotSelected: {
|
||||
|
|
@ -70,7 +70,7 @@ const mapStateToProps = state => {
|
|||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = () => {
|
||||
return {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const mapStateToProps = state => {
|
|||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
const mapDispatchToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ function LoginForm() {
|
|||
|
||||
const classes = useStyles();
|
||||
|
||||
const refreshCaptcha = () => {
|
||||
const refreshCaptcha = useCallback(() => {
|
||||
API.get("/site/captcha")
|
||||
.then(response => {
|
||||
setCaptchaData(response.data);
|
||||
|
|
@ -139,7 +139,7 @@ function LoginForm() {
|
|||
"error"
|
||||
);
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
setEmail(query.get("username"));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import {
|
|||
import Placeholder from "../Placeholder/Captcha";
|
||||
import { useHistory } from "react-router-dom";
|
||||
import API from "../../middleware/Api";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import {
|
||||
Button,
|
||||
FormControl,
|
||||
|
|
@ -118,7 +117,7 @@ function Register() {
|
|||
|
||||
const classes = useStyles();
|
||||
|
||||
const refreshCaptcha = () => {
|
||||
const refreshCaptcha = useCallback(() => {
|
||||
API.get("/site/captcha")
|
||||
.then(response => {
|
||||
setCaptchaData(response.data);
|
||||
|
|
@ -131,7 +130,7 @@ function Register() {
|
|||
"error"
|
||||
);
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
const register = e =>{
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -113,11 +113,9 @@ function Reset() {
|
|||
userName: input.email,
|
||||
captchaCode: input.captcha
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
ToggleSnackbar("top", "right", "密码重置邮件已发送,请注意查收", "success");
|
||||
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
setLoading(false);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ function ResetForm() {
|
|||
id: query.get("id"),
|
||||
Password: input.password,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setLoading(false);
|
||||
history.push("/login");
|
||||
ToggleSnackbar("top", "right", "密码已重设", "success");
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ const styles = theme => ({
|
|||
},
|
||||
}
|
||||
})
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import {
|
|||
import {
|
||||
toggleSnackbar,
|
||||
setModalsLoading,
|
||||
refreshFileList,
|
||||
} from "../../actions/index";
|
||||
import PathSelector from "../FileManager/PathSelector";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
|
@ -93,7 +92,7 @@ export default function CompressDialog(props) {
|
|||
name:fileName,
|
||||
dst: selectedPath === "//" ? "/" : selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
props.onClose();
|
||||
ToggleSnackbar("top", "right", "压缩任务已创建", "success");
|
||||
SetModalsLoading(false);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export default function CopyDialog(props) {
|
|||
},
|
||||
dst: selectedPath === "//" ? "/" : selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
props.onClose();
|
||||
RefreshFileList();
|
||||
SetModalsLoading(false);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
CircularProgress
|
||||
} from "@material-ui/core";
|
||||
import { toggleSnackbar } from "../../actions/index";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import API from "../../middleware/Api";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItemText from "@material-ui/core/ListItemText";
|
||||
|
|
@ -23,7 +23,6 @@ import ListItemIcon from "@material-ui/core/ListItemIcon";
|
|||
import LockIcon from "@material-ui/icons/Lock";
|
||||
import TimerIcon from "@material-ui/icons/Timer";
|
||||
import CasinoIcon from "@material-ui/icons/Casino";
|
||||
import AccountBalanceWalletIcon from "@material-ui/icons/AccountBalanceWallet";
|
||||
import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
||||
|
|
@ -115,9 +114,6 @@ export default function CreatShare(props) {
|
|||
[dispatch]
|
||||
);
|
||||
|
||||
const scoreEnabled = useSelector(state => state.siteConfig.score_enabled);
|
||||
const scoreRate = useSelector(state => state.siteConfig.share_score_rate);
|
||||
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const [shareURL, setShareURL] = React.useState("");
|
||||
const [values, setValues] = React.useState({
|
||||
|
|
@ -153,7 +149,7 @@ export default function CreatShare(props) {
|
|||
event.preventDefault();
|
||||
};
|
||||
|
||||
const randomPassword = event => {
|
||||
const randomPassword = () => {
|
||||
setShareOption({ ...shareOption, password: true });
|
||||
setValues({
|
||||
...values,
|
||||
|
|
@ -169,7 +165,7 @@ export default function CreatShare(props) {
|
|||
setExpanded(isExpanded ? panel : false);
|
||||
};
|
||||
|
||||
const handleCheck = prop => event => {
|
||||
const handleCheck = prop => () => {
|
||||
if (!shareOption[prop]) {
|
||||
handleExpand(prop)(null, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import {
|
|||
import {
|
||||
toggleSnackbar,
|
||||
setModalsLoading,
|
||||
refreshFileList,
|
||||
} from "../../actions/index";
|
||||
import PathSelector from "../FileManager/PathSelector";
|
||||
import { useDispatch } from "react-redux";
|
||||
|
|
@ -72,7 +71,7 @@ export default function DecompressDialog(props) {
|
|||
src:filePath(props.selected[0]),
|
||||
dst: selectedPath === "//" ? "/" : selectedPath
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
props.onClose();
|
||||
ToggleSnackbar("top", "right", "解压缩任务已创建", "success");
|
||||
SetModalsLoading(false);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const useStyles = makeStyles({
|
|||
}
|
||||
});
|
||||
|
||||
export default function LoadingDialog(props) {
|
||||
export default function LoadingDialog() {
|
||||
const classes = useStyles();
|
||||
const open = useSelector(
|
||||
state => state.viewUpdate.modals.loading,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export default function SelectFileDialog(props) {
|
|||
setFiles(filesCopy);
|
||||
};
|
||||
|
||||
const submit = e =>{
|
||||
const submit = () =>{
|
||||
let index = [];
|
||||
// eslint-disable-next-line
|
||||
files.map(v=>{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import Tooltip from "@material-ui/core/Tooltip";
|
|||
import Auth from "../../middleware/Auth";
|
||||
import classNames from "classnames";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
icon: {
|
||||
color: 'rgb(255, 255, 255)',
|
||||
opacity: "0.54",
|
||||
|
|
@ -21,7 +21,7 @@ const DarkModeSwitcher = ({ position }) => {
|
|||
const ToggleThemeMode = useCallback(() => dispatch(toggleDaylightMode()), [
|
||||
dispatch
|
||||
]);
|
||||
const toggleMode = e => {
|
||||
const toggleMode = () => {
|
||||
Auth.SetPreference("theme_mode",isDayLight?"dark":"light");
|
||||
ToggleThemeMode();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import MuiExpansionPanel from "@material-ui/core/ExpansionPanel";
|
|||
import MuiExpansionPanelSummary from "@material-ui/core/ExpansionPanelSummary";
|
||||
import MuiExpansionPanelDetails from "@material-ui/core/ExpansionPanelDetails";
|
||||
import { navitateTo, searchMyFile, toggleSnackbar } from "../../actions";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useDispatch } from "react-redux";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import {
|
||||
Circle,
|
||||
|
|
@ -134,7 +134,7 @@ const icons = {
|
|||
|
||||
const AddTag = React.lazy(() => import ("../Modals/AddTag" ));
|
||||
|
||||
export default function FileTag(props) {
|
||||
export default function FileTag() {
|
||||
const classes = useStyles();
|
||||
|
||||
let location = useLocation();
|
||||
|
|
@ -152,7 +152,6 @@ export default function FileTag(props) {
|
|||
dispatch
|
||||
]);
|
||||
const NavigateTo = useCallback(k => dispatch(navitateTo(k)), [dispatch]);
|
||||
const isLogin = useSelector(state => state.viewUpdate.isLogin);
|
||||
|
||||
const ToggleSnackbar = useCallback(
|
||||
(vertical, horizontal, msg, color) =>
|
||||
|
|
@ -190,7 +189,7 @@ export default function FileTag(props) {
|
|||
|
||||
const submitDelete = id =>{
|
||||
API.delete("/tag/"+id)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
let newTags = tags.filter((v)=>{return v.id !== id});
|
||||
setTags(newTags)
|
||||
let user = Auth.GetUser();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import classNames from "classnames";
|
|||
import { connect } from "react-redux";
|
||||
import ShareIcon from "@material-ui/icons/Share";
|
||||
import BackIcon from "@material-ui/icons/ArrowBack";
|
||||
import SdStorage from "@material-ui/icons/SdStorage";
|
||||
import OpenIcon from "@material-ui/icons/OpenInNew";
|
||||
import DownloadIcon from "@material-ui/icons/CloudDownload";
|
||||
import OpenFolderIcon from "@material-ui/icons/FolderOpen";
|
||||
|
|
@ -276,25 +275,25 @@ class NavbarCompoment extends Component {
|
|||
this.UploaderRef = React.createRef();
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
this.unlisten = this.props.history.listen((location, action) => {
|
||||
this.setState(state => ({ mobileOpen: false }));
|
||||
UNSAFE_componentWillMount() {
|
||||
this.unlisten = this.props.history.listen(() => {
|
||||
this.setState(() => ({ mobileOpen: false }));
|
||||
});
|
||||
}
|
||||
componentWillUnmount() {
|
||||
this.unlisten();
|
||||
}
|
||||
|
||||
componentDidMount = () => {
|
||||
componentDidMount() {
|
||||
changeThemeColor(
|
||||
this.props.selected.length <= 1 &&
|
||||
!(!this.props.isMultiple && this.props.withFile)
|
||||
? this.props.theme.palette.primary.main
|
||||
: this.props.theme.palette.background.default
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
if (
|
||||
(this.props.selected.length <= 1 &&
|
||||
!(!this.props.isMultiple && this.props.withFile)) !==
|
||||
|
|
@ -960,7 +959,7 @@ class NavbarCompoment extends Component {
|
|||
open={this.state.mobileOpen}
|
||||
onClose={this.handleDrawerToggle}
|
||||
onOpen={() =>
|
||||
this.setState(state => ({ mobileOpen: true }))
|
||||
this.setState(() => ({ mobileOpen: true }))
|
||||
}
|
||||
disableDiscovery={iOS}
|
||||
ModalProps={{
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ configure({
|
|||
ignoreTags:[],
|
||||
});
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import {
|
|||
ListItem,
|
||||
ListItemIcon,
|
||||
ListItemText,
|
||||
List
|
||||
List,
|
||||
Hidden,
|
||||
} from "@material-ui/core";
|
||||
const drawerWidth = 240;
|
||||
const styles = theme => ({
|
||||
|
|
@ -64,12 +65,9 @@ class SideDrawer extends Component {
|
|||
classes={{
|
||||
paper: classes.drawerPaper
|
||||
}}
|
||||
anchor={theme.direction === "rtl" ? "right" : "left"}
|
||||
anchor="left"
|
||||
open={this.state.mobileOpen}
|
||||
onClose={this.handleDrawerToggle}
|
||||
classes={{
|
||||
paper: classes.drawerPaper
|
||||
}}
|
||||
ModalProps={{
|
||||
keepMounted: true // Better open performance on mobile.
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ import {
|
|||
Tooltip
|
||||
} from "@material-ui/core";
|
||||
import ButtonBase from "@material-ui/core/ButtonBase";
|
||||
import Link from "@material-ui/core/Link";
|
||||
import { withRouter } from "react-router";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
|
|
@ -90,7 +89,7 @@ class StorageBarCompoment extends Component {
|
|||
this.firstLoad = false;
|
||||
}
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
UNSAFE_componentWillReceiveProps = nextProps => {
|
||||
if (
|
||||
(this.props.isLogin && this.props.refresh !== nextProps.refresh) ||
|
||||
(this.props.isLogin !== nextProps.isLogin && nextProps.isLogin)
|
||||
|
|
@ -120,7 +119,7 @@ class StorageBarCompoment extends Component {
|
|||
total: sizeToString(response.data.total)
|
||||
});
|
||||
})
|
||||
.catch(error => {});
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
render() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
} from "mdi-material-ui";
|
||||
import {setSessionStatus, setUserPopover, toggleSnackbar} from "../../actions";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import pathHelper from "../../utils/page";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import {
|
||||
withStyles,
|
||||
|
|
@ -43,7 +42,7 @@ const mapDispatchToProps = dispatch => {
|
|||
},
|
||||
};
|
||||
};
|
||||
const styles = theme => ({
|
||||
const styles = () => ({
|
||||
avatar: {
|
||||
width: "30px",
|
||||
height: "30px"
|
||||
|
|
@ -77,9 +76,9 @@ class UserAvatarPopoverCompoment extends Component {
|
|||
window.location.href = url;
|
||||
};
|
||||
|
||||
sigOut = e => {
|
||||
sigOut = () => {
|
||||
API.delete("/user/session/")
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ class ErrorBoundary extends React.Component {
|
|||
this.state = { hasError: false };
|
||||
}
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
static getDerivedStateFromError() {
|
||||
// 更新 state 使下一次渲染能够显示降级后的 UI
|
||||
return { hasError: true };
|
||||
}
|
||||
|
||||
componentDidCatch(error, errorInfo) {
|
||||
componentDidCatch() {
|
||||
// 你同样可以将错误日志上报给服务器
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export default function Authn(props) {
|
|||
API.patch("/user/setting/authn", {
|
||||
id:id,
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
ToggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -187,7 +187,7 @@ export default function Authn(props) {
|
|||
</Typography>
|
||||
<Paper>
|
||||
<List className={classes.desenList}>
|
||||
{props.list.map((v, i) => (
|
||||
{props.list.map((v) => (
|
||||
<>
|
||||
<ListItem button
|
||||
style={{
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ const styles = theme => ({
|
|||
overflowX:"auto",
|
||||
}
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
export default function Tasks(props) {
|
||||
export default function Tasks() {
|
||||
const [tasks, setTasks] = useState([]);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [page, setPage] = useState(1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import DateIcon from "@material-ui/icons/DateRange";
|
|||
import EmailIcon from "@material-ui/icons/Email";
|
||||
import HomeIcon from "@material-ui/icons/Home";
|
||||
import LinkIcon from "@material-ui/icons/Phonelink";
|
||||
import AlarmOff from "@material-ui/icons/AlarmOff";
|
||||
import InputIcon from "@material-ui/icons/Input";
|
||||
import SecurityIcon from "@material-ui/icons/Security";
|
||||
import NickIcon from "@material-ui/icons/PermContactCalendar";
|
||||
|
|
@ -39,15 +38,12 @@ import {
|
|||
DialogTitle,
|
||||
Switch
|
||||
} from "@material-ui/core";
|
||||
import Backup from "@material-ui/icons/Backup";
|
||||
import SettingsInputHdmi from "@material-ui/icons/SettingsInputHdmi";
|
||||
import { blue, green, yellow } from "@material-ui/core/colors";
|
||||
import API from "../../middleware/Api";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import { withRouter } from "react-router";
|
||||
import TimeAgo from "timeago-react";
|
||||
import QRCode from "qrcode-react";
|
||||
import {Brightness3, Check, ConfirmationNumber, ListAlt, PermContactCalendar} from "@material-ui/icons";
|
||||
import {Brightness3, ListAlt, PermContactCalendar} from "@material-ui/icons";
|
||||
import { transformTime } from "../../utils";
|
||||
import Authn from "./Authn";
|
||||
|
||||
|
|
@ -271,7 +267,7 @@ class UserSettingCompoment extends Component {
|
|||
loading: "gravatar"
|
||||
});
|
||||
API.put("/user/setting/avatar")
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -302,7 +298,7 @@ class UserSettingCompoment extends Component {
|
|||
API.patch("/user/setting/nick", {
|
||||
nick: this.state.nick
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -338,7 +334,7 @@ class UserSettingCompoment extends Component {
|
|||
"Content-Type": "multipart/form-data"
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -366,7 +362,7 @@ class UserSettingCompoment extends Component {
|
|||
API.patch("/user/setting/homepage", {
|
||||
status: !this.state.settings.homepage
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -407,7 +403,7 @@ class UserSettingCompoment extends Component {
|
|||
old: this.state.oldPwd,
|
||||
new: this.state.newPwd
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -440,7 +436,7 @@ class UserSettingCompoment extends Component {
|
|||
.patch("/user/setting/theme", {
|
||||
theme: this.state.chosenTheme
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
@ -539,7 +535,7 @@ class UserSettingCompoment extends Component {
|
|||
API.patch("/user/setting/2fa", {
|
||||
code: this.state.authCode
|
||||
})
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
this.props.toggleSnackbar(
|
||||
"top",
|
||||
"right",
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ const useStyles = makeStyles(theme => ({
|
|||
}
|
||||
}));
|
||||
|
||||
export default function WebDAV(props) {
|
||||
export default function WebDAV() {
|
||||
const [tab, setTab] = useState(0);
|
||||
const [create, setCreate] = useState(false);
|
||||
const [accounts, setAccounts] = useState([]);
|
||||
|
|
@ -77,7 +77,7 @@ export default function WebDAV(props) {
|
|||
const deleteAccount = id => {
|
||||
let account = accounts[id];
|
||||
API.delete("/webdav/accounts/" + account.ID)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
let accountCopy = [...accounts];
|
||||
accountCopy = accountCopy.filter((v, i) => {
|
||||
return i !== id;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ const styles = theme => ({
|
|||
marginRottom: "10px"
|
||||
}
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ const styles = theme => ({
|
|||
marginTop: 5,
|
||||
}
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ class MyShareCompoment extends Component {
|
|||
removeShare = (id) => {
|
||||
API
|
||||
.delete("/share/"+id)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
let oldList = this.state.shareList;
|
||||
oldList = oldList.filter(value => {
|
||||
return value.key !== id;
|
||||
|
|
@ -208,7 +208,7 @@ class MyShareCompoment extends Component {
|
|||
shareList: response.data.items
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
this.props.toggleSnackbar("top", "right", "加载失败", "error");
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ function useQuery() {
|
|||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function SearchResult(props) {
|
||||
export default function SearchResult() {
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
|
@ -91,21 +91,12 @@ export default function SearchResult(props) {
|
|||
[dispatch]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
let keywords = query.get("keywords");
|
||||
if (keywords) {
|
||||
search(keywords, page, orderBy);
|
||||
} else {
|
||||
ToggleSnackbar("top", "right", "请输入搜索关键词", "warning");
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const [page, setPage] = useState(1);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [shareList, setShareList] = useState([]);
|
||||
const [orderBy, setOrderBy] = useState("created_at DESC");
|
||||
|
||||
const search = (keywords, page, orderBy) => {
|
||||
const search = useCallback((keywords, page, orderBy) => {
|
||||
let order = orderBy.split(" ");
|
||||
API.get(
|
||||
"/share/search?page=" +
|
||||
|
|
@ -129,10 +120,19 @@ export default function SearchResult(props) {
|
|||
setTotal(response.data.total);
|
||||
setShareList(response.data.items);
|
||||
})
|
||||
.catch(error => {
|
||||
.catch(() => {
|
||||
ToggleSnackbar("top", "right", "加载失败", "error");
|
||||
});
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let keywords = query.get("keywords");
|
||||
if (keywords) {
|
||||
search(keywords, page, orderBy);
|
||||
} else {
|
||||
ToggleSnackbar("top", "right", "请输入搜索关键词", "warning");
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const handlePageChange = (event, value) => {
|
||||
setPage(value);
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ export default function SharePreload() {
|
|||
} else {
|
||||
SetSubTitle();
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [share,SetSubTitle,ToggleSnackbar]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ const styles = theme => ({
|
|||
marginLeft: 8
|
||||
}
|
||||
});
|
||||
const mapStateToProps = state => {
|
||||
const mapStateToProps = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
|
|
@ -209,7 +209,7 @@ class SharedFileCompoment extends Component {
|
|||
callback(event);
|
||||
};
|
||||
|
||||
download = e => {
|
||||
download = () => {
|
||||
this.setState({ loading: true });
|
||||
API.put("/share/download/" + this.props.share.key)
|
||||
.then(response => {
|
||||
|
|
@ -231,9 +231,6 @@ class SharedFileCompoment extends Component {
|
|||
|
||||
render() {
|
||||
const { classes } = this.props;
|
||||
const user = Auth.GetUser();
|
||||
const isLogin = Auth.Check();
|
||||
|
||||
return (
|
||||
<div className={classes.layout}>
|
||||
<Modals />
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import {
|
|||
toggleSnackbar
|
||||
} from "../../actions";
|
||||
import { withStyles, Typography } from "@material-ui/core";
|
||||
import Auth from "../../middleware/Auth";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import FileManager from "../FileManager/FileManager";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
|
|
@ -75,7 +74,7 @@ const mapDispatchToProps = dispatch => {
|
|||
class SharedFolderComponent extends Component {
|
||||
state = {};
|
||||
|
||||
componentWillMount() {
|
||||
UNSAFE_componentWillMount() {
|
||||
window.shareInfo = this.props.share;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ import {
|
|||
Toolbar,
|
||||
IconButton,
|
||||
Typography,
|
||||
LinearProgress,
|
||||
Slide,
|
||||
Avatar,
|
||||
ListItemSecondaryAction,
|
||||
withWidth,
|
||||
DialogContent
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
import React from 'react'
|
||||
// import React from 'react'
|
||||
|
|
@ -98,7 +98,7 @@ class UploaderComponent extends Component {
|
|||
}
|
||||
};
|
||||
|
||||
componentWillReceiveProps({ isScriptLoaded, isScriptLoadSucceed }) {
|
||||
UNSAFE_componentWillReceiveProps({ isScriptLoaded, isScriptLoadSucceed }) {
|
||||
if (isScriptLoaded && !this.props.isScriptLoaded) {
|
||||
// load finished
|
||||
if (isScriptLoadSucceed) {
|
||||
|
|
@ -133,7 +133,7 @@ class UploaderComponent extends Component {
|
|||
init: {
|
||||
FilesAdded: this.fileAdd,
|
||||
|
||||
BeforeUpload: function(up, file) {},
|
||||
BeforeUpload: function() {},
|
||||
QueueChanged: up => {
|
||||
this.setState({ queued: up.total.queued });
|
||||
},
|
||||
|
|
@ -167,12 +167,12 @@ class UploaderComponent extends Component {
|
|||
this.props.refreshFileList();
|
||||
this.props.refreshStorage();
|
||||
},
|
||||
FileUploaded: function(up, file, info) {},
|
||||
FileUploaded: function() {},
|
||||
Error: (up, err, errTip) => {
|
||||
window.fileList["openFileList"]();
|
||||
window.fileList["setError"](err.file, errTip);
|
||||
},
|
||||
FilesRemoved: (up, files) => {}
|
||||
FilesRemoved: () => {}
|
||||
}
|
||||
});
|
||||
// this.fileList["openFileList"]();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React, { Suspense, useCallback, useEffect, useState } from "react";
|
|||
import { Paper, useTheme } from "@material-ui/core";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { useLocation, useParams, useRouteMatch } from "react-router";
|
||||
import API, { getBaseURL } from "../../middleware/Api";
|
||||
import API from "../../middleware/Api";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { changeSubTitle, toggleSnackbar } from "../../actions";
|
||||
import pathHelper from "../../utils/page";
|
||||
|
|
@ -10,7 +10,6 @@ import SaveButton from "../Dial/Save";
|
|||
import { codePreviewSuffix } from "../../config";
|
||||
import TextLoading from "../Placeholder/TextLoading";
|
||||
import FormControl from "@material-ui/core/FormControl";
|
||||
import InputLabel from "@material-ui/core/InputLabel";
|
||||
import Select from "@material-ui/core/Select";
|
||||
import MenuItem from "@material-ui/core/MenuItem";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
|
|
@ -51,7 +50,7 @@ function useQuery() {
|
|||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function CodeViewer(props) {
|
||||
export default function CodeViewer() {
|
||||
const [content, setContent] = useState("");
|
||||
const [status, setStatus] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
|
@ -121,7 +120,7 @@ export default function CodeViewer(props) {
|
|||
const save = () => {
|
||||
setStatus("loading");
|
||||
API.put("/file/update/" + query.get("id"), content)
|
||||
.then(response => {
|
||||
.then(() => {
|
||||
setStatus("success");
|
||||
setTimeout(() => setStatus(""), 2000);
|
||||
})
|
||||
|
|
@ -148,8 +147,8 @@ export default function CodeViewer(props) {
|
|||
new Set(Object.keys(codePreviewSuffix).map(k=>{
|
||||
return codePreviewSuffix[k]
|
||||
}))
|
||||
).map(extension => (
|
||||
<MenuItem value={extension}>
|
||||
).map((extension, index) => (
|
||||
<MenuItem value={extension} key={index}>
|
||||
{extension}
|
||||
</MenuItem>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {useDispatch} from "react-redux";
|
|||
import {changeSubTitle, toggleSnackbar} from "../../actions";
|
||||
import pathHelper from "../../utils/page";
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
const useStyles = makeStyles(() => ({
|
||||
layout: {
|
||||
width: "auto",
|
||||
marginTop: "-48px",
|
||||
|
|
@ -25,7 +25,7 @@ function useQuery() {
|
|||
return new URLSearchParams(useLocation().search);
|
||||
}
|
||||
|
||||
export default function DocViewer(props) {
|
||||
export default function DocViewer() {
|
||||
let [url,setURL] = useState("");
|
||||
const math = useRouteMatch();
|
||||
let location = useLocation();
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue