From 0c67bcd68a09ad6813accff659f042398be89803 Mon Sep 17 00:00:00 2001 From: irismarie Date: Fri, 7 May 2021 16:30:18 +0200 Subject: [PATCH] [WIP] load start parameter schema file --- src/ic/edit-ic.js | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) 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)} /> + +