import React, { PropTypes } from "react" export default class Operations extends React.Component { static propTypes = { specSelectors: PropTypes.object.isRequired, specActions: PropTypes.object.isRequired, getComponent: PropTypes.func.isRequired, layoutSelectors: PropTypes.object.isRequired, layoutActions: PropTypes.object.isRequired, authActions: PropTypes.object.isRequired, authSelectors: PropTypes.object.isRequired, getConfigs: PropTypes.func.isRequired }; render() { let { specSelectors, specActions, getComponent, layoutSelectors, layoutActions, authActions, authSelectors, getConfigs, fn } = this.props let taggedOps = specSelectors.taggedOperations() const Operation = getComponent("operation") const Collapse = getComponent("Collapse") let showSummary = layoutSelectors.showSummary() let { docExpansion, displayOperationId, displayRequestDuration } = getConfigs() return (
{ taggedOps.map( (tagObj, tag) => { let operations = tagObj.get("operations") let tagDescription = tagObj.getIn(["tagDetails", "description"], null) let isShownKey = ["operations-tag", tag] let showTag = layoutSelectors.isShown(isShownKey, docExpansion === "full" || docExpansion === "list") return (

layoutActions.show(isShownKey, !showTag)} className={!tagDescription ? "opblock-tag no-desc" : "opblock-tag" }> {tag} { !tagDescription ? null : { tagDescription } }

{ operations.map( op => { const isShownKey = ["operations", op.get("id"), tag] const path = op.get("path", "") const method = op.get("method", "") const jumpToKey = `paths.${path}.${method}` const allowTryItOut = specSelectors.allowTryItOutFor(op.get("path"), op.get("method")) const response = specSelectors.responseFor(op.get("path"), op.get("method")) const request = specSelectors.requestFor(op.get("path"), op.get("method")) return }).toArray() }
) }).toArray() } { taggedOps.size < 1 ?

No operations defined in spec!

: null }
) } } Operations.propTypes = { layoutActions: PropTypes.object.isRequired, specSelectors: PropTypes.object.isRequired, specActions: PropTypes.object.isRequired, layoutSelectors: PropTypes.object.isRequired, getComponent: PropTypes.func.isRequired, fn: PropTypes.object.isRequired }