mirror of
https://github.com/haiwen/seahub.git
synced 2025-07-12 14:38:58 +00:00
fix create wiki select department (#6803)
This commit is contained in:
parent
9c25c1c661
commit
e62d59fc55
@ -10,7 +10,7 @@ import { SeahubSelect } from '../common/select';
|
||||
const propTypes = {
|
||||
toggleCancel: PropTypes.func.isRequired,
|
||||
addWiki: PropTypes.func.isRequired,
|
||||
currentDeptEmail: PropTypes.string,
|
||||
currentDeptID: PropTypes.string,
|
||||
};
|
||||
|
||||
class AddWikiDialog extends React.Component {
|
||||
@ -41,8 +41,8 @@ class AddWikiDialog extends React.Component {
|
||||
options.push(obj);
|
||||
}
|
||||
this.setState({ options });
|
||||
if (this.props.currentDeptEmail) {
|
||||
const selectedOption = options.find(op => op.email == this.props.currentDeptEmail);
|
||||
if (this.props.currentDeptID) {
|
||||
const selectedOption = options.find(op => op.id == this.props.currentDeptID);
|
||||
this.setState({ selectedOption });
|
||||
}
|
||||
}).catch(error => {
|
||||
|
@ -105,24 +105,26 @@ class WikiCardView extends Component {
|
||||
toggelAddWikiDialog={null}
|
||||
/>
|
||||
);
|
||||
for (let deptID in groupWikis) {
|
||||
groupWikis[deptID].wiki_info.length !== 0 &&
|
||||
wikiCardGroups.push(
|
||||
<WikiCardGroup
|
||||
key={'group-Wikis-' + deptID}
|
||||
deleteWiki={this.props.deleteWiki}
|
||||
unshareGroupWiki={this.props.unshareGroupWiki}
|
||||
renameWiki={this.props.renameWiki}
|
||||
sidePanelRate={sidePanelRate}
|
||||
isSidePanelFolded={isSidePanelFolded}
|
||||
group={groupWikis[deptID]}
|
||||
wikis={groupWikis[deptID].wiki_info}
|
||||
title={groupWikis[deptID].group_name}
|
||||
isDepartment={true}
|
||||
isShowAvatar={false}
|
||||
toggelAddWikiDialog={(canPublishRepo && this.state.departmentMap[groupWikis[deptID]['group_id']]) ? toggelAddWikiDialog.bind(this, deptID) : null}
|
||||
/>
|
||||
);
|
||||
for (let i = 0; i < groupWikis.length; i++) {
|
||||
const groupWiki = groupWikis[i];
|
||||
if (groupWiki.wiki_info.length !== 0) {
|
||||
wikiCardGroups.push(
|
||||
<WikiCardGroup
|
||||
key={'group-Wikis-' + groupWiki.group_id}
|
||||
deleteWiki={this.props.deleteWiki}
|
||||
unshareGroupWiki={this.props.unshareGroupWiki}
|
||||
renameWiki={this.props.renameWiki}
|
||||
sidePanelRate={sidePanelRate}
|
||||
isSidePanelFolded={isSidePanelFolded}
|
||||
group={groupWiki}
|
||||
wikis={groupWiki.wiki_info}
|
||||
title={groupWiki.group_name}
|
||||
isDepartment={true}
|
||||
isShowAvatar={false}
|
||||
toggelAddWikiDialog={(canPublishRepo && this.state.departmentMap[groupWiki.group_id]) ? toggelAddWikiDialog.bind(this, groupWiki.group_id) : null}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
wikiCardGroups.push(
|
||||
<WikiCardGroup
|
||||
|
@ -23,7 +23,7 @@ class Wikis extends Component {
|
||||
this.state = {
|
||||
loading: true,
|
||||
errorMsg: '',
|
||||
currentDeptEmail: '',
|
||||
currentDeptID: '',
|
||||
wikis: [],
|
||||
groupWikis: [],
|
||||
isShowAddWikiMenu: false,
|
||||
@ -84,16 +84,16 @@ class Wikis extends Component {
|
||||
this.setState({ isShowAddWikiMenu: !this.state.isShowAddWikiMenu });
|
||||
};
|
||||
|
||||
toggelAddWikiDialog = (currentDeptEmail) => {
|
||||
toggelAddWikiDialog = (currentDeptID) => {
|
||||
if (this.state.isShowAddDialog) {
|
||||
this.setState({
|
||||
isShowAddDialog: false,
|
||||
currentDeptEmail: '',
|
||||
currentDeptID: '',
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
isShowAddDialog: true,
|
||||
currentDeptEmail
|
||||
currentDeptID
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -116,9 +116,8 @@ class Wikis extends Component {
|
||||
}
|
||||
this.setState({
|
||||
wikis,
|
||||
currentDeptEmail: '',
|
||||
groupWikis,
|
||||
currentDeptID: '',
|
||||
groupWikis,
|
||||
});
|
||||
}).catch((error) => {
|
||||
if (error.response) {
|
||||
@ -264,7 +263,7 @@ class Wikis extends Component {
|
||||
<AddWikiDialog
|
||||
toggleCancel={this.toggelAddWikiDialog}
|
||||
addWiki={this.addWiki}
|
||||
currentDeptEmail={this.state.currentDeptEmail}
|
||||
currentDeptID={this.state.currentDeptID}
|
||||
/>
|
||||
</ModalPortal>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user