|
1 | 1 | import * as React from 'react';
|
2 | 2 | import './App.css';
|
3 |
| -import {DropDown} from './DropDown' |
4 |
| -import {DropDownContents} from './DropDownContents' |
5 |
| -import {Framework, Benchmark, DropdownCallback} from './Common'; |
6 |
| -import {SelectBarFrameworks} from './SelectBarFrameworks'; |
7 |
| -import {SelectBarBenchmarks} from './SelectBarBenchmarks'; |
| 3 | +import { DropDown } from './DropDown' |
| 4 | +import { DropDownContents } from './DropDownContents' |
| 5 | +import { Framework, Benchmark, DropdownCallback } from './Common'; |
| 6 | +import { SelectBarFrameworks } from './SelectBarFrameworks'; |
| 7 | +import { SelectBarBenchmarks } from './SelectBarBenchmarks'; |
8 | 8 |
|
9 | 9 | export interface Props {
|
10 |
| - frameworkSelectKeyed: DropdownCallback<Framework>; |
11 |
| - frameworkSelectNonKeyed: DropdownCallback<Framework>; |
12 |
| - benchSelectCpu: DropdownCallback<Benchmark>; |
13 |
| - benchSelectStartup: DropdownCallback<Benchmark>; |
14 |
| - benchSelectMem: DropdownCallback<Benchmark>; |
15 |
| - selectFramework: (framework: Framework, value: boolean) => void; |
16 |
| - selectBenchmark: (benchmark: Benchmark, value: boolean) => void; |
17 |
| - selectSeparateKeyedAndNonKeyed: (value: boolean) => void; |
18 |
| - separateKeyedAndNonKeyed: boolean; |
19 |
| - frameworksKeyed: Array<Framework>; |
20 |
| - frameworksNonKeyed: Array<Framework>; |
21 |
| - benchmarksCPU: Array<Benchmark>; |
22 |
| - benchmarksStartup: Array<Benchmark>; |
23 |
| - benchmarksMEM: Array<Benchmark>; |
24 |
| - compareWith: Framework | undefined; |
25 |
| - selectComparison: (framework: string) => void; |
26 |
| - useMedian: boolean; |
27 |
| - selectMedian: (value: boolean) => void; |
28 |
| - highlightVariance: boolean; |
29 |
| - selectHighlightVariance: (value: boolean) => void; |
| 10 | + frameworkSelectKeyed: DropdownCallback<Framework>; |
| 11 | + frameworkSelectNonKeyed: DropdownCallback<Framework>; |
| 12 | + benchSelectCpu: DropdownCallback<Benchmark>; |
| 13 | + benchSelectStartup: DropdownCallback<Benchmark>; |
| 14 | + benchSelectMem: DropdownCallback<Benchmark>; |
| 15 | + selectFramework: (framework: Framework, value: boolean) => void; |
| 16 | + selectBenchmark: (benchmark: Benchmark, value: boolean) => void; |
| 17 | + selectSeparateKeyedAndNonKeyed: (value: boolean) => void; |
| 18 | + separateKeyedAndNonKeyed: boolean; |
| 19 | + frameworksKeyed: Array<Framework>; |
| 20 | + frameworksNonKeyed: Array<Framework>; |
| 21 | + benchmarksCPU: Array<Benchmark>; |
| 22 | + benchmarksStartup: Array<Benchmark>; |
| 23 | + benchmarksMEM: Array<Benchmark>; |
| 24 | + compareWith: Framework | undefined; |
| 25 | + selectComparison: (framework: string) => void; |
| 26 | + useMedian: boolean; |
| 27 | + selectMedian: (value: boolean) => void; |
| 28 | + highlightVariance: boolean; |
| 29 | + selectHighlightVariance: (value: boolean) => void; |
30 | 30 | }
|
31 | 31 |
|
32 |
| -const SelectCategory = ({benchmarks, select, benchSelect, label} : |
33 |
| - {benchmarks: Array<Benchmark>, select: (benchmark: Benchmark, value: boolean) => void, benchSelect: DropdownCallback<Benchmark>, label: string} ) => { |
34 |
| - return (<DropDownContents {...benchSelect}> |
35 |
| - <h3>{label}</h3> |
36 |
| - <div> |
| 32 | +const SelectCategory = ({ benchmarks, select, benchSelect, label }: |
| 33 | + { benchmarks: Array<Benchmark>, select: (benchmark: Benchmark, value: boolean) => void, benchSelect: DropdownCallback<Benchmark>, label: string }) => { |
| 34 | + return (<DropDownContents {...benchSelect}> |
| 35 | + <h3>{label}</h3> |
| 36 | + <div> |
37 | 37 | <SelectBarBenchmarks isSelected={benchSelect.isSelected} select={select} benchmarks={benchmarks} />
|
38 |
| - </div> |
39 |
| - </DropDownContents>); |
| 38 | + </div> |
| 39 | + </DropDownContents>); |
40 | 40 | }
|
41 | 41 |
|
42 | 42 |
|
43 | 43 |
|
44 | 44 | export class SelectBar extends React.Component<Props, {}> {
|
45 | 45 | render() {
|
46 |
| - let {frameworkSelectKeyed, |
47 |
| - frameworkSelectNonKeyed, |
48 |
| - benchSelectCpu, |
49 |
| - benchSelectStartup, |
50 |
| - benchSelectMem, |
51 |
| - selectFramework, |
52 |
| - selectBenchmark, |
53 |
| - selectSeparateKeyedAndNonKeyed, |
54 |
| - separateKeyedAndNonKeyed, |
55 |
| - frameworksKeyed, |
56 |
| - frameworksNonKeyed, |
57 |
| - benchmarksCPU, |
58 |
| - benchmarksStartup, |
59 |
| - benchmarksMEM, |
60 |
| - compareWith, |
61 |
| - selectComparison, |
62 |
| - useMedian, |
63 |
| - selectMedian, |
64 |
| - highlightVariance, |
65 |
| - selectHighlightVariance |
66 |
| - } = this.props; |
| 46 | + let { frameworkSelectKeyed, |
| 47 | + frameworkSelectNonKeyed, |
| 48 | + benchSelectCpu, |
| 49 | + benchSelectStartup, |
| 50 | + benchSelectMem, |
| 51 | + selectFramework, |
| 52 | + selectBenchmark, |
| 53 | + selectSeparateKeyedAndNonKeyed, |
| 54 | + separateKeyedAndNonKeyed, |
| 55 | + frameworksKeyed, |
| 56 | + frameworksNonKeyed, |
| 57 | + benchmarksCPU, |
| 58 | + benchmarksStartup, |
| 59 | + benchmarksMEM, |
| 60 | + compareWith, |
| 61 | + selectComparison, |
| 62 | + useMedian, |
| 63 | + selectMedian, |
| 64 | + highlightVariance, |
| 65 | + selectHighlightVariance |
| 66 | + } = this.props; |
67 | 67 | return (
|
68 |
| - <div> |
69 | 68 | <div>
|
70 |
| - <DropDown label="Which frameworks?" width='1024px'> |
71 |
| - <DropDownContents {...frameworkSelectKeyed}> |
72 |
| - <h3>Keyed frameworks:</h3> |
73 |
| - <div> |
74 |
| - <SelectBarFrameworks isSelected={frameworkSelectKeyed.isSelected} select={selectFramework} frameworks={frameworksKeyed} /> |
75 |
| - </div> |
76 |
| - </DropDownContents> |
77 |
| - <DropDownContents {...frameworkSelectNonKeyed}> |
78 |
| - <h3>Non-keyed frameworks:</h3> |
79 |
| - <div> |
80 |
| - <SelectBarFrameworks isSelected={frameworkSelectNonKeyed.isSelected} select={selectFramework} frameworks={frameworksNonKeyed}/> |
81 |
| - </div> |
82 |
| - </DropDownContents> |
83 |
| - </DropDown> |
84 |
| - <div className="hspan"/> |
85 |
| - <DropDown label="Which benchmarks?" width='300px'> |
86 |
| - <SelectCategory benchmarks={benchmarksCPU} select={selectBenchmark} benchSelect={benchSelectCpu} label="Duration"/> |
87 |
| - <SelectCategory benchmarks={benchmarksStartup} select={selectBenchmark} benchSelect={benchSelectStartup} label="Startup"/> |
88 |
| - <SelectCategory benchmarks={benchmarksMEM} select={selectBenchmark} benchSelect={benchSelectMem} label="Memory"/> |
89 |
| - </DropDown> |
90 |
| - <div className="hspan"/> |
91 |
| - <div className="checkbox" style={{display:"inline-block"}}> |
92 |
| - <label> |
93 |
| - <input type="checkbox" onChange={(evt) => selectSeparateKeyedAndNonKeyed(evt.target.checked)} checked={separateKeyedAndNonKeyed} /> |
94 |
| - Separate keyed and non-keyed |
95 |
| - </label> |
96 |
| - </div> |
97 |
| - <div className="hspan"/> |
98 |
| - <form className="form-inline" style={{display:"inline-block"}}> |
99 |
| - <div className="form-group"> |
100 |
| - <div className="hspan"/> |
101 |
| - <select className="form-control" value={compareWith ? compareWith.name : ''} onChange={(evt) => selectComparison(evt.target.value)}> |
102 |
| - <option value=''>Compare with ...</option> |
103 |
| - <optgroup label="Keyed"> |
104 |
| - { frameworksKeyed.map(f => <option key={f.name} value={f.name}>{f.name}</option>) } |
105 |
| - </optgroup> |
106 |
| - <optgroup label="Non-keyed"> |
107 |
| - { frameworksNonKeyed.map(f => <option key={f.name} value={f.name}>{f.name}</option>) } |
108 |
| - </optgroup> |
109 |
| - </select> |
| 69 | + <div> |
| 70 | + <DropDown label="Which frameworks?" width='1024px'> |
| 71 | + <DropDownContents {...frameworkSelectKeyed}> |
| 72 | + <h3>Keyed frameworks:</h3> |
| 73 | + <SelectBarFrameworks isSelected={frameworkSelectKeyed.isSelected} select={selectFramework} frameworks={frameworksKeyed} /> |
| 74 | + </DropDownContents> |
| 75 | + <DropDownContents {...frameworkSelectNonKeyed}> |
| 76 | + <h3>Non-keyed frameworks:</h3> |
| 77 | + <SelectBarFrameworks isSelected={frameworkSelectNonKeyed.isSelected} select={selectFramework} frameworks={frameworksNonKeyed} /> |
| 78 | + </DropDownContents> |
| 79 | + </DropDown> |
| 80 | + <div className="hspan" /> |
| 81 | + <DropDown label="Which benchmarks?" width='300px'> |
| 82 | + <SelectCategory benchmarks={benchmarksCPU} select={selectBenchmark} benchSelect={benchSelectCpu} label="Duration" /> |
| 83 | + <SelectCategory benchmarks={benchmarksStartup} select={selectBenchmark} benchSelect={benchSelectStartup} label="Startup" /> |
| 84 | + <SelectCategory benchmarks={benchmarksMEM} select={selectBenchmark} benchSelect={benchSelectMem} label="Memory" /> |
| 85 | + </DropDown> |
| 86 | + <div className="hspan" /> |
| 87 | + <div className="form-check" style={{ display: "inline-block" }}> |
| 88 | + <input className="form-check-input" type="checkbox" onChange={(evt) => selectSeparateKeyedAndNonKeyed(evt.target.checked)} checked={separateKeyedAndNonKeyed} /> |
| 89 | + <label className="form-check-label"> |
| 90 | + Separate keyed and non-keyed |
| 91 | + </label> |
| 92 | + </div> |
| 93 | + <div className="hspan" /> |
| 94 | + <form className="form-inline" style={{ display: "inline-block" }}> |
| 95 | + <div className="form-group"> |
| 96 | + <div className="hspan" /> |
| 97 | + <select className="form-control" value={compareWith ? compareWith.name : ''} onChange={(evt) => selectComparison(evt.target.value)}> |
| 98 | + <option value=''>Compare with ...</option> |
| 99 | + <optgroup label="Keyed"> |
| 100 | + {frameworksKeyed.map(f => <option key={f.name} value={f.name}>{f.name}</option>)} |
| 101 | + </optgroup> |
| 102 | + <optgroup label="Non-keyed"> |
| 103 | + {frameworksNonKeyed.map(f => <option key={f.name} value={f.name}>{f.name}</option>)} |
| 104 | + </optgroup> |
| 105 | + </select> |
| 106 | + </div> |
| 107 | + </form> |
| 108 | + <div className="hspan" /> |
| 109 | + <div className="form-check" style={{ display: "inline-block" }}> |
| 110 | + <input className="form-check-input" type="checkbox" onChange={(evt) => selectMedian(evt.target.checked)} checked={useMedian} /> |
| 111 | + <label className="form-check-label"> |
| 112 | + Use median instead of mean |
| 113 | + </label> |
| 114 | + </div> |
| 115 | + <div className="hspan" /> |
| 116 | + <div className="form-check" style={{ display: "inline-block" }}> |
| 117 | + <input className="form-check-input" type="checkbox" onChange={(evt) => selectHighlightVariance(evt.target.checked)} checked={highlightVariance} /> |
| 118 | + <label className="form-check-label"> |
| 119 | + Highlight variance |
| 120 | + </label> |
| 121 | + </div> |
110 | 122 | </div>
|
111 |
| - </form> |
112 |
| - <div className="hspan"/> |
113 |
| - <div className="checkbox" style={{display:"inline-block"}}> |
114 |
| - <label> |
115 |
| - <input type="checkbox" onChange={(evt) => selectMedian(evt.target.checked)} checked={useMedian} /> |
116 |
| - Use median instead of mean |
117 |
| - </label> |
118 |
| - </div> |
119 |
| - <div className="hspan"/> |
120 |
| - <div className="checkbox" style={{display:"inline-block"}}> |
121 |
| - <label> |
122 |
| - <input type="checkbox" onChange={(evt) => selectHighlightVariance(evt.target.checked)} checked={highlightVariance} /> |
123 |
| - Highlight variance |
124 |
| - </label> |
125 |
| - </div> |
126 | 123 | </div>
|
127 |
| - </div> |
128 | 124 | );
|
129 | 125 | }
|
130 | 126 | }
|
0 commit comments