1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-29 12:04:02 +00:00
seahub/frontend/src/components/select-editor/sysadmin-group-role-editor.js

43 lines
1.1 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import { gettext } from '../../utils/constants';
import SelectEditor from './select-editor';
const propTypes = {
isTextMode: PropTypes.bool.isRequired,
isEditIconShow: PropTypes.bool.isRequired,
roleOptions: PropTypes.array.isRequired,
currentRole: PropTypes.string.isRequired,
onRoleChanged: PropTypes.func.isRequired
};
class SysAdminGroupRoleEditor extends React.Component {
translateRoles = (role) => {
switch (role) {
case 'Member':
return gettext('Member');
case 'Admin':
return gettext('Admin');
default:
return role;
}
}
render() {
return (
<SelectEditor
isTextMode={this.props.isTextMode}
isEditIconShow={this.props.isEditIconShow}
options={this.props.roleOptions}
currentOption={this.props.currentRole}
onOptionChanged={this.props.onRoleChanged}
translateOption={this.translateRoles}
/>
);
}
}
SysAdminGroupRoleEditor.propTypes = propTypes;
export default SysAdminGroupRoleEditor;