fix: pagination should be reset after navigation

This commit is contained in:
HFO4 2022-04-28 18:12:58 +08:00
parent c59d74e2e2
commit de63a0b657
7 changed files with 94 additions and 8 deletions

View File

@ -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

View File

@ -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) {
</FormHelperText>
</div>
{group.ID !== 3 && (
<div className={classes.form}>
<FormControl fullWidth>
<InputLabel htmlFor="component-helper">
批量生成外链数量限制
</InputLabel>
<Input
multiline
type={"number"}
inputProps={{
min: 1,
step: 1,
}}
value={
group.OptionsSerialized.source_batch
}
onChange={handleOptionChange(
"source_batch"
)}
/>
<FormHelperText id="component-helper-text">
对于支持的存储策略下的文件允许用户单次批量获取外链的最大文件数量填写为
0 或空表示不允许批量生成外链
</FormHelperText>
</FormControl>
</div>
)}
{group.ID !== 3 && (
<div className={classes.form}>
<FormControl fullWidth>
@ -442,6 +477,30 @@ export default function GroupForm(props) {
</FormHelperText>
</FormControl>
</div>
<div className={classes.form}>
<FormControl fullWidth>
<InputLabel htmlFor="component-helper">
Aria2 批量下载最大数量
</InputLabel>
<Input
multiline
type={"number"}
inputProps={{
min: 1,
step: 1,
}}
value={
group.OptionsSerialized.aria2_batch
}
onChange={handleOptionChange(
"aria2_batch"
)}
/>
<FormHelperText id="component-helper-text">
允许用户单次批量创建的离线下载链接的最大数量
</FormHelperText>
</FormControl>
</div>
</Collapse>
<div className={classes.form}>

View File

@ -33,7 +33,6 @@ const useStyles = makeStyles((theme) => ({
margin: "10px",
},
root: {
flexGrow: 1,
padding: "10px",
},
rootTable: {

View File

@ -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}
/>
<Explorer share={this.props.share} />
<PaginationFooter />
<div className={classes.explorer}>
<Explorer share={this.props.share} />
<PaginationFooter />
</div>
<DragLayer />
</DndProvider>
<SideDrawer />

View File

@ -798,7 +798,6 @@ class NavbarCompoment extends Component {
{this.props.selected.length === 0 && <UserAvatar />}
{this.props.selected.length === 0 &&
isHomePage &&
pathHelper.isMobile() && <SubActions inherit />}
</Toolbar>
</AppBar>

View File

@ -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));
};
};

View File

@ -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) {