fix(worker): refactor and fix issues of worker

This commit is contained in:
hexxa 2021-09-12 12:45:03 +08:00 committed by Hexxa
parent 8518072c7e
commit 4a5c68df17
13 changed files with 194 additions and 86 deletions

View file

@ -66,12 +66,14 @@ export const resps = {
size: 5,
modTime: "0",
isDir: false,
sha1: "mock_file_sha1",
},
{
name: "mock_dir",
size: 0,
modTime: "0",
isDir: true,
sha1: "",
},
],
},
@ -87,12 +89,14 @@ export const resps = {
size: 5,
modTime: "0",
isDir: false,
sha1: "mock_file_sha1",
},
{
name: "mock_dir",
size: 0,
modTime: "0",
isDir: true,
sha1: "",
},
],
},

View file

@ -26,6 +26,7 @@ export interface Item {
modTime: string;
isDir: boolean;
selected: boolean;
sha1: string;
}
export interface BrowserProps {
@ -162,8 +163,12 @@ export class Browser extends React.Component<Props, State, {}> {
this.props.browser.items,
this.state.selectedItems
)
.then(() => {
return updater().self();
})
.then(() => {
this.update(updater().updateBrowser);
this.update(updater().updateLogin);
this.setState({
selectedSrc: "",
selectedItems: Map<string, boolean>(),

View file

@ -10,7 +10,7 @@ import { AdminProps } from "./pane_admin";
import { MsgPackage } from "../i18n/msger";
import { Item } from "./browser";
import { UploadInfo, User } from "../client";
import { UploadInfo, User, MetadataResp } from "../client";
import { initUploadMgr, IWorker } from "../worker/upload_mgr";
export interface MsgProps {
@ -53,7 +53,7 @@ export function initState(): ICoreState {
browser: {
isVertical: isVertical(),
dirPath: List<string>(["."]),
items: List<Item>([]),
items: List<MetadataResp>([]),
sharings: List<string>([]),
isSharing: false,
uploadings: List<UploadInfo>([]),