mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 14:49:09 +00:00
remove file-tag-list in file details page (#6506)
This commit is contained in:
@@ -5,8 +5,7 @@ import { siteRoot, gettext, enableVideoThumbnail } from '../../utils/constants';
|
|||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import toaster from '../toast';
|
import toaster from '../toast';
|
||||||
import FileTag from '../../models/file-tag';
|
import Header from './header/index';
|
||||||
import FileTagList from '../file-tag-list';
|
|
||||||
|
|
||||||
import '../../css/dirent-detail.css';
|
import '../../css/dirent-detail.css';
|
||||||
|
|
||||||
@@ -23,9 +22,7 @@ class FileDetails extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
direntType: '',
|
|
||||||
direntDetail: '',
|
direntDetail: '',
|
||||||
fileTagList: []
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,38 +31,14 @@ class FileDetails extends React.Component {
|
|||||||
let direntPath = Utils.joinPath(path, dirent.name);
|
let direntPath = Utils.joinPath(path, dirent.name);
|
||||||
seafileAPI.getFileInfo(repoID, direntPath).then(res => {
|
seafileAPI.getFileInfo(repoID, direntPath).then(res => {
|
||||||
this.setState({
|
this.setState({
|
||||||
direntType: 'file',
|
|
||||||
direntDetail: res.data
|
direntDetail: res.data
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
let errMessage = Utils.getErrorMsg(error);
|
let errMessage = Utils.getErrorMsg(error);
|
||||||
toaster.danger(errMessage);
|
toaster.danger(errMessage);
|
||||||
});
|
});
|
||||||
seafileAPI.listFileTags(repoID, direntPath).then(res => {
|
|
||||||
let fileTagList = [];
|
|
||||||
res.data.file_tags.forEach(item => {
|
|
||||||
let file_tag = new FileTag(item);
|
|
||||||
fileTagList.push(file_tag);
|
|
||||||
});
|
|
||||||
this.setState({ fileTagList: fileTagList });
|
|
||||||
}).catch(error => {
|
|
||||||
let errMessage = Utils.getErrorMsg(error);
|
|
||||||
toaster.danger(errMessage);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderHeader = (smallIconUrl, direntName) => {
|
|
||||||
return (
|
|
||||||
<div className="detail-header">
|
|
||||||
<div className="detail-control sf2-icon-x1" onClick={this.props.togglePanel}></div>
|
|
||||||
<div className="detail-title dirent-title">
|
|
||||||
<img src={smallIconUrl} width="24" height="24" alt="" />{' '}
|
|
||||||
<span className="name ellipsis" title={direntName}>{direntName}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
renderDetailBody = (bigIconUrl) => {
|
renderDetailBody = (bigIconUrl) => {
|
||||||
const { direntDetail } = this.state;
|
const { direntDetail } = this.state;
|
||||||
const { repoName, path } = this.props;
|
const { repoName, path } = this.props;
|
||||||
@@ -85,12 +58,6 @@ class FileDetails extends React.Component {
|
|||||||
<tr><th>{gettext('Size')}</th><td>{Utils.bytesToSize(direntDetail.size)}</td></tr>
|
<tr><th>{gettext('Size')}</th><td>{Utils.bytesToSize(direntDetail.size)}</td></tr>
|
||||||
<tr><th>{gettext('Location')}</th><td>{repoName + path}</td></tr>
|
<tr><th>{gettext('Location')}</th><td>{repoName + path}</td></tr>
|
||||||
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.last_modified).fromNow()}</td></tr>
|
<tr><th>{gettext('Last Update')}</th><td>{moment(direntDetail.last_modified).fromNow()}</td></tr>
|
||||||
<tr className="file-tag-container">
|
|
||||||
<th>{gettext('Tags')}</th>
|
|
||||||
<td>
|
|
||||||
<FileTagList fileTagList={this.state.fileTagList} />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -111,7 +78,7 @@ class FileDetails extends React.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div className="detail-container file-details-container">
|
<div className="detail-container file-details-container">
|
||||||
{this.renderHeader(smallIconUrl, dirent.name)}
|
<Header title={dirent.name} icon={smallIconUrl} onClose={this.props.togglePanel} />
|
||||||
{this.renderDetailBody(bigIconUrl)}
|
{this.renderDetailBody(bigIconUrl)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -5,7 +5,6 @@ import Icon from '../../icon';
|
|||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
const Header = ({ title, icon, onClose }) => {
|
const Header = ({ title, icon, onClose }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="detail-header">
|
<div className="detail-header">
|
||||||
<div className="detail-title dirent-title">
|
<div className="detail-title dirent-title">
|
||||||
|
Reference in New Issue
Block a user