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