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

remove file-tag-list in file details page (#6506)

This commit is contained in:
Michael An
2024-08-07 10:18:17 +08:00
committed by GitHub
parent f732da8c60
commit 0e3788ebb6
2 changed files with 2 additions and 36 deletions

View File

@@ -5,8 +5,7 @@ import { siteRoot, gettext, enableVideoThumbnail } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import toaster from '../toast';
import FileTag from '../../models/file-tag';
import FileTagList from '../file-tag-list';
import Header from './header/index';
import '../../css/dirent-detail.css';
@@ -23,9 +22,7 @@ class FileDetails extends React.Component {
constructor(props) {
super(props);
this.state = {
direntType: '',
direntDetail: '',
fileTagList: []
};
}
@@ -34,38 +31,14 @@ class FileDetails extends React.Component {
let direntPath = Utils.joinPath(path, dirent.name);
seafileAPI.getFileInfo(repoID, direntPath).then(res => {
this.setState({
direntType: 'file',
direntDetail: res.data
});
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
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) => {
const { direntDetail } = this.state;
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('Location')}</th><td>{repoName + path}</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>
</table>
</div>
@@ -111,7 +78,7 @@ class FileDetails extends React.Component {
}
return (
<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)}
</div>
);

View File

@@ -5,7 +5,6 @@ import Icon from '../../icon';
import './index.css';
const Header = ({ title, icon, onClose }) => {
return (
<div className="detail-header">
<div className="detail-title dirent-title">