import React from 'react'; import PropTypes from 'prop-types'; import { Button, Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap'; import { gettext } from '../../utils/constants'; import { seafileAPI } from '../../utils/seafile-api'; import toaster from '../toast'; import { Utils } from '../../utils/utils'; import Loading from '../loading'; import '../../css/apply-folder-properties.css'; const propTypes = { toggle: PropTypes.func, repoID: PropTypes.string, path: PropTypes.string }; class ConfirmApplyFolderPropertiesDialog extends React.Component { constructor(props) { super(props); this.state = { submitting: false }; } submit = () => { const { repoID, path } = this.props; this.setState({ submitting: true }); seafileAPI.applyFolderExtendedProperties(repoID, path).then(() => { toaster.success('Applied folder properties'); this.props.toggle(); }).catch(error => { let errorMsg = Utils.getErrorMsg(error); toaster.danger(errorMsg); this.setState({ submitting: false }); }); }; render() { const { submitting } = this.state; return ( {gettext('Apply properties')}

{gettext('Are you sure to apply properties to all files inside the folder?')}

); } } ConfirmApplyFolderPropertiesDialog.propTypes = propTypes; export default ConfirmApplyFolderPropertiesDialog;