Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading