2018-12-19 02:44:23 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-07-16 02:01:09 +00:00
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
|
2018-12-19 02:44:23 +00:00
|
|
|
import { gettext } from '../../utils/constants';
|
|
|
|
import { seafileAPI } from '../../utils/seafile-api';
|
2019-07-16 02:01:09 +00:00
|
|
|
import { Utils } from '../../utils/utils';
|
|
|
|
import toaster from '../toast';
|
2018-12-19 02:44:23 +00:00
|
|
|
|
|
|
|
class DismissGroupDialog extends React.Component {
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
dismissGroup = () => {
|
|
|
|
let that = this;
|
2024-07-18 03:58:42 +00:00
|
|
|
seafileAPI.deleteGroup(this.props.groupID).then((res) => {
|
2018-12-19 02:44:23 +00:00
|
|
|
that.props.onGroupChanged();
|
2019-07-16 02:01:09 +00:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2018-12-19 02:44:23 +00:00
|
|
|
});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-19 02:44:23 +00:00
|
|
|
|
|
|
|
render() {
|
2024-07-18 03:58:42 +00:00
|
|
|
return (
|
2018-12-19 02:44:23 +00:00
|
|
|
<Modal isOpen={this.props.showDismissGroupDialog} toggle={this.props.toggleDismissGroupDialog}>
|
2019-06-25 08:56:42 +00:00
|
|
|
<ModalHeader>{gettext('Delete Group')}</ModalHeader>
|
2018-12-19 02:44:23 +00:00
|
|
|
<ModalBody>
|
2019-06-25 08:56:42 +00:00
|
|
|
<span>{gettext('Really want to delete this group?')}</span>
|
2018-12-19 02:44:23 +00:00
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
|
|
|
<Button color="secondary" onClick={this.props.toggleDismissGroupDialog}>{gettext('Cancel')}</Button>
|
2019-06-25 08:56:42 +00:00
|
|
|
<Button color="primary" onClick={this.dismissGroup}>{gettext('Delete')}</Button>
|
2018-12-19 02:44:23 +00:00
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const DismissGroupDialogPropTypes = {
|
|
|
|
showDismissGroupDialog: PropTypes.bool.isRequired,
|
|
|
|
toggleDismissGroupDialog: PropTypes.func.isRequired,
|
|
|
|
loadGroup: PropTypes.func.isRequired,
|
2023-09-13 00:40:50 +00:00
|
|
|
groupID: PropTypes.string,
|
2018-12-19 02:44:23 +00:00
|
|
|
onGroupChanged: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
DismissGroupDialog.propTypes = DismissGroupDialogPropTypes;
|
|
|
|
|
2019-06-25 08:56:42 +00:00
|
|
|
export default DismissGroupDialog;
|