fix(state_mgr): incorrect state init
This commit is contained in:
parent
cf3332a22f
commit
101d47b2f7
5 changed files with 40 additions and 35 deletions
|
@ -478,23 +478,26 @@ export class Browser extends React.Component<Props, State, {}> {
|
||||||
});
|
});
|
||||||
|
|
||||||
const sharingList = this.props.sharings.map((dirPath: string) => {
|
const sharingList = this.props.sharings.map((dirPath: string) => {
|
||||||
<div key={dirPath} className="flex-list-container">
|
return (
|
||||||
<span className="flex-list-item-l">{dirPath}</span>
|
<div key={dirPath} className="flex-list-container">
|
||||||
<span className="flex-list-item-r">
|
<span className="flex-list-item-l">
|
||||||
<button
|
<span className="dot yellow3-bg"></span>
|
||||||
onClick={() => {
|
<span className="bold">{dirPath}</span>
|
||||||
this.deleteSharing(dirPath);
|
</span>
|
||||||
}}
|
<span className="flex-list-item-r padding-r-m">
|
||||||
className="grey1-bg white-font"
|
<button
|
||||||
>
|
onClick={() => {
|
||||||
Delete
|
this.deleteSharing(dirPath);
|
||||||
</button>
|
}}
|
||||||
</span>
|
className="grey1-bg white-font"
|
||||||
</div>;
|
>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("browser", this.props.sharings, this.props.isSharing);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div id="op-bar" className="op-bar">
|
<div id="op-bar" className="op-bar">
|
||||||
|
@ -535,7 +538,7 @@ export class Browser extends React.Component<Props, State, {}> {
|
||||||
<div className="flex-list-container bold">
|
<div className="flex-list-container bold">
|
||||||
<span className="flex-list-item-l">
|
<span className="flex-list-item-l">
|
||||||
<span className="dot black-bg"></span>
|
<span className="dot black-bg"></span>
|
||||||
<span>Uploading Files</span>
|
<span>Sharing Folders</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="flex-list-item-r padding-r-m"></span>
|
<span className="flex-list-item-r padding-r-m"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -179,7 +179,16 @@ export class Updater {
|
||||||
...prevState,
|
...prevState,
|
||||||
panel: {
|
panel: {
|
||||||
...prevState.panel,
|
...prevState.panel,
|
||||||
browser: { ...this.props }, // TODO: use spread
|
browser: {
|
||||||
|
dirPath: this.props.dirPath,
|
||||||
|
isSharing: this.props.isSharing,
|
||||||
|
items: this.props.items,
|
||||||
|
uploadings: this.props.uploadings,
|
||||||
|
sharings: this.props.sharings,
|
||||||
|
uploadFiles: this.props.uploadFiles,
|
||||||
|
uploadValue: this.props.uploadValue,
|
||||||
|
isVertical: this.props.isVertical,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,6 @@ export class RootFrame extends React.Component<Props, State, {}> {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const update = this.props.update;
|
const update = this.props.update;
|
||||||
console.log("rootframe", this.props.browser.isSharing);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="theme-white desktop">
|
<div className="theme-white desktop">
|
||||||
|
|
|
@ -38,44 +38,38 @@ export class StateMgr extends React.Component<Props, State, {}> {
|
||||||
return BrowserUpdater().refreshUploadings();
|
return BrowserUpdater().refreshUploadings();
|
||||||
})
|
})
|
||||||
.then((_: boolean) => {
|
.then((_: boolean) => {
|
||||||
BrowserUpdater().initUploads();
|
return BrowserUpdater().initUploads();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
BrowserUpdater().setSharing(BrowserUpdater().props.dirPath.join("/"));
|
return BrowserUpdater().setSharing(
|
||||||
|
BrowserUpdater().props.dirPath.join("/")
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
BrowserUpdater().listSharings();
|
return BrowserUpdater().listSharings();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.update(BrowserUpdater().setBrowser);
|
this.update(BrowserUpdater().setBrowser);
|
||||||
console.log("0", this.state, BrowserUpdater().props);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
PanesUpdater.self();
|
return PanesUpdater.self();
|
||||||
console.log("1", this.state);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
PanesUpdater.listRoles();
|
return PanesUpdater.listRoles();
|
||||||
console.log("2", this.state);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
PanesUpdater.listUsers();
|
return PanesUpdater.listUsers();
|
||||||
console.log("3", this.state);
|
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.update(PanesUpdater.updateState);
|
this.update(PanesUpdater.updateState);
|
||||||
console.log("final", this.state);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
update = (apply: (prevState: ICoreState) => ICoreState): void => {
|
update = (apply: (prevState: ICoreState) => ICoreState): void => {
|
||||||
this.setState(apply(this.state));
|
this.setState(apply(this.state));
|
||||||
console.log("core", this.state);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
console.log("state_mgr", this.state.panel.browser.isSharing);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootFrame
|
<RootFrame
|
||||||
authPane={this.state.panel.authPane}
|
authPane={this.state.panel.authPane}
|
||||||
|
|
|
@ -20,9 +20,9 @@ const (
|
||||||
RoleListNs = "roleList"
|
RoleListNs = "roleList"
|
||||||
InitTimeKey = "initTime"
|
InitTimeKey = "initTime"
|
||||||
|
|
||||||
defaultSpaceLimit = 1024 // 1GB
|
defaultSpaceLimit = 1024 * 1024 * 1024 // 1GB
|
||||||
defaultUploadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
defaultUploadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||||
defaultDownloadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
defaultDownloadSpeedLimit = 50 * 1024 * 1024 // 50MB
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue