1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

[eslint] updated eslintrc and improved the code (#4702)

This commit is contained in:
llj
2020-11-02 13:56:35 +08:00
committed by GitHub
parent ed3e5fc416
commit 04f29704b3
337 changed files with 1586 additions and 1585 deletions

View File

@@ -201,13 +201,13 @@ class DirentListItem extends React.Component {
onMenuItemClick = (operation, event) => {
switch(operation) {
case 'Download':
case 'Download':
this.onItemDownload(event);
break;
case 'Share':
this.onItemShare(event);
break;
case 'Delete':
case 'Delete':
this.onItemDelete(event);
break;
case 'Rename':
@@ -303,7 +303,7 @@ class DirentListItem extends React.Component {
toaster.danger(errMessage);
});
}
onUnlockItem = () => {
let repoID = this.props.repoID;
let filePath = this.getDirentPath(this.props.dirent);
@@ -323,7 +323,7 @@ class DirentListItem extends React.Component {
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath});
location.href = url;
}
onAccessLog = () => {
let filePath = this.getDirentPath(this.props.dirent);
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
@@ -411,7 +411,7 @@ class DirentListItem extends React.Component {
this.setState({isDropTipshow: true});
}
}
onItemDragOver = (e) => {
if (Utils.isIEBrower()) {
return false;
@@ -459,7 +459,7 @@ class DirentListItem extends React.Component {
if (direntPaths.some(direntPath => { return direntPath === selectedPath;})) { //eg; A/B, A/C --> A/B
return;
}
this.props.onItemsMove(this.props.currentRepoInfo, selectedPath);
return ;
}
@@ -501,7 +501,7 @@ class DirentListItem extends React.Component {
return (
<Fragment>
{selectedDirentList.length > 1 ?
{selectedDirentList.length > 1 ?
<Fragment>
{this.state.isOperationShow && !dirent.isSelected &&
<div className="operations">
@@ -535,9 +535,9 @@ class DirentListItem extends React.Component {
</ul>
</div>
}
</Fragment> :
</Fragment> :
<Fragment>
{this.state.isOperationShow &&
{this.state.isOperationShow &&
<div className="operations">
<ul className="operation-group">
{(dirent.permission === 'rw' || dirent.permission === 'r') && (
@@ -602,17 +602,17 @@ class DirentListItem extends React.Component {
const isDesktop = Utils.isDesktop();
const desktopItem = (
<tr
className={trClass}
<tr
className={trClass}
draggable="true"
onMouseEnter={this.onMouseEnter}
onMouseOver={this.onMouseOver}
onMouseLeave={this.onMouseLeave}
onClick={this.onDirentClick}
onDragStart={this.onItemDragStart}
onDragEnter={this.onItemDragEnter}
onDragOver={this.onItemDragOver}
onDragLeave={this.onItemDragLeave}
onMouseEnter={this.onMouseEnter}
onMouseOver={this.onMouseOver}
onMouseLeave={this.onMouseLeave}
onClick={this.onDirentClick}
onDragStart={this.onItemDragStart}
onDragEnter={this.onItemDragEnter}
onDragOver={this.onItemDragOver}
onDragLeave={this.onItemDragLeave}
onDrop={this.onItemDragDrop}
onMouseDown={this.onItemMouseDown}
onContextMenu={this.onItemContextMenu}
@@ -655,13 +655,13 @@ class DirentListItem extends React.Component {
{tagTitle}
</UncontrolledTooltip>
</Fragment>
)}
)}
</td>
<td className="operation">{this.renderItemOperation()}</td>
<td className="file-size">{dirent.size && dirent.size}</td>
<td className="last-update">{dirent.mtime_relative}</td>
</tr>
);
);
const mobileItem = (
<tr>
<td>
@@ -708,11 +708,11 @@ class DirentListItem extends React.Component {
</Dropdown>
</td>
</tr>
);
);
return (
<Fragment>
{isDesktop ? desktopItem : mobileItem}
{isDesktop ? desktopItem : mobileItem}
{this.state.isMoveDialogShow &&
<ModalPortal>
<MoveDirentDialog
@@ -760,7 +760,7 @@ class DirentListItem extends React.Component {
}
{this.state.isShareDialogShow &&
<ModalPortal>
<ShareDialog
<ShareDialog
itemType={dirent.type}
itemName={dirent.name}
itemPath={direntPath}
@@ -775,7 +775,7 @@ class DirentListItem extends React.Component {
}
{this.state.isPermissionDialogOpen &&
<ModalPortal>
<LibSubFolderPermissionDialog
<LibSubFolderPermissionDialog
toggleDialog={this.onPermissionItem}
repoID={this.props.repoID}
folderPath={direntPath}

View File

@@ -251,7 +251,7 @@ class DirentListView extends React.Component {
});
this.setState({
isProgressDialogShow: true,
isProgressDialogShow: true,
downloadItems: selectedDirentNames
});
}
@@ -356,7 +356,7 @@ class DirentListView extends React.Component {
case 'New File':
this.onCreateFileToggle();
break;
default:
default:
break;
}
@@ -377,7 +377,7 @@ class DirentListView extends React.Component {
case 'Delete':
this.props.onItemsDelete();
break;
default:
default:
break;
}
@@ -437,7 +437,7 @@ class DirentListView extends React.Component {
index = i;
break;
}
}
}
return index;
}
@@ -446,7 +446,7 @@ class DirentListView extends React.Component {
const currentRepoInfo = this.props.currentRepoInfo;
return Utils.getDirentOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu);
}
onTableDragEnter = (e) => {
if (Utils.isIEBrower()) {
return false;
@@ -539,10 +539,10 @@ class DirentListView extends React.Component {
const isDesktop = Utils.isDesktop();
return (
<div
<div
className={`table-container ${this.state.isListDropTipShow ? 'table-drop-active' : ''}`}
onMouseDown={this.onContainerMouseDown}
onContextMenu={this.onContainerContextMenu}
onMouseDown={this.onContainerMouseDown}
onContextMenu={this.onContainerContextMenu}
onClick={this.onContainerClick}
onDragEnter={this.onTableDragEnter}
onDragOver={this.onTableDragOver}
@@ -551,20 +551,20 @@ class DirentListView extends React.Component {
>
<table className={`table-hover ${isDesktop ? '': 'table-thead-hidden'}`}>
{isDesktop ? (
<thead onMouseDown={this.onThreadMouseDown} onContextMenu={this.onThreadContextMenu}>
<tr>
<th width="3%" className="pl10">
<input type="checkbox" className="vam" onChange={this.props.onAllItemSelected} checked={this.props.isAllItemSelected}/>
</th>
<th width="3%" className="pl10">{/*icon */}</th>
<th width="5%" className="pl10">{/*star */}</th>
<th width="39%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
<th width="6%">{/*tag */}</th>
<th width="18%">{/*operation */}</th>
<th width="11%"><a className="d-block table-sort-op" href="#" onClick={this.sortBySize}>{gettext('Size')} {sortBySize && sortIcon}</a></th>
<th width="15%"><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Last Update')} {sortByTime && sortIcon}</a></th>
</tr>
</thead>
<thead onMouseDown={this.onThreadMouseDown} onContextMenu={this.onThreadContextMenu}>
<tr>
<th width="3%" className="pl10">
<input type="checkbox" className="vam" onChange={this.props.onAllItemSelected} checked={this.props.isAllItemSelected}/>
</th>
<th width="3%" className="pl10">{/*icon */}</th>
<th width="5%" className="pl10">{/*star */}</th>
<th width="39%"><a className="d-block table-sort-op" href="#" onClick={this.sortByName}>{gettext('Name')} {sortByName && sortIcon}</a></th>
<th width="6%">{/*tag */}</th>
<th width="18%">{/*operation */}</th>
<th width="11%"><a className="d-block table-sort-op" href="#" onClick={this.sortBySize}>{gettext('Size')} {sortBySize && sortIcon}</a></th>
<th width="15%"><a className="d-block table-sort-op" href="#" onClick={this.sortByTime}>{gettext('Last Update')} {sortByTime && sortIcon}</a></th>
</tr>
</thead>
) : (
<thead>
<tr>
@@ -617,11 +617,11 @@ class DirentListView extends React.Component {
</tbody>
</table>
<Fragment>
<ContextMenu
<ContextMenu
id={'dirent-container-menu'}
onMenuItemClick={this.onContainerMenuItemClick}
/>
<ContextMenu
<ContextMenu
id={'dirent-item-menu'}
onMenuItemClick={this.onMenuItemClick}
onShowMenu={this.onShowMenu}
@@ -631,9 +631,9 @@ class DirentListView extends React.Component {
id={'dirents-menu'}
onMenuItemClick={this.onDirentsMenuItemClick}
/>
{this.state.isShowDirentsDraggablePreview &&
{this.state.isShowDirentsDraggablePreview &&
<ModalPortal>
<DirentsDraggedPreview
<DirentsDraggedPreview
selectedDirentList={this.props.selectedDirentList}
onHideDirentsDraggablePreview={this.onHideDirentsDraggablePreview}
dragStartPosition={this.state.dragStartPosition}
@@ -660,7 +660,7 @@ class DirentListView extends React.Component {
addFolderCancel={this.onCreateFolderToggle}
/>
</ModalPortal>
)}
)}
{this.state.isCreateFileDialogShow && (
<ModalPortal>
<CreateFile
@@ -672,8 +672,8 @@ class DirentListView 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}
@@ -695,11 +695,11 @@ class DirentListView extends React.Component {
/>
}
{this.state.isProgressDialogShow &&
<ZipDownloadDialog
<ZipDownloadDialog
repoID={this.props.repoID}
path={this.props.path}
target={this.state.downloadItems}
toggleDialog={this.onCloseZipDownloadDialog}
toggleDialog={this.onCloseZipDownloadDialog}
/>
}
</Fragment>

View File

@@ -21,7 +21,7 @@ class DirentNodeView extends React.Component {
fileType: '',
isCreateFileDialogShow: false,
};
}
}
onCreateNewFile = (type) => {
this.setState({