From 4bacfdeb05795947254fef8b4c12ce0ebe9f64f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Pr=C3=B3chniak?= Date: Tue, 28 Apr 2020 10:01:37 +0200 Subject: [PATCH] [FIX] Validate generate data input, closes #1 (#892) --- .../modals/GenerateTestDataDialog.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ui/client/components/modals/GenerateTestDataDialog.js b/ui/client/components/modals/GenerateTestDataDialog.js index 8f387959368..a4a58b289f6 100644 --- a/ui/client/components/modals/GenerateTestDataDialog.js +++ b/ui/client/components/modals/GenerateTestDataDialog.js @@ -6,13 +6,16 @@ import HttpService from "../../http/HttpService" import "../../stylesheets/visualization.styl" import Dialogs from "./Dialogs" import GenericModalDialog from "./GenericModalDialog" +import {allValid, literalIntegerValueValidator, mandatoryValueValidator} from "../graph/node-modal/editors/Validators" +import ValidationLabels from "./ValidationLabels" class GenerateTestDataDialog extends React.Component { constructor(props) { super(props) this.initState = { - testSampleSize: 10, + //TODO: current validators work well only for string values + testSampleSize: "10", } this.state = this.initState } @@ -21,15 +24,28 @@ class GenerateTestDataDialog extends React.Component { return HttpService.generateTestData(this.props.processId, this.state.testSampleSize, this.props.processToDisplay) } + onInputChange = (event) => { + this.setState({testSampleSize: event.target.value}) + } + render() { + const validators = [literalIntegerValueValidator, mandatoryValueValidator] return ( this.setState(this.initState)} confirm={this.confirm} + okBtnConfig={{disabled: !allValid(validators, [this.state.testSampleSize])}} type={Dialogs.types.generateTestData} >

Generate test data

- { this.setState({testSampleSize: e.target.value}) } }/> + + +
) }