1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +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

@@ -288,8 +288,8 @@ class FileChooser extends React.Component {
if (this.state.isResultGot && this.state.searchResults.length > 0) {
return (
<SearchedListView
searchResults={this.state.searchResults}
<SearchedListView
searchResults={this.state.searchResults}
onItemClick={this.onSearchedItemClick}
onSearchedItemDoubleClick={this.onSearchedItemDoubleClick}
/>);
@@ -300,7 +300,7 @@ class FileChooser extends React.Component {
if (item.type !== 'dir') {
return;
}
let selectedItemInfo = {
repoID: item.repo_id,
filePath: item.path,
@@ -383,12 +383,12 @@ class FileChooser extends React.Component {
</div>
{
this.state.isCurrentRepoShow && this.state.currentRepoInfo &&
<RepoListView
<RepoListView
initToShowChildren={true}
currentRepoInfo={this.state.currentRepoInfo}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
fileSuffixes={this.props.fileSuffixes}
@@ -402,18 +402,18 @@ class FileChooser extends React.Component {
<span className="library">{gettext('Other Libraries')}</span>
</div>
{
this.state.isOtherRepoShow &&
<RepoListView
this.state.isOtherRepoShow &&
<RepoListView
initToShowChildren={false}
repoList={this.state.repoList}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
fileSuffixes={this.props.fileSuffixes}
selectedItemInfo={this.state.selectedItemInfo}
/>
/>
}
</div>
</Fragment>
@@ -426,12 +426,12 @@ class FileChooser extends React.Component {
</div>
{
this.state.isCurrentRepoShow && this.state.currentRepoInfo &&
<RepoListView
<RepoListView
initToShowChildren={true}
currentRepoInfo={this.state.currentRepoInfo}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
fileSuffixes={this.props.fileSuffixes}
@@ -447,17 +447,17 @@ class FileChooser extends React.Component {
<span className="item-toggle fa fa-caret-down"></span>
<span className="library">{gettext('Libraries')}</span>
</div>
<RepoListView
<RepoListView
initToShowChildren={false}
repoList={this.state.repoList}
selectedRepo={this.state.selectedRepo}
selectedPath={this.state.selectedPath}
onRepoItemClick={this.onRepoItemClick}
onRepoItemClick={this.onRepoItemClick}
onDirentItemClick={this.onDirentItemClick}
isShowFile={this.props.isShowFile}
fileSuffixes={this.props.fileSuffixes}
selectedItemInfo={this.state.selectedItemInfo}
/>
/>
</div>
</div>
)}

View File

@@ -101,7 +101,7 @@ class RepoListItem extends React.Component {
loadNodeAndParentsByPath = (repoID, path) => {
let tree = this.state.treeData.clone();
seafileAPI.listDir(repoID, path, {with_parents: true}).then(res => {
let direntList = res.data.dirent_list;
direntList = direntList.filter(item => item.type === 'dir');
@@ -169,13 +169,13 @@ class RepoListItem extends React.Component {
<div className="item-left-icon">
<span className={`item-toggle icon fa ${this.state.isShowChildren ? 'fa-caret-down' : 'fa-caret-right'}`} onClick={this.onToggleClick}></span>
<i className="tree-node-icon">
<span className="icon far fa-folder tree-node-icon"></span>
<span className="icon far fa-folder tree-node-icon"></span>
</i>
</div>
</div>
{this.state.isShowChildren && (
<TreeListView
repo={this.props.repo}
<TreeListView
repo={this.props.repo}
onDirentItemClick={this.onDirentItemClick}
selectedRepo={this.props.selectedRepo}
selectedPath={this.props.selectedPath}

View File

@@ -28,13 +28,13 @@ class RepoListView extends React.Component {
<ul className="list-view-content file-chooser-item">
{repoList.length > 0 && repoList.map((repoItem, index) => {
return (
<RepoListItem
key={index}
<RepoListItem
key={index}
repo={repoItem}
initToShowChildren={this.props.initToShowChildren}
selectedRepo={this.props.selectedRepo}
selectedPath={this.props.selectedPath}
onRepoItemClick={this.props.onRepoItemClick}
onRepoItemClick={this.props.onRepoItemClick}
onDirentItemClick={this.props.onDirentItemClick}
isShowFile={this.props.isShowFile}
fileSuffixes={this.props.fileSuffixes}

View File

@@ -9,7 +9,7 @@ const propTypes = {
};
class SearchedListItem extends React.Component {
constructor(props) {
super(props);
this.state = {
@@ -32,7 +32,7 @@ class SearchedListItem extends React.Component {
searchItemDoubleClick = (e) => {
let item = this.props.item;
this.props.onSearchedItemDoubleClick(item);
}

View File

@@ -34,10 +34,10 @@ class SearchedListView extends React.Component {
<tbody>
{this.props.searchResults.map((item, index) => {
return (
<SearchedListItem
key={index}
item={item}
currentItem={this.state.currentItem}
<SearchedListItem
key={index}
item={item}
currentItem={this.state.currentItem}
onItemClick={this.onItemClick}
onSearchedItemDoubleClick={this.props.onSearchedItemDoubleClick}
/>);

View File

@@ -40,7 +40,7 @@ class TreeViewItem extends React.Component {
if (this.props.selectedRepo) {
isCurrentRepo = this.props.selectedRepo.repo_id === this.props.repo.repo_id;
}
if (isCurrentRepo) {
if (this.props.selectedPath !== this.state.filePath) {
this.props.onDirentItemClick(this.state.filePath, this.props.node.object);
@@ -68,7 +68,7 @@ class TreeViewItem extends React.Component {
node={item}
onNodeCollapse={this.props.onNodeCollapse}
onNodeExpanded={this.props.onNodeExpanded}
repo={this.props.repo}
repo={this.props.repo}
onDirentItemClick={this.props.onDirentItemClick}
selectedRepo={this.props.selectedRepo}
selectedPath={this.props.selectedPath}

View File

@@ -14,7 +14,7 @@ const propTypes = {
};
class TreeListView extends React.Component {
render() {
return(
<div className="list-view-content" style={{'marginLeft': '-1.5rem'}}>
@@ -22,7 +22,7 @@ class TreeListView extends React.Component {
node={this.props.treeData.root}
onNodeCollapse={this.props.onNodeCollapse}
onNodeExpanded={this.props.onNodeExpanded}
repo={this.props.repo}
repo={this.props.repo}
onDirentItemClick={this.props.onDirentItemClick}
selectedRepo={this.props.selectedRepo}
selectedPath={this.props.selectedPath}