diff --git a/frontend/packages/manager/src/components/profiles/AddProfileModal.jsx b/frontend/packages/manager/src/components/profiles/AddProfileModal.jsx index 6694664..036621a 100644 --- a/frontend/packages/manager/src/components/profiles/AddProfileModal.jsx +++ b/frontend/packages/manager/src/components/profiles/AddProfileModal.jsx @@ -22,13 +22,11 @@ function AddProfileModal(props) { }, []); const handleVarBinds = (value) => { - ProfCtx.setVarBinds(value) - console.log('varbindslol: ', value); + ProfCtx.setVarBinds(value); } const handleConditions = (value) => { - ProfCtx.setConditions(value) - console.log('conditionsslol: ', value); + ProfCtx.setConditions(value); } const postProfile = (profileObj) => { diff --git a/frontend/packages/manager/src/components/profiles/Conditions.jsx b/frontend/packages/manager/src/components/profiles/Conditions.jsx index 175f615..15239e0 100644 --- a/frontend/packages/manager/src/components/profiles/Conditions.jsx +++ b/frontend/packages/manager/src/components/profiles/Conditions.jsx @@ -7,38 +7,40 @@ import PatternsCreator from "./PatternsCreator"; class Conditions extends Component { constructor(props) { super(props); - + let stateValue; if(this.props.value){ - this.state = this.props.value; + stateValue = this.props.value; }else{ - this.state = { + stateValue = { condition: 'base', field: '', patterns: null }; } + this.state = stateValue; this.props.onConditionsCreator(this.state); } + handleChange = (e, {value}) => { - this.setState({condition: value}); + if (value != "field"){ + this.setState({condition: value, field: '', patterns :null}, + () => {this.props.onConditionsCreator(this.state);}); + }else{ + this.setState({condition: value}, () => {this.props.onConditionsCreator(this.state);}); + }; }; handleFieldChange = (e, {value}) => { - this.setState({field: value}); + this.setState({field: value}, () => {this.props.onConditionsCreator(this.state);}); }; handlePatterns = (value) => { - this.setState({patterns: value}); - } - - handleConditionChange = (value) => { - var state = this.state; - this.props.onConditionsCreator(state); + this.setState({patterns: value}, () => {this.props.onConditionsCreator(this.state);}); } render() { return ( -
+