mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
repair bug
This commit is contained in:
@@ -5,6 +5,8 @@ import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap
|
|||||||
import { Link } from '@reach/router';
|
import { Link } from '@reach/router';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, siteRoot, isPro, username, folderPermEnabled } from '../../utils/constants';
|
import { gettext, siteRoot, isPro, username, folderPermEnabled } from '../../utils/constants';
|
||||||
|
import ModalPotal from '../../components/modal-portal';
|
||||||
|
import ShareDialog from '../../components/dialog/share-dialog';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
currentGroup: PropTypes.object,
|
currentGroup: PropTypes.object,
|
||||||
@@ -22,6 +24,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
highlight: false,
|
highlight: false,
|
||||||
isOperationShow: false,
|
isOperationShow: false,
|
||||||
isItemMenuShow: false,
|
isItemMenuShow: false,
|
||||||
|
isShowSharedDialog: false,
|
||||||
};
|
};
|
||||||
this.isDeparementOnwerGroupMember = false;
|
this.isDeparementOnwerGroupMember = false;
|
||||||
}
|
}
|
||||||
@@ -109,7 +112,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
this.onItemDetails();
|
this.onItemDetails();
|
||||||
break;
|
break;
|
||||||
case 'Share':
|
case 'Share':
|
||||||
this.onItemShared();
|
this.onItemShare();
|
||||||
break;
|
break;
|
||||||
case 'Unshare':
|
case 'Unshare':
|
||||||
this.onItemUnshare();
|
this.onItemUnshare();
|
||||||
@@ -133,6 +136,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
|
|
||||||
onItemShare = () => {
|
onItemShare = () => {
|
||||||
// todo
|
// todo
|
||||||
|
this.setState({isShowSharedDialog: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemUnshare = () => {
|
onItemUnshare = () => {
|
||||||
@@ -144,6 +148,10 @@ class SharedRepoListItem extends React.Component {
|
|||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleShareDialog = () => {
|
||||||
|
this.setState({isShowSharedDialog: false});
|
||||||
|
}
|
||||||
|
|
||||||
generatorOperations = () => {
|
generatorOperations = () => {
|
||||||
let { repo, currentGroup } = this.props;
|
let { repo, currentGroup } = this.props;
|
||||||
//todo this have a bug; use current api is not return admins param;
|
//todo this have a bug; use current api is not return admins param;
|
||||||
@@ -217,7 +225,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
// scene one: (share, delete, itemToggle and other operations);
|
// scene one: (share, delete, itemToggle and other operations);
|
||||||
// scene two: (share, unshare), (share), (unshare)
|
// scene two: (share, unshare), (share), (unshare)
|
||||||
let operations = this.generatorOperations();
|
let operations = this.generatorOperations();
|
||||||
const shareOperation = <a href="#" className="sf2-icon-share sf2-x op-icon" title={gettext("Share")} onClick={this.onItemShared}></a>;
|
const shareOperation = <a href="#" className="sf2-icon-share sf2-x op-icon" title={gettext("Share")} onClick={this.onItemShare}></a>;
|
||||||
const unshareOperation = <a href="#" className="sf2-icon-x3 sf2-x op-icon" title={gettext("Unshare")} onClick={this.onItemUnshare}></a>
|
const unshareOperation = <a href="#" className="sf2-icon-x3 sf2-x op-icon" title={gettext("Unshare")} onClick={this.onItemUnshare}></a>
|
||||||
const deleteOperation = <a href="#" className="sf2-icon-delete sf2-x op-icon" title={gettext('Delete')} onClick={this.onItemDelete}></a>;
|
const deleteOperation = <a href="#" className="sf2-icon-delete sf2-x op-icon" title={gettext('Delete')} onClick={this.onItemDelete}></a>;
|
||||||
|
|
||||||
@@ -267,14 +275,27 @@ class SharedRepoListItem extends React.Component {
|
|||||||
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
||||||
let { repo } = this.props;
|
let { repo } = this.props;
|
||||||
return (
|
return (
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
<Fragment>
|
||||||
<td><img src={iconUrl} title={repo.iconTitle} alt={iconTitle} width="24" /></td>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
||||||
<td><Link to={libPath}>{repo.repo_name}</Link></td>
|
<td><img src={iconUrl} title={repo.iconTitle} alt={iconTitle} width="24" /></td>
|
||||||
<td>{this.state.isOperationShow && this.generatorPCMenu()}</td>
|
<td><Link to={libPath}>{repo.repo_name}</Link></td>
|
||||||
<td>{repo.size}</td>
|
<td>{this.state.isOperationShow && this.generatorPCMenu()}</td>
|
||||||
<td title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</td>
|
<td>{repo.size}</td>
|
||||||
<td title={repo.owner_contact_email}>{repo.owner_name}</td>
|
<td title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</td>
|
||||||
</tr>
|
<td title={repo.owner_contact_email}>{repo.owner_name}</td>
|
||||||
|
</tr>
|
||||||
|
{this.state.isShowSharedDialog && (
|
||||||
|
<ModalPotal>
|
||||||
|
<ShareDialog
|
||||||
|
itemType={'library'}
|
||||||
|
itemName={repo.repo_name}
|
||||||
|
itemPath={'/'}
|
||||||
|
repoID={repo.repo_id}
|
||||||
|
toggleDialog={this.toggleShareDialog}
|
||||||
|
/>
|
||||||
|
</ModalPotal>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,16 +303,29 @@ class SharedRepoListItem extends React.Component {
|
|||||||
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
||||||
let { repo } = this.props;
|
let { repo } = this.props;
|
||||||
return (
|
return (
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
<Fragment>
|
||||||
<td><img src={iconUrl} title={iconTitle} alt={iconTitle}/></td>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
||||||
<td>
|
<td><img src={iconUrl} title={iconTitle} alt={iconTitle}/></td>
|
||||||
<Link to={libPath}>{repo.repo_name}</Link><br />
|
<td>
|
||||||
<span className="item-meta-info" title={repo.owner_contact_email}>{repo.owner_name}</span>
|
<Link to={libPath}>{repo.repo_name}</Link><br />
|
||||||
<span className="item-meta-info">{repo.size}</span>
|
<span className="item-meta-info" title={repo.owner_contact_email}>{repo.owner_name}</span>
|
||||||
<span className="item-meta-info" title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</span>
|
<span className="item-meta-info">{repo.size}</span>
|
||||||
</td>
|
<span className="item-meta-info" title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</span>
|
||||||
<td>{this.generatorMobileMenu()}</td>
|
</td>
|
||||||
</tr>
|
<td>{this.generatorMobileMenu()}</td>
|
||||||
|
</tr>
|
||||||
|
{this.state.isShowSharedDialog && (
|
||||||
|
<ModalPotal>
|
||||||
|
<ShareDialog
|
||||||
|
itemType={'library'}
|
||||||
|
itemName={repo.repo_name}
|
||||||
|
itemPath={'/'}
|
||||||
|
repoID={repo.repo_id}
|
||||||
|
toggleDialog={this.toggleShareDialog}
|
||||||
|
/>
|
||||||
|
</ModalPotal>
|
||||||
|
)}
|
||||||
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -264,13 +264,13 @@ class Item extends Component {
|
|||||||
</tr>
|
</tr>
|
||||||
{this.state.isShowSharedDialog && (
|
{this.state.isShowSharedDialog && (
|
||||||
<ModalPotal>
|
<ModalPotal>
|
||||||
<ShareDialog
|
<ShareDialog
|
||||||
itemType={'library'}
|
itemType={'library'}
|
||||||
itemName={data.repo_name}
|
itemName={data.repo_name}
|
||||||
itemPath={'/'}
|
itemPath={'/'}
|
||||||
repoID={data.repo_id}
|
repoID={data.repo_id}
|
||||||
toggleDialog={this.toggleShareDialog}
|
toggleDialog={this.toggleShareDialog}
|
||||||
/>
|
/>
|
||||||
</ModalPotal>
|
</ModalPotal>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
@@ -292,13 +292,13 @@ class Item extends Component {
|
|||||||
</tr>
|
</tr>
|
||||||
{this.state.isShowSharedDialog && (
|
{this.state.isShowSharedDialog && (
|
||||||
<ModalPotal>
|
<ModalPotal>
|
||||||
<ShareDialog
|
<ShareDialog
|
||||||
itemType={'library'}
|
itemType={'library'}
|
||||||
itemName={data.repo_name}
|
itemName={data.repo_name}
|
||||||
itemPath={'/'}
|
itemPath={'/'}
|
||||||
repoID={data.repo_id}
|
repoID={data.repo_id}
|
||||||
toggleDialog={this.toggleShareDialog}
|
toggleDialog={this.toggleShareDialog}
|
||||||
/>
|
/>
|
||||||
</ModalPotal>
|
</ModalPotal>
|
||||||
)}
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
@@ -204,7 +204,7 @@ urlpatterns = [
|
|||||||
url(r'^shared-libs/$', react_fake_view, name="shared_libs"),
|
url(r'^shared-libs/$', react_fake_view, name="shared_libs"),
|
||||||
url(r'^my-libs/$', react_fake_view, name="my_libs"),
|
url(r'^my-libs/$', react_fake_view, name="my_libs"),
|
||||||
url(r'^groups/$', react_fake_view, name="groups"),
|
url(r'^groups/$', react_fake_view, name="groups"),
|
||||||
url(r'^group/(?P<group_id>\d+)/$', react_group, name="group"),
|
url(r'^group/.*$', react_fake_view, name="group"),
|
||||||
url(r'^library/.*$', react_fake_view, name="lib_view"),
|
url(r'^library/.*$', react_fake_view, name="lib_view"),
|
||||||
url(r'^my-libs/deleted/$', react_fake_view, name="my_libs_deleted"),
|
url(r'^my-libs/deleted/$', react_fake_view, name="my_libs_deleted"),
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user