mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 17:02:47 +00:00
selected-file-detail (#3140)
This commit is contained in:
@@ -25,6 +25,12 @@ const propTypes = {
|
|||||||
onItemsCopy: PropTypes.func.isRequired,
|
onItemsCopy: PropTypes.func.isRequired,
|
||||||
onItemsDelete: PropTypes.func.isRequired,
|
onItemsDelete: PropTypes.func.isRequired,
|
||||||
isRepoOwner: PropTypes.bool.isRequired,
|
isRepoOwner: PropTypes.bool.isRequired,
|
||||||
|
enableDirPrivateShare: PropTypes.bool.isRequired,
|
||||||
|
currentRepoInfo: PropTypes.object.isRequired,
|
||||||
|
onFileTagChanged: PropTypes.func.isRequired,
|
||||||
|
unSelectDirent: PropTypes.func.isRequired,
|
||||||
|
updateDirent: PropTypes.func.isRequired,
|
||||||
|
showDirentDetail: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MutipleDirOperationToolbar extends React.Component {
|
class MutipleDirOperationToolbar extends React.Component {
|
||||||
@@ -260,7 +266,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
const dirent = this.props.selectedDirentList[i];
|
const dirent = this.props.selectedDirentList[i];
|
||||||
const direntPath = this.getDirentPath(dirent);
|
const direntPath = this.getDirentPath(dirent);
|
||||||
this.props.onFilesTagChanged(dirent, direntPath);
|
this.props.onFileTagChanged(dirent, direntPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,6 +71,10 @@ const propTypes = {
|
|||||||
isDirentSelected: PropTypes.bool.isRequired,
|
isDirentSelected: PropTypes.bool.isRequired,
|
||||||
isAllDirentSelected: PropTypes.bool.isRequired,
|
isAllDirentSelected: PropTypes.bool.isRequired,
|
||||||
onAllDirentSelected: PropTypes.func.isRequired,
|
onAllDirentSelected: PropTypes.func.isRequired,
|
||||||
|
isDirentDetailShow: PropTypes.bool.isRequired,
|
||||||
|
selectedDirent: PropTypes.object,
|
||||||
|
closeDirentDetail: PropTypes.func.isRequired,
|
||||||
|
showDirentDetail: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class LibContentContainer extends React.Component {
|
class LibContentContainer extends React.Component {
|
||||||
@@ -79,25 +83,24 @@ class LibContentContainer extends React.Component {
|
|||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
currentDirent: null,
|
currentDirent: null,
|
||||||
isDirentDetailShow: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.errMessage = (<div className="message err-tip">{gettext('Folder does not exist.')}</div>);
|
this.errMessage = (<div className="message err-tip">{gettext('Folder does not exist.')}</div>);
|
||||||
}
|
}
|
||||||
|
|
||||||
onPathClick = (path) => {
|
onPathClick = (path) => {
|
||||||
this.setState({isDirentDetailShow: false});
|
|
||||||
this.props.onMainNavBarClick(path);
|
this.props.onMainNavBarClick(path);
|
||||||
|
this.props.closeDirentDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemClick = (dirent) => {
|
onItemClick = (dirent) => {
|
||||||
this.setState({isDirentDetailShow: false});
|
|
||||||
this.props.onItemClick(dirent);
|
this.props.onItemClick(dirent);
|
||||||
|
this.props.closeDirentDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
// on '<tr>'
|
// on '<tr>'
|
||||||
onDirentClick = (dirent) => {
|
onDirentClick = (dirent) => {
|
||||||
if (this.state.isDirentDetailShow) {
|
if (this.props.isDirentDetailShow) {
|
||||||
this.onItemDetails(dirent);
|
this.onItemDetails(dirent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,18 +108,22 @@ class LibContentContainer extends React.Component {
|
|||||||
onItemDetails = (dirent) => {
|
onItemDetails = (dirent) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
currentDirent: dirent,
|
currentDirent: dirent,
|
||||||
isDirentDetailShow: true,
|
|
||||||
});
|
});
|
||||||
|
this.props.showDirentDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemDetailsClose = () => {
|
onItemDetailsClose = () => {
|
||||||
this.setState({isDirentDetailShow: false});
|
this.props.closeDirentDetail();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
if (nextProps.isDirentDetailShow !== this.state.isDirentDetailShow) {
|
if (nextProps.isDirentDetailShow) {
|
||||||
|
this.setState({
|
||||||
|
isDirentDetailShow: nextProps.isDirentDetailShow
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (nextProps.selectedDirent && nextProps.isDirentDetailShow) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isDirentDetailShow: nextProps.isDirentDetailShow,
|
|
||||||
currentDirent: nextProps.selectedDirent,
|
currentDirent: nextProps.selectedDirent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -245,7 +252,7 @@ class LibContentContainer extends React.Component {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.state.isDirentDetailShow && (
|
{this.props.isDirentDetailShow && (
|
||||||
<div className="cur-view-detail">
|
<div className="cur-view-detail">
|
||||||
<DirentDetail
|
<DirentDetail
|
||||||
repoID={repoID}
|
repoID={repoID}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import cookie from 'react-cookies';
|
import cookie from 'react-cookies';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
@@ -83,6 +83,10 @@ class LibContentView extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeDirentDetail = () => {
|
||||||
|
this.setState({ isDirentDetailShow: false });
|
||||||
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
if (hash.slice(0, 1) === '#') {
|
if (hash.slice(0, 1) === '#') {
|
||||||
@@ -356,7 +360,7 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadDirentList = (path) => {
|
loadDirentList = (path) => {
|
||||||
let repoID = this.props.repoID
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.listDir(repoID, path, {'with_thumbnail': true}).then(res => {
|
seafileAPI.listDir(repoID, path, {'with_thumbnail': true}).then(res => {
|
||||||
let direntList = [];
|
let direntList = [];
|
||||||
let markdownItem = null;
|
let markdownItem = null;
|
||||||
@@ -1159,7 +1163,6 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goDraftPage = () => {
|
goDraftPage = () => {
|
||||||
let repoID = this.props.repoID;
|
|
||||||
window.location.href = siteRoot + 'drafts/' + this.state.draftID + '/';
|
window.location.href = siteRoot + 'drafts/' + this.state.draftID + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1221,8 +1224,6 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { repoID } = this.props;
|
|
||||||
|
|
||||||
if (this.state.libNeedDecrypt) {
|
if (this.state.libNeedDecrypt) {
|
||||||
return (
|
return (
|
||||||
<ModalPortal>
|
<ModalPortal>
|
||||||
@@ -1264,7 +1265,6 @@ class LibContentView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="main-panel o-hidden">
|
<div className="main-panel o-hidden">
|
||||||
@@ -1372,6 +1372,8 @@ class LibContentView extends React.Component {
|
|||||||
onAllDirentSelected={this.onAllDirentSelected}
|
onAllDirentSelected={this.onAllDirentSelected}
|
||||||
isDirentDetailShow={this.state.isDirentDetailShow}
|
isDirentDetailShow={this.state.isDirentDetailShow}
|
||||||
selectedDirent={this.state.selectedDirentList && this.state.selectedDirentList[0]}
|
selectedDirent={this.state.selectedDirentList && this.state.selectedDirentList[0]}
|
||||||
|
closeDirentDetail={this.closeDirentDetail}
|
||||||
|
showDirentDetail={this.showDirentDetail}
|
||||||
/>
|
/>
|
||||||
{this.state.pathExist && !this.state.isViewFile && (
|
{this.state.pathExist && !this.state.isViewFile && (
|
||||||
<FileUploader
|
<FileUploader
|
||||||
|
Reference in New Issue
Block a user