Skip to content

Commit

Permalink
remove file-tag-list in file details page
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 committed Aug 7, 2024
1 parent f732da8 commit 9a4af0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
37 changes: 2 additions & 35 deletions frontend/src/components/dirent-detail/file-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -23,9 +22,7 @@ class FileDetails extends React.Component {
constructor(props) {
super(props);
this.state = {
direntType: '',
direntDetail: '',
fileTagList: []
};
}

Expand All @@ -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;
Expand All @@ -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>
Expand All @@ -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>
);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/dirent-detail/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 9a4af0a

Please sign in to comment.