initialize suite on form change
This commit is contained in:
parent
c42f955a22
commit
85d345dd10
@ -13,11 +13,13 @@ export class BenchmarkSuite {
|
|||||||
|
|
||||||
setBenchmarkType(benchmarktype) {
|
setBenchmarkType(benchmarktype) {
|
||||||
this.benchmarktype = benchmarktype
|
this.benchmarktype = benchmarktype
|
||||||
|
this.onChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
setCases(cases) {
|
setCases(cases) {
|
||||||
this.cases = new CasesIterator(cases)
|
this.cases = new CasesIterator(cases)
|
||||||
this.stats = this.cases.getInitialStats()
|
this.stats = this.cases.getInitialStats()
|
||||||
|
this.onChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
addStat(name, val) {
|
addStat(name, val) {
|
||||||
|
@ -37,13 +37,16 @@ export class BenchmarkRunner extends Component {
|
|||||||
if (prevState !== this.state) {
|
if (prevState !== this.state) {
|
||||||
this.props.onStatsChange(this.suite.stats)
|
this.props.onStatsChange(this.suite.stats)
|
||||||
}
|
}
|
||||||
|
if (prevProps.formState !== this.props.formState) {
|
||||||
|
this.initializeSuite()
|
||||||
|
this.suite.stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeSuite() {
|
initializeSuite() {
|
||||||
let data = dataSelector[this.props.formState.dataset]
|
let data = dataSelector[this.props.formState.dataset]
|
||||||
this.suite.setBenchmarkType(benchmarkTypeSelector(this.props.formState))
|
this.suite.setBenchmarkType(benchmarkTypeSelector(this.props.formState))
|
||||||
this.suite.setCases(generateCases(data, this.props.formState))
|
this.suite.setCases(generateCases(data, this.props.formState))
|
||||||
this.suite.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stateIsOneOf(states) {
|
stateIsOneOf(states) {
|
||||||
@ -83,7 +86,14 @@ export class BenchmarkRunner extends Component {
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
{this.startButtonShown() && (
|
{this.startButtonShown() && (
|
||||||
<button onClick={() => this.initializeSuite()}>start</button>
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
this.initializeSuite()
|
||||||
|
this.suite.start()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
start
|
||||||
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{this.resumeButtonShown() && (
|
{this.resumeButtonShown() && (
|
||||||
|
Loading…
Reference in New Issue
Block a user