import React, {PropTypes, PureComponent} from 'react'; import autobind from 'autobind-decorator'; import PromptButton from '../base/prompt-button'; import {Dropdown, DropdownButton, DropdownHint, DropdownItem} from '../base/dropdown'; import * as models from '../../../models'; import {trackEvent} from '../../../analytics/index'; import {DropdownDivider} from '../base/dropdown/index'; @autobind class RequestActionsDropdown extends PureComponent { _setDropdownRef (n) { this._dropdown = n; } _handleDuplicate () { const {request, handleDuplicateRequest} = this.props; handleDuplicateRequest(request); trackEvent('Request', 'Duplicate', 'Request Action'); } _handleGenerateCode () { this.props.handleGenerateCode(this.props.request); trackEvent('Request', 'Generate Code', 'Request Action'); } _handleCopyAsCurl () { trackEvent('Request', 'Copy As Curl', 'Request Action'); this.props.handleCopyAsCurl(this.props.request); } _handleRemove () { const {request} = this.props; models.request.remove(request); trackEvent('Request', 'Delete', 'Action'); } show () { this._dropdown.show(); } render () { const { request, // eslint-disable-line no-unused-vars handleShowSettings, ...other } = this.props; return ( Duplicate Generate Code Copy as Curl Delete Settings ); } } RequestActionsDropdown.propTypes = { handleDuplicateRequest: PropTypes.func.isRequired, handleGenerateCode: PropTypes.func.isRequired, handleCopyAsCurl: PropTypes.func.isRequired, handleShowSettings: PropTypes.func.isRequired, request: PropTypes.object.isRequired }; export default RequestActionsDropdown;