From de63a0b6576f792dd516965a8e9bd16d57417e6b Mon Sep 17 00:00:00 2001
From: HFO4 <912394456@qq.com>
Date: Thu, 28 Apr 2022 18:12:58 +0800
Subject: [PATCH] fix: pagination should be reset after navigation
---
src/component/Admin/Group/EditGroup.js | 7 ++-
src/component/Admin/Group/GroupForm.js | 61 +++++++++++++++++++++++-
src/component/FileManager/Explorer.js | 1 -
src/component/FileManager/FileManager.js | 13 +++--
src/component/Navbar/Navbar.js | 1 -
src/redux/explorer/index.ts | 17 +++++++
src/redux/viewUpdate/reducer.ts | 2 +
7 files changed, 94 insertions(+), 8 deletions(-)
diff --git a/src/component/Admin/Group/EditGroup.js b/src/component/Admin/Group/EditGroup.js
index 20fb513..eaf5fa6 100644
--- a/src/component/Admin/Group/EditGroup.js
+++ b/src/component/Admin/Group/EditGroup.js
@@ -44,7 +44,12 @@ export default function EditGroupPreload() {
["MaxStorage", "SpeedLimit"].forEach((v) => {
response.data[v] = response.data[v].toString();
});
- ["compress_size", "decompress_size"].forEach((v) => {
+ [
+ "compress_size",
+ "decompress_size",
+ "source_batch",
+ "aria2_batch",
+ ].forEach((v) => {
if (response.data.OptionsSerialized[v] !== undefined) {
response.data.OptionsSerialized[
v
diff --git a/src/component/Admin/Group/GroupForm.js b/src/component/Admin/Group/GroupForm.js
index 0289cb6..fc0e4f2 100644
--- a/src/component/Admin/Group/GroupForm.js
+++ b/src/component/Admin/Group/GroupForm.js
@@ -65,6 +65,8 @@ export default function GroupForm(props) {
aria2_options: "{}", // json decode
compress_size: "0",
decompress_size: "0",
+ source_batch: "0",
+ aria2_batch: "1",
},
}
);
@@ -162,7 +164,12 @@ export default function GroupForm(props) {
["MaxStorage", "SpeedLimit"].forEach((v) => {
groupCopy[v] = parseInt(groupCopy[v]);
});
- ["compress_size", "decompress_size"].forEach((v) => {
+ [
+ "compress_size",
+ "decompress_size",
+ "source_batch",
+ "aria2_batch",
+ ].forEach((v) => {
if (groupCopy.OptionsSerialized[v] !== undefined) {
groupCopy.OptionsSerialized[v] = parseInt(
groupCopy.OptionsSerialized[v]
@@ -300,6 +307,34 @@ export default function GroupForm(props) {
+ {group.ID !== 3 && (
+
+
+
+ 批量生成外链数量限制
+
+
+
+ 对于支持的存储策略下的文件,允许用户单次批量获取外链的最大文件数量,填写为
+ 0 或空表示不允许批量生成外链。
+
+
+
+ )}
+
{group.ID !== 3 && (
@@ -442,6 +477,30 @@ export default function GroupForm(props) {
+
+
+
+ Aria2 批量下载最大数量
+
+
+
+ 允许用户单次批量创建的离线下载链接的最大数量
+
+
+
diff --git a/src/component/FileManager/Explorer.js b/src/component/FileManager/Explorer.js
index 0daa66a..7b823b9 100644
--- a/src/component/FileManager/Explorer.js
+++ b/src/component/FileManager/Explorer.js
@@ -33,7 +33,6 @@ const useStyles = makeStyles((theme) => ({
margin: "10px",
},
root: {
- flexGrow: 1,
padding: "10px",
},
rootTable: {
diff --git a/src/component/FileManager/FileManager.js b/src/component/FileManager/FileManager.js
index 37f659a..c02abba 100644
--- a/src/component/FileManager/FileManager.js
+++ b/src/component/FileManager/FileManager.js
@@ -28,15 +28,18 @@ const styles = (theme) => ({
[theme.breakpoints.down("xs")]: {
height: "100%",
},
- overflowY: "auto",
},
rootShare: {
display: "flex",
flexDirection: "column",
-
height: "100%",
minHeight: 500,
+ },
+ explorer: {
+ display: "flex",
+ flexDirection: "column",
overflowY: "auto",
+ minHeight: 500,
},
});
@@ -93,8 +96,10 @@ class FileManager extends Component {
isShare={this.props.isShare}
share={this.props.share}
/>
-
-
+
diff --git a/src/component/Navbar/Navbar.js b/src/component/Navbar/Navbar.js
index 5295c7a..dda14b2 100644
--- a/src/component/Navbar/Navbar.js
+++ b/src/component/Navbar/Navbar.js
@@ -798,7 +798,6 @@ class NavbarCompoment extends Component {
{this.props.selected.length === 0 &&
}
{this.props.selected.length === 0 &&
- isHomePage &&
pathHelper.isMobile() &&
}
diff --git a/src/redux/explorer/index.ts b/src/redux/explorer/index.ts
index 7fe70ad..a40126f 100644
--- a/src/redux/explorer/index.ts
+++ b/src/redux/explorer/index.ts
@@ -1,5 +1,6 @@
import * as actions from "./action";
import * as reducers from "./reducer";
+import { setPagination } from "../viewUpdate/action";
export default {
actions,
@@ -23,6 +24,14 @@ export const navigateTo = (path: any) => {
return (dispatch: any, getState: any) => {
const state = getState();
const navigatorLoading = path !== state.navigator.path;
+ if (navigatorLoading) {
+ dispatch(
+ setPagination({
+ ...state.viewUpdate.pagination,
+ page: 1,
+ })
+ );
+ }
dispatch(setNavigator(path, navigatorLoading));
};
};
@@ -33,6 +42,14 @@ export const navigateUp = () => {
pathSplit.pop();
const newPath = pathSplit.length === 1 ? "/" : pathSplit.join("/");
const navigatorLoading = newPath !== state.navigator.path;
+ if (navigatorLoading) {
+ dispatch(
+ setPagination({
+ ...state.viewUpdate.pagination,
+ page: 1,
+ })
+ );
+ }
dispatch(setNavigator(newPath, navigatorLoading));
};
};
diff --git a/src/redux/viewUpdate/reducer.ts b/src/redux/viewUpdate/reducer.ts
index 4b3adf6..b660a87 100644
--- a/src/redux/viewUpdate/reducer.ts
+++ b/src/redux/viewUpdate/reducer.ts
@@ -60,6 +60,7 @@ export interface ViewUpdateState {
};
openFileSelector: number;
openFolderSelector: number;
+ shareInfo: any;
}
export const initState: ViewUpdateState = {
// 是否登录
@@ -109,6 +110,7 @@ export const initState: ViewUpdateState = {
},
openFileSelector: 0,
openFolderSelector: 0,
+ shareInfo: null,
};
const viewUpdate = (state: ViewUpdateState = initState, action: AnyAction) => {
switch (action.type) {