import React from 'react'; import PropTypes from 'prop-types'; import { translate } from 'react-i18next'; import ButtonToolbar from 'react-bootstrap/es/ButtonToolbar'; import SplitButton from 'react-bootstrap/es/SplitButton'; import MenuItem from 'react-bootstrap/es/MenuItem'; import SlackNotification from './SlackNotification'; import GrantSelector from './SavePageControls/GrantSelector'; class SavePageControls extends React.PureComponent { constructor(props) { super(props); this.state = { pageId: this.props.pageId, }; this.getCurrentOptionsToSave = this.getCurrentOptionsToSave.bind(this); this.submit = this.submit.bind(this); this.submitAndOverwriteScopesOfDescendants = this.submitAndOverwriteScopesOfDescendants.bind(this); } componentWillMount() { } getCurrentOptionsToSave() { const slackNotificationOptions = this.slackNotification.getCurrentOptionsToSave(); const grantSelectorOptions = this.grantSelector.getCurrentOptionsToSave(); return Object.assign(slackNotificationOptions, grantSelectorOptions); } /** * update pageId of state * @param {string} pageId */ setPageId(pageId) { this.setState({ pageId }); } submit() { this.props.onSubmit(); } submitAndOverwriteScopesOfDescendants() { this.props.onSubmit({ overwriteScopesOfDescendants: true }); } render() { const { t } = this.props; const config = this.props.crowi.getConfig(); const isAclEnabled = config.isAclEnabled; const labelSubmitButton = this.state.pageId == null ? t('Create') : t('Update'); const labelOverwriteScopes = t('page_edit.overwrite_scopes', { operation: labelSubmitButton }); return (