2019-10-15 05:41:41 +00:00
|
|
|
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 (
|
2020-11-02 05:56:35 +00:00
|
|
|
<SelectEditor
|
2019-10-15 05:41:41 +00:00
|
|
|
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;
|