mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
repair bug (#3272)
This commit is contained in:
@@ -68,6 +68,10 @@ class DirentListItem extends React.Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
highlight: false,
|
highlight: false,
|
||||||
isOperationShow: false,
|
isOperationShow: false,
|
||||||
|
}, () => {
|
||||||
|
if (nextProps.activeDirent && nextProps.activeDirent.name === nextProps.dirent.name) {
|
||||||
|
this.setState({isOperationShow: true});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -494,7 +498,7 @@ class DirentListItem extends React.Component {
|
|||||||
}
|
}
|
||||||
</Fragment> :
|
</Fragment> :
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{(this.state.isOperationShow || (activeDirent && dirent.name === activeDirent.name)) &&
|
{this.state.isOperationShow &&
|
||||||
<div className="operations">
|
<div className="operations">
|
||||||
<ul className="operation-group">
|
<ul className="operation-group">
|
||||||
<li className="operation-group-item">
|
<li className="operation-group-item">
|
||||||
|
@@ -18,14 +18,23 @@ class DirentMenu extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
isItemMenuShow: false
|
isItemMenuShow: false,
|
||||||
|
menuList: [],
|
||||||
};
|
};
|
||||||
this.menuList = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.menuList = this.calculateMenuList();
|
|
||||||
this.listenerId = listener.register(this.onShowMenu, this.onHideMenu);
|
this.listenerId = listener.register(this.onShowMenu, this.onHideMenu);
|
||||||
|
let { currentRepoInfo, dirent, isRepoOwner } = this.props;
|
||||||
|
let menuList = this.calculateMenuList(currentRepoInfo, dirent, isRepoOwner);
|
||||||
|
this.setState({menuList: menuList});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
let { currentRepoInfo, dirent, isRepoOwner } = nextProps;
|
||||||
|
let menuList = this.calculateMenuList(currentRepoInfo, dirent, isRepoOwner);
|
||||||
|
this.setState({menuList: menuList});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount () {
|
componentWillUnmount () {
|
||||||
@@ -45,8 +54,7 @@ class DirentMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateMenuList() {
|
calculateMenuList(currentRepoInfo, dirent, isRepoOwner) {
|
||||||
let { currentRepoInfo, dirent, isRepoOwner } = this.props;
|
|
||||||
|
|
||||||
let type = dirent.type;
|
let type = dirent.type;
|
||||||
let permission = dirent.permission;
|
let permission = dirent.permission;
|
||||||
@@ -172,7 +180,7 @@ class DirentMenu extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!this.menuList.length) {
|
if (!this.state.menuList.length) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -186,7 +194,7 @@ class DirentMenu extends React.Component {
|
|||||||
onClick={this.onDropdownToggleClick}
|
onClick={this.onDropdownToggleClick}
|
||||||
/>
|
/>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
{this.menuList.map((menuItem, index) => {
|
{this.state.menuList.map((menuItem, index) => {
|
||||||
if (menuItem === 'Divider') {
|
if (menuItem === 'Divider') {
|
||||||
return <DropdownItem key={index} divider/>;
|
return <DropdownItem key={index} divider/>;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -19,6 +19,7 @@ class RepoInfo {
|
|||||||
this.has_been_shared_out = object.has_been_shared_out;
|
this.has_been_shared_out = object.has_been_shared_out;
|
||||||
this.encrypted = object.encrypted;
|
this.encrypted = object.encrypted;
|
||||||
this.lib_need_decrypt = object.lib_need_decrypt;
|
this.lib_need_decrypt = object.lib_need_decrypt;
|
||||||
|
this.last_modified= object.last_modified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,6 +119,7 @@ class LibContentContainer extends React.Component {
|
|||||||
|
|
||||||
onItemSelected = (dirent) => {
|
onItemSelected = (dirent) => {
|
||||||
this.setState({currentDirent: dirent});
|
this.setState({currentDirent: dirent});
|
||||||
|
this.props.onItemSelected(dirent);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -173,7 +174,7 @@ class LibContentContainer extends React.Component {
|
|||||||
onAddFolder={this.props.onAddFolder}
|
onAddFolder={this.props.onAddFolder}
|
||||||
onAddFile={this.props.onAddFile}
|
onAddFile={this.props.onAddFile}
|
||||||
onItemClick={this.onItemClick}
|
onItemClick={this.onItemClick}
|
||||||
onItemSelected={this.props.onItemSelected}
|
onItemSelected={this.onItemSelected}
|
||||||
onItemDelete={this.props.onItemDelete}
|
onItemDelete={this.props.onItemDelete}
|
||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
@@ -236,7 +237,7 @@ class LibContentContainer extends React.Component {
|
|||||||
onAddFolder={this.props.onAddFolder}
|
onAddFolder={this.props.onAddFolder}
|
||||||
onAddFile={this.props.onAddFile}
|
onAddFile={this.props.onAddFile}
|
||||||
onItemClick={this.onItemClick}
|
onItemClick={this.onItemClick}
|
||||||
onItemSelected={this.props.onItemSelected}
|
onItemSelected={this.onItemSelected}
|
||||||
onItemDelete={this.props.onItemDelete}
|
onItemDelete={this.props.onItemDelete}
|
||||||
onItemRename={this.props.onItemRename}
|
onItemRename={this.props.onItemRename}
|
||||||
onItemMove={this.props.onItemMove}
|
onItemMove={this.props.onItemMove}
|
||||||
|
@@ -337,6 +337,7 @@ class RepoView(APIView):
|
|||||||
"has_been_shared_out": has_been_shared_out,
|
"has_been_shared_out": has_been_shared_out,
|
||||||
|
|
||||||
"lib_need_decrypt": lib_need_decrypt,
|
"lib_need_decrypt": lib_need_decrypt,
|
||||||
|
"last_modified": timestamp_to_isoformat_timestr(repo.last_modify),
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response(result)
|
return Response(result)
|
||||||
|
Reference in New Issue
Block a user