2015-05-27 14:35:33 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import AppConstants from '../constants/application_constants';
|
|
|
|
|
|
|
|
let AclButton = React.createClass({
|
|
|
|
propTypes: {
|
|
|
|
action: React.PropTypes.oneOf(AppConstants.aclList).isRequired,
|
2015-05-27 15:49:12 +02:00
|
|
|
availableAcls: React.PropTypes.array.isRequired,
|
|
|
|
actionFunction: React.PropTypes.func.isRequired
|
|
|
|
},
|
|
|
|
|
|
|
|
actionFunction() {
|
|
|
|
this.props.actionFunction(this.props.action);
|
2015-05-27 14:35:33 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
|
|
|
let shouldDisplay = this.props.availableAcls.indexOf(this.props.action) > -1;
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
type="button"
|
2015-05-27 15:49:12 +02:00
|
|
|
className={shouldDisplay ? 'btn btn-default btn-sm' : 'hidden'}
|
|
|
|
onClick={this.actionFunction}>
|
2015-05-27 14:35:33 +02:00
|
|
|
{this.props.action.toUpperCase()}
|
|
|
|
</button>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default AclButton;
|