Skip to content

Commit

Permalink
enhancement: using select multiple field on array in smart-contract i…
Browse files Browse the repository at this point in the history
…nterface
  • Loading branch information
dafuga authored and aaroncox committed Feb 24, 2019
1 parent 3bc5a35 commit ddfd4d5
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions app/shared/components/Contract/Interface/Form/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class ContractInterfaceFormAction extends Component<Props> {
});
}
onToggle = (e, { name, checked }) => {
debugger
this.setState({
form: Object.assign(
{},
Expand Down Expand Up @@ -98,10 +99,32 @@ class ContractInterfaceFormAction extends Component<Props> {
} = this.props;
const signing = !!(system.TRANSACTION_BUILD === 'PENDING');
const fields = contract.getFields(contractAction);

const formFields = [];
fields.forEach((field) => {
const fieldsMeta = fields.map((field) => {
if (field.type.includes('[]')) {
return { ...field, type: 'array' };
}
return field;
});
fieldsMeta.forEach((field) => {
switch (field.type) {
case 'array': {
formFields.push((
<Form.Dropdown
allowAdditions
value={['test']}
fluid
key={`${contractAction}-${field.name}-${field.type}`}
label={`${field.name} (${field.type})`}
multiple
name={field.name}
onChange={this.onToggle}
search
selection
/>
));
break;
}
case 'bool': {
formFields.push((
<Form.Checkbox
Expand Down

0 comments on commit ddfd4d5

Please sign in to comment.