mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 19:29:56 +00:00
[eslint] updated eslintrc and improved the code (#4702)
This commit is contained in:
@@ -44,7 +44,7 @@ class DirentGridItem extends React.Component {
|
||||
onItemClick = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
|
||||
const dirent = this.props.dirent;
|
||||
if (this.props.dirent === this.props.activeDirent) {
|
||||
this.setState({isGridSelected: false});
|
||||
@@ -108,7 +108,7 @@ class DirentGridItem extends React.Component {
|
||||
|
||||
if (dropItemData.type !== 'dir') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let selectedPath = Utils.joinPath(this.props.path, this.props.dirent.name);
|
||||
this.onItemMove(this.props.currentRepoInfo, nodeDirent, selectedPath, nodeParentPath);
|
||||
@@ -131,7 +131,7 @@ class DirentGridItem extends React.Component {
|
||||
let dirent = this.props.dirent;
|
||||
this.props.onGridItemContextMenu(event, dirent);
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
let { dirent, path } = this.props;
|
||||
let direntPath = Utils.joinPath(path, dirent.name);
|
||||
@@ -150,7 +150,7 @@ class DirentGridItem extends React.Component {
|
||||
dirHref = siteRoot + 'library/' + this.props.repoID + '/' + this.props.currentRepoInfo.repo_name + Utils.encodePath(direntPath);
|
||||
}
|
||||
let fileHref = siteRoot + 'lib/' + this.props.repoID + '/file' + Utils.encodePath(direntPath);
|
||||
|
||||
|
||||
let gridClass = 'grid-file-img-link cursor-pointer';
|
||||
gridClass += this.state.isGridSelected ? ' grid-selected-active' : ' ';
|
||||
gridClass += this.state.isGridDropTipShow ? ' grid-drop-show' : ' ';
|
||||
@@ -161,14 +161,14 @@ class DirentGridItem extends React.Component {
|
||||
return(
|
||||
<Fragment>
|
||||
<li className="grid-item" onContextMenu={this.onGridItemContextMenu} onMouseDown={this.onGridItemMouseDown}>
|
||||
<div
|
||||
<div
|
||||
className={gridClass}
|
||||
draggable="true"
|
||||
draggable="true"
|
||||
onClick={this.onItemClick}
|
||||
onDragStart={this.onGridItemDragStart}
|
||||
onDragEnter={this.onGridItemDragEnter}
|
||||
onDragOver={this.onGridItemDragOver}
|
||||
onDragLeave={this.onGridItemDragLeave}
|
||||
onDragStart={this.onGridItemDragStart}
|
||||
onDragEnter={this.onGridItemDragEnter}
|
||||
onDragOver={this.onGridItemDragOver}
|
||||
onDragLeave={this.onGridItemDragLeave}
|
||||
onDrop={this.onGridItemDragDrop}
|
||||
>
|
||||
{dirent.encoded_thumbnail_src ?
|
||||
|
@@ -55,7 +55,7 @@ class DirentGridView extends React.Component{
|
||||
isImagePopupOpen: false,
|
||||
imageItems: [],
|
||||
imageIndex: 0,
|
||||
// onmenuClick
|
||||
// onmenuClick
|
||||
isShareDialogShow: false,
|
||||
isMoveDialogShow: false,
|
||||
isCopyDialogShow: false,
|
||||
@@ -119,13 +119,13 @@ class DirentGridView extends React.Component{
|
||||
onMenuItemClick = (operation, currentObject, event) => {
|
||||
hideMenu();
|
||||
switch(operation) {
|
||||
case 'Download':
|
||||
case 'Download':
|
||||
this.onItemDownload(currentObject, event);
|
||||
break;
|
||||
case 'Share':
|
||||
this.onItemShare(event);
|
||||
break;
|
||||
case 'Delete':
|
||||
case 'Delete':
|
||||
this.onItemDelete(currentObject, event);
|
||||
break;
|
||||
case 'Rename':
|
||||
@@ -271,7 +271,7 @@ class DirentGridView extends React.Component{
|
||||
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath});
|
||||
location.href = url;
|
||||
}
|
||||
|
||||
|
||||
onAccessLog = (currentObject) => {
|
||||
let filePath = this.getDirentPath(currentObject);
|
||||
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
|
||||
@@ -407,7 +407,7 @@ class DirentGridView extends React.Component{
|
||||
}
|
||||
|
||||
hideMenu();
|
||||
|
||||
|
||||
this.setState({activeDirent: currentObject});
|
||||
|
||||
let showMenuConfig = {
|
||||
@@ -439,7 +439,7 @@ class DirentGridView extends React.Component{
|
||||
if (this.props.isDirentListLoading) {
|
||||
return (<Loading />);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<ul className="grid-view" onClick={this.gridContainerClick} onContextMenu={this.onGridContainerContextMenu} onMouseDown={this.onGridContainerMouseDown}>
|
||||
@@ -464,11 +464,11 @@ class DirentGridView extends React.Component{
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
<ContextMenu
|
||||
<ContextMenu
|
||||
id={'grid-item-contextmenu'}
|
||||
onMenuItemClick={this.onMenuItemClick}
|
||||
/>
|
||||
<ContextMenu
|
||||
<ContextMenu
|
||||
id={'dirent-grid-container-menu'}
|
||||
onMenuItemClick={this.onMenuItemClick}
|
||||
/>
|
||||
@@ -481,7 +481,7 @@ class DirentGridView extends React.Component{
|
||||
addFolderCancel={this.onCreateFolderToggle}
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
)}
|
||||
{this.state.isCreateFileDialogShow && (
|
||||
<ModalPortal>
|
||||
<CreateFile
|
||||
@@ -492,8 +492,8 @@ class DirentGridView extends React.Component{
|
||||
/>
|
||||
</ModalPortal>
|
||||
)}
|
||||
{this.state.isMoveDialogShow &&
|
||||
<MoveDirentDialog
|
||||
{this.state.isMoveDialogShow &&
|
||||
<MoveDirentDialog
|
||||
path={this.props.path}
|
||||
repoID={this.props.repoID}
|
||||
repoEncrypted={this.props.currentRepoInfo.encrypted}
|
||||
@@ -535,7 +535,7 @@ class DirentGridView extends React.Component{
|
||||
}
|
||||
{this.state.isShareDialogShow &&
|
||||
<ModalPortal>
|
||||
<ShareDialog
|
||||
<ShareDialog
|
||||
itemType={dirent.type}
|
||||
itemName={dirent.name}
|
||||
itemPath={direntPath}
|
||||
|
Reference in New Issue
Block a user