From f3d4aa43f3600f8ad9cac6614d54662220f71d8d Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 2 Nov 2016 17:25:21 +0100 Subject: [PATCH] Allow boolean dropdowns for contract deploy (#3077) * Allow boolean dropdowns for contract deploy * Be explicit in deployment types * Extra line as per PR comments --- .../DeployContract/DetailsStep/detailsStep.js | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/js/src/modals/DeployContract/DetailsStep/detailsStep.js b/js/src/modals/DeployContract/DetailsStep/detailsStep.js index 1eebe4304..e0f02bc70 100644 --- a/js/src/modals/DeployContract/DetailsStep/detailsStep.js +++ b/js/src/modals/DeployContract/DetailsStep/detailsStep.js @@ -15,8 +15,9 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import { MenuItem } from 'material-ui'; -import { AddressSelect, Form, Input, InputAddressSelect } from '../../../ui'; +import { AddressSelect, Form, Input, InputAddressSelect, Select } from '../../../ui'; import { validateAbi } from '../../../util/validation'; import styles from '../deployContract.css'; @@ -98,6 +99,7 @@ export default class DetailsStep extends Component { return inputs.map((input, index) => { const onChange = (event, value) => this.onParamChange(index, value); + const onChangeBool = (event, _index, value) => this.onParamChange(index, value === 'true'); const onSubmit = (value) => this.onParamChange(index, value); const label = `${input.name}: ${input.type}`; let inputBox = null; @@ -115,6 +117,26 @@ export default class DetailsStep extends Component { ); break; + case 'bool': + const boolitems = ['false', 'true'].map((bool) => { + return ( + { bool } + ); + }); + inputBox = ( + + ); + break; + default: inputBox = ( { switch (input.type) { + case 'address': + params.push('0x'); + break; + + case 'bool': + params.push(false); + break; + + case 'bytes': + params.push('0x'); + break; + + case 'uint': + params.push('0'); + break; + case 'string': params.push(''); break; default: - params.push('0x'); + params.push('0'); break; } });