2016-07-16 02:06:10 +00:00
|
|
|
import React, {Component, PropTypes} from 'react';
|
2016-04-09 21:41:27 +00:00
|
|
|
import {connect} from 'react-redux'
|
2016-07-16 02:06:10 +00:00
|
|
|
import Dropdown from '../components/base/Dropdown';
|
|
|
|
import EnvironmentEditModal from '../components/EnvironmentEditModal';
|
|
|
|
import PromptModal from '../components/PromptModal';
|
|
|
|
import * as db from '../database';
|
2016-04-09 21:41:27 +00:00
|
|
|
|
|
|
|
class RequestGroupActionsDropdown extends Component {
|
2016-07-14 22:48:56 +00:00
|
|
|
_promptUpdateName () {
|
|
|
|
const {requestGroup} = this.props;
|
|
|
|
|
|
|
|
PromptModal.show({
|
|
|
|
headerName: 'Rename Request Group',
|
|
|
|
defaultValue: requestGroup.name
|
|
|
|
}).then(name => {
|
|
|
|
db.requestGroupUpdate(requestGroup, {name});
|
|
|
|
})
|
|
|
|
}
|
2016-04-09 21:41:27 +00:00
|
|
|
render () {
|
2016-07-14 22:48:56 +00:00
|
|
|
const {requestGroup, ...other} = this.props;
|
2016-04-09 21:41:27 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Dropdown {...other}>
|
|
|
|
<button>
|
|
|
|
<i className="fa fa-caret-down"></i>
|
|
|
|
</button>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2016-07-14 22:48:56 +00:00
|
|
|
<button onClick={e => this._promptUpdateName()}>
|
2016-04-09 21:41:27 +00:00
|
|
|
<i className="fa fa-edit"></i> Rename
|
|
|
|
</button>
|
|
|
|
</li>
|
2016-04-15 02:13:49 +00:00
|
|
|
<li>
|
2016-07-14 22:48:56 +00:00
|
|
|
<button onClick={e => EnvironmentEditModal.show()}>
|
2016-04-15 02:13:49 +00:00
|
|
|
<i className="fa fa-code"></i> Environment
|
|
|
|
</button>
|
|
|
|
</li>
|
2016-04-09 21:41:27 +00:00
|
|
|
<li>
|
2016-04-27 03:17:05 +00:00
|
|
|
<button onClick={e => db.requestGroupRemove(requestGroup)}>
|
2016-04-09 21:41:27 +00:00
|
|
|
<i className="fa fa-trash-o"></i> Delete
|
|
|
|
</button>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</Dropdown>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RequestGroupActionsDropdown.propTypes = {
|
|
|
|
requestGroup: PropTypes.object
|
|
|
|
};
|
|
|
|
|
|
|
|
function mapStateToProps (state) {
|
2016-07-14 22:48:56 +00:00
|
|
|
return {};
|
2016-04-09 21:41:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps (dispatch) {
|
2016-07-14 22:48:56 +00:00
|
|
|
return {}
|
2016-04-09 21:41:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(RequestGroupActionsDropdown);
|