import React, { Component, PropTypes } from "react" import ImPropTypes from "react-immutable-proptypes" import Im from "immutable" // More readable, just iterate over maps, only const eachMap = (iterable, fn) => iterable.valueSeq().filter(Im.Map.isMap).map(fn) export default class Parameters extends Component { constructor(props) { super(props) this.state = { callbackVisible: false, parametersVisible: true } } static propTypes = { parameters: ImPropTypes.list.isRequired, specActions: PropTypes.object.isRequired, getComponent: PropTypes.func.isRequired, specSelectors: PropTypes.object.isRequired, fn: PropTypes.object.isRequired, tryItOutEnabled: PropTypes.bool, allowTryItOut: PropTypes.bool, onTryoutClick: PropTypes.func, onCancelClick: PropTypes.func, onChangeKey: PropTypes.array, pathMethod: PropTypes.array.isRequired } static defaultProps = { onTryoutClick: Function.prototype, onCancelClick: Function.prototype, tryItOutEnabled: false, allowTryItOut: true, onChangeKey: [], } onChange = ( param, value, isXml ) => { let { specActions: { changeParam }, onChangeKey, } = this.props changeParam( onChangeKey, param.get("name"), value, isXml) } onChangeConsumesWrapper = ( val ) => { let { specActions: { changeConsumesValue }, onChangeKey } = this.props changeConsumesValue(onChangeKey, val) } toggleTab = (tab) => { console.log("togggling to tab", tab) if(tab === "parameters"){ return this.setState({ parametersVisible: true, callbackVisible: false }) }else if(tab === "callbacks"){ return this.setState({ callbackVisible: true, parametersVisible: false }) } } render(){ let { onTryoutClick, onCancelClick, parameters, allowTryItOut, tryItOutEnabled, fn, getComponent, specSelectors, pathMethod } = this.props const ParameterRow = getComponent("parameterRow") const TryItOutButton = getComponent("TryItOutButton") const isExecute = tryItOutEnabled && allowTryItOut return (
No parameters
| Name | Description |
|---|