| 8 | |
| 9 | //this input appears when adding a new value to an object |
| 10 | export default class extends React.PureComponent { |
| 11 | render() { |
| 12 | const { active, theme, rjvId } = this.props; |
| 13 | |
| 14 | return active ? ( |
| 15 | <ObjectKeyModal |
| 16 | rjvId={rjvId} |
| 17 | theme={theme} |
| 18 | isValid={this.isValid} |
| 19 | submit={this.submit} |
| 20 | /> |
| 21 | ) : null; |
| 22 | } |
| 23 | |
| 24 | isValid = input => { |
| 25 | const { rjvId } = this.props; |
| 26 | const request = ObjectAttributes.get( |
| 27 | rjvId, |
| 28 | 'action', |
| 29 | 'new-key-request' |
| 30 | ); |
| 31 | return ( |
| 32 | input != '' && |
| 33 | Object.keys(request.existing_value).indexOf(input) === -1 |
| 34 | ); |
| 35 | }; |
| 36 | |
| 37 | submit = input => { |
| 38 | const { rjvId } = this.props; |
| 39 | let request = ObjectAttributes.get(rjvId, 'action', 'new-key-request'); |
| 40 | request.new_value = { ...request.existing_value }; |
| 41 | request.new_value[input] = this.props.defaultValue; |
| 42 | dispatcher.dispatch({ |
| 43 | name: 'VARIABLE_ADDED', |
| 44 | rjvId: rjvId, |
| 45 | data: request |
| 46 | }); |
| 47 | }; |
| 48 | } |
nothing calls this directly
no outgoing calls
no test coverage detected