2016-04-29 03:37:49 +00:00
|
|
|
import React, {PropTypes} from 'react'
|
2016-05-01 19:56:30 +00:00
|
|
|
import classnames from 'classnames'
|
|
|
|
|
2016-04-26 07:29:24 +00:00
|
|
|
import RequestActionsDropdown from './../containers/RequestActionsDropdown'
|
|
|
|
import MethodTag from './MethodTag'
|
|
|
|
|
2016-05-01 19:56:30 +00:00
|
|
|
const SidebarRequestRow = ({request, requestGroup, isActive, activateRequest}) => {
|
|
|
|
if (!request) {
|
|
|
|
return (
|
|
|
|
<li className="sidebar__item">
|
|
|
|
<em>No Requests</em>
|
|
|
|
</li>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li className="sidebar__row">
|
|
|
|
|
|
|
|
<div className={classnames('sidebar__item', {active: isActive})}>
|
|
|
|
|
|
|
|
<button className="sidebar__clickable" onClick={() => {activateRequest(request)}}>
|
|
|
|
<MethodTag method={request.method}/> {request.name}
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div className="sidebar__actions">
|
|
|
|
<RequestActionsDropdown
|
|
|
|
right={true}
|
|
|
|
request={request}
|
|
|
|
requestGroup={requestGroup}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
2016-04-29 03:37:49 +00:00
|
|
|
</div>
|
2016-05-01 19:56:30 +00:00
|
|
|
</li>
|
|
|
|
)
|
|
|
|
};
|
2016-04-26 07:29:24 +00:00
|
|
|
|
|
|
|
SidebarRequestRow.propTypes = {
|
|
|
|
// Functions
|
|
|
|
activateRequest: PropTypes.func.isRequired,
|
2016-04-29 03:37:49 +00:00
|
|
|
|
2016-04-26 07:29:24 +00:00
|
|
|
// Other
|
|
|
|
isActive: PropTypes.bool.isRequired,
|
2016-04-29 03:37:49 +00:00
|
|
|
|
2016-04-26 07:29:24 +00:00
|
|
|
// Optional
|
|
|
|
requestGroup: PropTypes.object,
|
|
|
|
request: PropTypes.object
|
|
|
|
};
|
|
|
|
|
|
|
|
export default SidebarRequestRow;
|