diff --git a/src/ic/edit-ic.js b/src/ic/edit-ic.js index be77e27..4f086fd 100644 --- a/src/ic/edit-ic.js +++ b/src/ic/edit-ic.js @@ -16,7 +16,7 @@ ******************************************************************************/ import React from 'react'; -import { Form } from 'react-bootstrap'; +import { Form, Col, Row, Button } from 'react-bootstrap'; import _ from 'lodash'; import Dialog from '../common/dialogs/dialog'; import ParametersEditor from '../common/parameters-editor'; @@ -120,6 +120,23 @@ class EditICDialog extends React.Component { }); } + selectStartParamsFile(event) { + const file = event.target.files[0]; + if (file.type.match('application/json') === false) { + console.log("not a json file") + return; + } + + let reader = new FileReader(); + reader.readAsText(file); + + // TODO: error handling + reader.onload = event => { + const params = JSON.parse(reader.result); + this.setState({ startParameterSchema: params}) + } + }; + render() { let typeOptions = []; switch(this.state.category){ @@ -196,8 +213,16 @@ class EditICDialog extends React.Component { this.handleChange(e)} /> +
- Start parameter schema of IC + + + Start parameter schema of IC + + + this.selectStartParamsFile(event)} /> + +