import React from "react" import PropTypes from "prop-types" import Im from "immutable" const SWAGGER2_OPERATION_METHODS = [ "get", "put", "post", "delete", "options", "head", "patch" ] const OAS3_OPERATION_METHODS = SWAGGER2_OPERATION_METHODS.concat(["trace"]) export default class Operations extends React.Component { static propTypes = { specSelectors: PropTypes.object.isRequired, specActions: PropTypes.object.isRequired, oas3Actions: 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, fn: PropTypes.func.isRequired }; render() { let { specSelectors, getComponent, layoutSelectors, layoutActions, getConfigs, fn } = this.props let taggedOps = specSelectors.taggedOperations() const OperationContainer = getComponent("OperationContainer", true) const OperationTag = getComponent("OperationTag") let { maxDisplayedTags, } = getConfigs() let filter = layoutSelectors.currentFilter() if (filter) { if (filter !== true) { taggedOps = fn.opsFilter(taggedOps, filter) } } if (maxDisplayedTags && !isNaN(maxDisplayedTags) && maxDisplayedTags >= 0) { taggedOps = taggedOps.slice(0, maxDisplayedTags) } return (