1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 23:48:47 +00:00

12.0 remove groups page (#6325)

* 12.0 remove groups page

* redirect groups to libraries page
This commit is contained in:
Michael An
2024-07-10 17:19:41 +08:00
committed by GitHub
parent a0273c8829
commit 0e950d29d7
5 changed files with 3 additions and 207 deletions

View File

@@ -27,7 +27,6 @@ import MyLibDeleted from './pages/my-libs/my-libs-deleted';
import PublicSharedView from './pages/shared-with-all';
import LibContentView from './pages/lib-content-view/lib-content-view';
import Group from './pages/groups/group-view';
import Groups from './pages/groups/groups-view';
import InvitationsView from './pages/invitations/invitations-view';
import Wikis from './pages/wikis/wikis';
import Libraries from './pages/libraries';
@@ -52,6 +51,9 @@ class App extends Component {
constructor(props) {
super(props);
if (window.location.pathname === '/groups/') {
window.location.href = window.location.origin + '/libraries/';
}
this.state = {
isSidePanelClosed: false,
isSidePanelFolded: localStorage.getItem('sf_user_side_nav_folded') == 'true' || false,
@@ -257,7 +259,6 @@ class App extends Component {
<MyLibDeleted path={siteRoot + 'my-libs/deleted/'} onSearchedClick={this.onSearchedClick} />
<LibContentView path={siteRoot + 'library/:repoID/*'} pathPrefix={this.state.pathPrefix} isSidePanelFolded={isSidePanelFolded} onMenuClick={this.onShowSidePanel} onTabNavClick={this.tabItemClick}/>
<OCMRepoDir path={siteRoot + 'remote-library/:providerID/:repoID/*'} pathPrefix={this.state.pathPrefix} onMenuClick={this.onShowSidePanel} onTabNavClick={this.tabItemClick}/>
<Groups path={siteRoot + 'groups'} onShowSidePanel={this.onShowSidePanel} onSearchedClick={this.onSearchedClick}/>
<Group
path={siteRoot + 'group/:groupID'}
onShowSidePanel={this.onShowSidePanel}

View File

@@ -1,51 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Utils } from '../../utils/utils';
import { gettext } from '../../utils/constants';
import CreateGroupDialog from '../../components/dialog/create-group-dialog';
const propTypes = {
onCreateGroup: PropTypes.func.isRequired
};
class GroupsToolbar extends React.Component {
constructor(props) {
super(props);
this.state = {
isDialogOpen: false
};
}
toggleDialog = () => {
this.setState({
isDialogOpen: !this.state.isDialogOpen
});
};
render() {
return (
<>
{Utils.isDesktop() ? (
<div className="operation">
<button className="btn btn-secondary operation-item" onClick={this.toggleDialog}>
<i className="sf3-font-new-group1 sf3-font text-secondary mr-1"></i>{gettext('New Group')}
</button>
</div>
) : (
<span className="sf2-icon-plus mobile-toolbar-icon" title={gettext('New Group')} onClick={this.toggleDialog}></span>
)}
{this.state.isDialogOpen &&
<CreateGroupDialog
toggleDialog={this.toggleDialog}
onCreateGroup={this.props.onCreateGroup}
/>
}
</>
);
}
}
GroupsToolbar.propTypes = propTypes;
export default GroupsToolbar;

View File

@@ -1,24 +0,0 @@
.group-top-op-icon { /* for cur-view-path*/
display: inline-block;
font-size: 22px;
margin: 3px 0 0 10px;
}
.cur-view-content-groups .group-list-panel {
padding-bottom: 1rem;
}
.group-list-panel .group-item-heading {
font-size: 1rem;
font-weight: normal;
padding: 0.25rem;
border-bottom: 1px solid #e6e6e6;
margin: 0.75rem 0 0;
}
.group-list-panel .group-item-empty-tip {
color: #a4a4a4;
text-align: center;
padding: 4px 0;
border-bottom: 1px solid #e8e8e8;
}

View File

@@ -9,8 +9,6 @@ import SingleDropdownToolbar from '../../components/toolbar/single-dropdown-tool
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
import Repo from '../../models/repo';
import '../../css/groups.css';
const propTypes = {
currentViewMode: PropTypes.string,
group: PropTypes.object.isRequired,

View File

@@ -1,128 +0,0 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { gettext, canAddGroup } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import Loading from '../../components/loading';
import Group from '../../models/group';
import Repo from '../../models/repo';
import TopToolbar from '../../components/toolbar/top-toolbar';
import GroupsToolbar from '../../components/toolbar/groups-toolbar';
import EmptyTip from '../../components/empty-tip';
import GroupItem from './group-item';
import '../../css/groups.css';
class GroupsView extends React.Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
errorMsg: '',
groupList: []
};
}
listGroups = () => {
seafileAPI.listGroups(true).then((res) => {
// `{'with_repos': 1}`: list repos of every group
let groupList = res.data.map(item => {
let group = new Group(item);
group.repos = item.repos.map(item => {
return new Repo(item);
});
return group;
});
this.setState({
isLoading: false,
groupList: groupList.sort((a, b) => {
return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1;
})
});
}).catch((error) => {
this.setState({
isLoading: false,
errorMsg: Utils.getErrorMsg(error, true) // true: show login tip if 403
});
});
};
onCreateGroup = (groupData) => {
const newGroup = new Group(groupData);
const { groupList: newList } = this.state;
newList.unshift(newGroup);
this.setState({
groupList: newList
});
};
componentDidMount() {
this.listGroups();
}
updateGroup = (group) => {
const { groupList } = this.state;
this.setState({
groupList: groupList.map((item) => {
if (item.id == group.id) {
item = group;
}
return item;
})
});
};
render() {
const emptyTip = (
<EmptyTip>
<h2>{gettext('No groups')}</h2>
{canAddGroup ?
<p>{gettext('You are not in any groups. Groups allow multiple people to collaborate on libraries. You can create a group by clicking the "New Group" button in the menu bar.')}</p> :
<p>{gettext('You are not in any groups. Groups allow multiple people to collaborate on libraries. Groups you join will be listed here.')}</p>
}
</EmptyTip>
);
return (
<Fragment>
<TopToolbar
onShowSidePanel={this.props.onShowSidePanel}
onSearchedClick={this.props.onSearchedClick}
>
{canAddGroup && <GroupsToolbar onCreateGroup={this.onCreateGroup} />}
</TopToolbar>
<div className="main-panel-center flex-row">
<div className="cur-view-container">
<div className="cur-view-path">
<h3 className="sf-heading">{gettext('My Groups')}</h3>
</div>
<div className="cur-view-content cur-view-content-groups">
{this.state.isLoading && <Loading />}
{(!this.state.isLoading && this.state.errorMsg) && <div className="error text-center mt-2">{this.state.errorMsg}</div>}
{(!this.state.isLoading && !this.state.errorMsg && this.state.groupList.length == 0) && emptyTip}
{!this.state.isLoading && this.state.groupList.map((group, index) => {
return (
<GroupItem
key={index}
group={group}
updateGroup={this.updateGroup}
/>
);
})}
</div>
</div>
</div>
</Fragment>
);
}
}
const GroupsViewPropTypes = {
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
};
GroupsView.propTypes = GroupsViewPropTypes;
export default GroupsView;