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

Resolve warring (#3454)

* Resole project warrings

* Delete extra blank lines

* resolve dir-column-nav warnings
This commit is contained in:
zxj96
2019-05-14 10:15:09 +08:00
committed by Daniel Pan
parent 9f8fc78d14
commit 3cc43d9041
14 changed files with 47 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
import React ,{ Fragment } from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Alert } from 'reactstrap';
import { Button, ModalHeader, ModalBody, ModalFooter, Alert } from 'reactstrap';
import { gettext } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';

View File

@@ -1,6 +1,6 @@
import React ,{ Fragment } from 'react';
import PropTypes from 'prop-types';
import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import { Button, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';
import Dirent from '../../models/dirent';
import { gettext, siteRoot } from '../../utils/constants';
import { Utils } from '../../utils/utils';

View File

@@ -5,7 +5,7 @@ import { Button } from 'reactstrap';
import { seafileAPI } from '../../utils/seafile-api.js';
import UserSelect from '../user-select';
import SharePermissionEditor from '../select-editor/share-permission-editor';
import "../../css/invitations.css";
import '../../css/invitations.css';
class UserItem extends React.Component {

View File

@@ -30,6 +30,8 @@ const propTypes = {
navRate: PropTypes.number,
inResizing: PropTypes.bool.isRequired,
currentRepoInfo: PropTypes.object.isRequired,
onItemMove: PropTypes.func.isRequired,
onItemCopy: PropTypes.func.isRequired,
selectedDirentList: PropTypes.array.isRequired,
};

View File

@@ -30,6 +30,7 @@ const propTypes = {
showDirentDetail: PropTypes.func.isRequired,
onAddFolder: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func,
onItemRename: PropTypes.func.isRequired,
};
class DirGridView extends React.Component {

View File

@@ -13,6 +13,8 @@ const propTypes = {
onGridItemClick: PropTypes.func.isRequired,
activeDirent: PropTypes.object,
onGridItemMouseDown: PropTypes.func,
currentRepoInfo: PropTypes.object,
onItemMove: PropTypes.func.isRequired,
};
class DirentGridItem extends React.Component {
@@ -22,7 +24,7 @@ class DirentGridItem extends React.Component {
this.state = {
isGridSelected: false,
isGridDropTipShow: false,
}
};
}
componentWillReceiveProps(nextProps) {
@@ -30,7 +32,7 @@ class DirentGridItem extends React.Component {
if (nextProps.activeDirent && nextProps.activeDirent.name === nextProps.dirent.name) {
this.setState({isGridSelected: true});
}
})
});
}
onItemMove = (destRepo, dirent, selectedPath, currentPath) => {
@@ -51,7 +53,7 @@ class DirentGridItem extends React.Component {
}
} else {
this.setState({isGridSelected: false});
this.props.onGridItemClick(this.props.dirent)
this.props.onGridItemClick(this.props.dirent);
}
}
@@ -140,9 +142,9 @@ class DirentGridItem extends React.Component {
}
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" : " ";
let gridClass = 'grid-file-img-link cursor-pointer';
gridClass += this.state.isGridSelected ? ' grid-selected-active' : ' ';
gridClass += this.state.isGridDropTipShow ? ' grid-drop-show' : ' ';
let lockedInfo = gettext('locked by {name}');
lockedInfo = lockedInfo.replace('{name}', dirent.lock_owner_name);
@@ -167,11 +169,11 @@ class DirentGridItem extends React.Component {
{dirent.is_locked && <img className="grid-file-locked-icon" src={mediaUrl + 'img/file-locked-32.png'} alt={gettext('locked')} title={lockedInfo}/>}
</div>
<div className="grid-file-name" onDragStart={this.onGridItemDragStart} draggable="true" >
<a className={`grid-file-name-link ${this.state.isGridSelected ? "grid-link-selected-active" : ""}`} href={dirent.type === 'dir' ? dirHref : fileHref} onClick={this.onItemLinkClick}>{dirent.name}</a>
<a className={`grid-file-name-link ${this.state.isGridSelected ? 'grid-link-selected-active' : ''}`} href={dirent.type === 'dir' ? dirHref : fileHref} onClick={this.onItemLinkClick}>{dirent.name}</a>
</div>
</li>
</Fragment>
)
);
}
}

View File

@@ -40,8 +40,8 @@ const propTypes = {
isDirentDetailShow: PropTypes.bool.isRequired,
onGridItemClick: PropTypes.func,
onAddFolder: PropTypes.func.isRequired,
showDirentDetail: PropTypes.func,
onItemRename: PropTypes.func,
showDirentDetail: PropTypes.func.isRequired,
onItemRename: PropTypes.func.isRequired,
};
class DirentGridView extends React.Component{

View File

@@ -45,6 +45,8 @@ const propTypes = {
selectedDirentList: PropTypes.array.isRequired,
activeDirent: PropTypes.object,
getDirentItemMenuList: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func,
enableDirPrivateShare: PropTypes.bool.isRequired,
};
class DirentListItem extends React.Component {
@@ -480,7 +482,7 @@ class DirentListItem extends React.Component {
</Fragment>
}
</Fragment>
)
);
}
render() {

View File

@@ -45,6 +45,8 @@ const propTypes = {
onItemsCopy: PropTypes.func.isRequired,
onItemsDelete: PropTypes.func.isRequired,
onFileTagChanged: PropTypes.func,
enableDirPrivateShare: PropTypes.bool.isRequired,
isGroupOwnedRepo: PropTypes.bool.isRequired,
};
class DirentListView extends React.Component {
@@ -326,7 +328,7 @@ class DirentListView extends React.Component {
onContainerContextMenu = (event) => {
if (this.props.selectedDirentList.length === 0) {
let id = "dirent-container-menu"
let id = 'dirent-container-menu';
let menuList = [TextTranslation.NEW_FOLDER, TextTranslation.NEW_FILE];
this.handleContextClick(event, id, menuList);
} else {
@@ -341,7 +343,7 @@ class DirentListView extends React.Component {
event.preventDefault();
event.persist();
setTimeout(() => {
let id = "dirent-container-menu"
let id = 'dirent-container-menu';
let menuList = [TextTranslation.NEW_FOLDER, TextTranslation.NEW_FILE];
this.handleContextClick(event, id, menuList);
}, 0);
@@ -539,7 +541,7 @@ class DirentListView extends React.Component {
onTableDragLeave = (e) => {
if (e.target.className === 'table-container table-drop-active') {
this.setState({isListDropTipShow: false})
this.setState({isListDropTipShow: false});
}
}
@@ -558,7 +560,7 @@ class DirentListView extends React.Component {
if (nodeRootPath === this.props.path || nodeParentPath === this.props.path) {
return;
}
this.props.onItemMove(this.props.currentRepoInfo, nodeDirent, this.props.path, nodeParentPath)
this.props.onItemMove(this.props.currentRepoInfo, nodeDirent, this.props.path, nodeParentPath);
}
}

View File

@@ -18,12 +18,12 @@ const propTypes = {
freezeItem: PropTypes.func.isRequired,
unfreezeItem: PropTypes.func.isRequired,
onMenuItemClick: PropTypes.func,
registerHandlers: PropTypes.func,
unregisterHandlers: PropTypes.func,
onNodeDragMove: PropTypes.func,
onNodeDrop: PropTypes.func,
appMenuType: PropTypes.oneOf(['list_view_contextmenu', 'item_contextmenu', 'tree_contextmenu', 'item_op_menu']),
handleContextClick: PropTypes.func.isRequired,
onNodeDragEnter: PropTypes.func.isRequired,
onNodeDragLeave:PropTypes.func.isRequired,
};
class TreeNodeView extends React.Component {
@@ -202,9 +202,6 @@ class TreeNodeView extends React.Component {
freezeItem={this.props.freezeItem}
onMenuItemClick={this.props.onMenuItemClick}
unfreezeItem={this.unfreezeItem}
onNodeChanged={this.props.onNodeChanged}
registerHandlers={this.props.registerHandlers}
unregisterHandlers={this.props.unregisterHandlers}
onNodeDragStart={this.props.onNodeDragStart}
onNodeDragMove={this.props.onNodeDragMove}
onNodeDrop={this.props.onNodeDrop}

View File

@@ -39,16 +39,16 @@ class TreeView extends React.Component {
let dragStartNodeData = {nodeDirent: node.object, nodeParentPath: node.parentNode.path, nodeRootPath: node.path};
dragStartNodeData = JSON.stringify(dragStartNodeData);
e.dataTransfer.effectAllowed = "move";
e.dataTransfer.effectAllowed = 'move';
e.dataTransfer.setData('applicaiton/drag-item-info', dragStartNodeData);
}
onNodeDragEnter = (e, node) => {
e.persist()
e.persist();
if (e.target.className === 'tree-view tree ') {
this.setState({
isTreeViewDropTipShow: true,
})
});
}
}
@@ -61,7 +61,7 @@ class TreeView extends React.Component {
if (e.target.className === 'tree-view tree tree-view-drop') {
this.setState({
isTreeViewDropTipShow: false,
})
});
}
}

View File

@@ -86,6 +86,7 @@ const propTypes = {
onDeleteRepoTag: PropTypes.func.isRequired,
updateDetail: PropTypes.bool.isRequired,
onListContainerScroll: PropTypes.func.isRequired,
onDirentClick: PropTypes.func.isRequired,
};
class LibContentContainer extends React.Component {

View File

@@ -196,20 +196,20 @@ class LibContentView extends React.Component {
if (this.state.currentMode === 'column') {
if (this.state.isViewFile) {
this.updataColumnMarkdownData(path)
this.updataColumnMarkdownData(path);
} else {
seafileAPI.dirMetaData(repoID, path).then((res) => {
if (res.data.id !== dirID) {
this.loadDirentList(path);
}
})
});
}
} else {
seafileAPI.dirMetaData(repoID, path).then((res) => {
if (res.data.id !== dirID) {
this.loadDirentList(path);
}
})
});
}
}
@@ -252,7 +252,7 @@ class LibContentView extends React.Component {
seafileAPI.getFileDownloadLink(repoID, filePath).then((res) => {
seafileAPI.getFileContent(res.data).then((res) => {
if (this.state.content !== res.data) {
this.setState({isFileLoading: true})
this.setState({isFileLoading: true});
}
this.setState({
content: res.data,
@@ -419,7 +419,7 @@ class LibContentView extends React.Component {
toaster.danger(
<SessionExpiredTip />,
{id: 'session_expired', duration: 3600}
)
);
}
this.setState({
isFileLoading: false,
@@ -466,8 +466,8 @@ class LibContentView extends React.Component {
toaster.danger(
<SessionExpiredTip />,
{id: 'session_expired', duration: 3600}
)
this.setState({isDirentListLoading: false})
);
this.setState({isDirentListLoading: false});
return;
}
this.setState({
@@ -1416,7 +1416,7 @@ class LibContentView extends React.Component {
let direntItemsList = this.state.direntList.filter((item, index) => {
return index < this.state.itemsShowLength;
})
});
return (
<div className="main-panel o-hidden">