mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 11:21:29 +00:00
migrate tags UI and delete old tags (#7699)
* basic codes remove useless * remove useless * remove useless codes * remove useless codes
This commit is contained in:
@@ -31,6 +31,7 @@ import Detail from '../../components/dirent-detail';
|
||||
import DirColumnView from '../../components/dir-view-mode/dir-column-view';
|
||||
import SelectedDirentsToolbar from '../../components/toolbar/selected-dirents-toolbar';
|
||||
import MetadataPathToolbar from '../../components/toolbar/metadata-path-toolbar';
|
||||
import { eventBus } from '../../components/common/event-bus';
|
||||
|
||||
import '../../css/lib-content-view.css';
|
||||
|
||||
@@ -156,6 +157,7 @@ class LibContentView extends React.Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.unsubscribeEvent = this.props.eventBus.subscribe(EVENT_BUS_TYPE.SEARCH_LIBRARY_CONTENT, this.onSearchedClick);
|
||||
this.unsubscribeOpenTreePanel = eventBus.subscribe(EVENT_BUS_TYPE.OPEN_TREE_PANEL, this.openTreePanel);
|
||||
this.calculatePara(this.props);
|
||||
}
|
||||
|
||||
@@ -268,6 +270,7 @@ class LibContentView extends React.Component {
|
||||
componentWillUnmount() {
|
||||
window.onpopstate = this.oldonpopstate;
|
||||
this.unsubscribeEvent();
|
||||
this.unsubscribeOpenTreePanel();
|
||||
this.unsubscribeEventBus && this.unsubscribeEventBus();
|
||||
this.props.eventBus.dispatch(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, {
|
||||
repoID: '',
|
||||
@@ -2142,21 +2145,6 @@ class LibContentView extends React.Component {
|
||||
this.onDirentSelected(dirent);
|
||||
};
|
||||
|
||||
onDeleteRepoTag = (deletedTagID) => {
|
||||
let direntList = this.state.direntList.map(dirent => {
|
||||
if (dirent.file_tags) {
|
||||
let fileTags = dirent.file_tags.filter(item => {
|
||||
return item.repo_tag_id !== deletedTagID;
|
||||
});
|
||||
dirent.file_tags = fileTags;
|
||||
}
|
||||
return dirent;
|
||||
});
|
||||
this.setState({ direntList: direntList });
|
||||
this.updateUsedRepoTags();
|
||||
};
|
||||
|
||||
|
||||
handleSubmit = (e) => {
|
||||
let options = {
|
||||
'share_type': 'personal',
|
||||
@@ -2172,6 +2160,17 @@ class LibContentView extends React.Component {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
openTreePanel = (callback) => {
|
||||
if (this.state.isTreePanelShown) {
|
||||
callback();
|
||||
} else {
|
||||
this.toggleTreePanel();
|
||||
setTimeout(() => {
|
||||
callback();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
toggleTreePanel = () => {
|
||||
this.setState({
|
||||
isTreePanelShown: !this.state.isTreePanelShown
|
||||
@@ -2356,8 +2355,6 @@ class LibContentView extends React.Component {
|
||||
repoName={this.state.currentRepoInfo.repo_name}
|
||||
userPerm={userPerm}
|
||||
currentPath={path}
|
||||
updateUsedRepoTags={this.updateUsedRepoTags}
|
||||
onDeleteRepoTag={this.onDeleteRepoTag}
|
||||
currentMode={this.state.currentMode}
|
||||
switchViewMode={this.switchViewMode}
|
||||
isCustomPermission={isCustomPermission}
|
||||
|
Reference in New Issue
Block a user