mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 13:50:07 +00:00
Fix eslint warnings (#5635)
* 01 fix eslint warnings * fix code warnings * fix code warnings * fix code warnings * fix code warnings * fix code warnings
This commit is contained in:
@@ -38,7 +38,7 @@ class DirColumnFile extends React.Component {
|
||||
let { path, repoID } = this.props;
|
||||
let url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(path) + '?mode=edit';
|
||||
window.open(url);
|
||||
}
|
||||
};
|
||||
|
||||
onNewDraft = (e) => {
|
||||
e.preventDefault();
|
||||
@@ -49,19 +49,19 @@ class DirColumnFile extends React.Component {
|
||||
let errMessage = Utils.getErrorMsg(error);
|
||||
toaster.danger(errMessage);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
onOpenFile = (e) => {
|
||||
e.preventDefault();
|
||||
let { path, repoID } = this.props;
|
||||
let newUrl = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(path);
|
||||
window.open(newUrl, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
goDraftPage = (e) => {
|
||||
e.preventDefault();
|
||||
this.props.goDraftPage();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
if (this.props.isFileLoadedErr) {
|
||||
|
@@ -65,7 +65,7 @@ class DirColumnNav extends React.Component {
|
||||
return;
|
||||
}
|
||||
this.props.onNodeClick(node);
|
||||
}
|
||||
};
|
||||
|
||||
onMenuItemClick = (operation, node) => {
|
||||
this.setState({opNode: node});
|
||||
@@ -100,7 +100,7 @@ class DirColumnNav extends React.Component {
|
||||
this.onOpenFile(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onAddFileToggle = (type) => {
|
||||
if (type === 'root') {
|
||||
@@ -112,7 +112,7 @@ class DirColumnNav extends React.Component {
|
||||
} else {
|
||||
this.setState({isAddFileDialogShow: !this.state.isAddFileDialogShow});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onAddFolderToggle = (type) => {
|
||||
if (type === 'root') {
|
||||
@@ -124,39 +124,39 @@ class DirColumnNav extends React.Component {
|
||||
} else {
|
||||
this.setState({isAddFolderDialogShow: !this.state.isAddFolderDialogShow});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onRenameToggle = () => {
|
||||
this.setState({isRenameDialogShow: !this.state.isRenameDialogShow});
|
||||
}
|
||||
};
|
||||
|
||||
onCopyToggle = () => {
|
||||
this.setState({isCopyDialogShow: !this.state.isCopyDialogShow});
|
||||
}
|
||||
};
|
||||
|
||||
onMoveToggle = () => {
|
||||
this.setState({isMoveDialogShow: !this.state.isMoveDialogShow});
|
||||
}
|
||||
};
|
||||
|
||||
onAddFolderNode = (dirPath) => {
|
||||
this.setState({isAddFolderDialogShow: !this.state.isAddFolderDialogShow});
|
||||
this.props.onAddFolderNode(dirPath);
|
||||
}
|
||||
};
|
||||
|
||||
onRenameNode = (newName) => {
|
||||
this.setState({isRenameDialogShow: !this.state.isRenameDialogShow});
|
||||
let node = this.state.opNode;
|
||||
this.props.onRenameNode(node, newName);
|
||||
}
|
||||
};
|
||||
|
||||
onDeleteNode = (node) => {
|
||||
this.props.onDeleteNode(node);
|
||||
}
|
||||
};
|
||||
|
||||
onOpenFile = (node) => {
|
||||
let newUrl = siteRoot + 'lib/' + this.props.repoID + '/file' + Utils.encodePath(node.path);
|
||||
window.open(newUrl, '_blank');
|
||||
}
|
||||
};
|
||||
|
||||
checkDuplicatedName = (newName) => {
|
||||
let node = this.state.opNode;
|
||||
@@ -169,7 +169,7 @@ class DirColumnNav extends React.Component {
|
||||
return object.name === newName;
|
||||
});
|
||||
return isDuplicated;
|
||||
}
|
||||
};
|
||||
|
||||
showNodeImagePopup = (node) => {
|
||||
let childrenNode = node.parentNode.children;
|
||||
@@ -184,7 +184,7 @@ class DirColumnNav extends React.Component {
|
||||
imageNodeItems: this.prepareImageItems(node),
|
||||
imageIndex: imageNames.indexOf(node.object.name)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
prepareImageItems = (node) => {
|
||||
let childrenNode = node.parentNode.children;
|
||||
@@ -216,31 +216,31 @@ class DirColumnNav extends React.Component {
|
||||
};
|
||||
|
||||
return items.map((item) => { return prepareItem(item); });
|
||||
}
|
||||
};
|
||||
|
||||
closeNodeImagePopup = () => {
|
||||
this.setState({
|
||||
isNodeImagePopupOpen: false
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
moveToPrevImage = () => {
|
||||
const imageItemsLength = this.state.imageNodeItems.length;
|
||||
this.setState((prevState) => ({
|
||||
imageIndex: (prevState.imageIndex + imageItemsLength - 1) % imageItemsLength
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
moveToNextImage = () => {
|
||||
const imageItemsLength = this.state.imageNodeItems.length;
|
||||
this.setState((prevState) => ({
|
||||
imageIndex: (prevState.imageIndex + 1) % imageItemsLength
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
stopTreeScrollPropagation = (e) => {
|
||||
e.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
let flex = this.props.navRate ? '0 0 ' + this.props.navRate * 100 + '%' : '0 0 25%';
|
||||
|
@@ -66,6 +66,7 @@ const propTypes = {
|
||||
onItemsDelete: PropTypes.func.isRequired,
|
||||
onFileTagChanged: PropTypes.func,
|
||||
showDirentDetail: PropTypes.func.isRequired,
|
||||
fullDirentList: PropTypes.array,
|
||||
};
|
||||
|
||||
class DirColumnView extends React.Component {
|
||||
@@ -86,7 +87,7 @@ class DirColumnView extends React.Component {
|
||||
});
|
||||
}
|
||||
this.setCookie('navRate', this.state.navRate);
|
||||
}
|
||||
};
|
||||
|
||||
onResizeMouseDown = () => {
|
||||
this.containerWidth = this.refs.viewModeContainer.clientWidth;
|
||||
@@ -120,7 +121,7 @@ class DirColumnView extends React.Component {
|
||||
setCookie = (name, value) => {
|
||||
let cookie = name + '=' + value + ';';
|
||||
document.cookie = cookie;
|
||||
}
|
||||
};
|
||||
|
||||
getCookie = (cookiename) => {
|
||||
let name = cookiename + '=';
|
||||
@@ -132,7 +133,7 @@ class DirColumnView extends React.Component {
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
let rate = this.getCookie('navRate');
|
||||
|
@@ -31,6 +31,7 @@ const propTypes = {
|
||||
onAddFolder: PropTypes.func.isRequired,
|
||||
onFileTagChanged: PropTypes.func,
|
||||
onItemRename: PropTypes.func.isRequired,
|
||||
fullDirentList: PropTypes.array,
|
||||
};
|
||||
|
||||
class DirGridView extends React.Component {
|
||||
|
@@ -40,6 +40,7 @@ const propTypes = {
|
||||
onFileTagChanged: PropTypes.func,
|
||||
showDirentDetail: PropTypes.func.isRequired,
|
||||
loadDirentList: PropTypes.func,
|
||||
fullDirentList: PropTypes.array,
|
||||
};
|
||||
|
||||
class DirListView extends React.Component {
|
||||
|
Reference in New Issue
Block a user