({
componentName,
graphs,
selectGraph
}: Props)
| 21 | * If no component is specified `All Components` will be picked |
| 22 | */ |
| 23 | export const GraphSelector = ({ |
| 24 | componentName, |
| 25 | graphs, |
| 26 | selectGraph |
| 27 | }: Props) => { |
| 28 | let graphOptions = graphs.map(graph => { |
| 29 | return { value: graph, label: displayName(graph.toString()) }; |
| 30 | }); |
| 31 | |
| 32 | let defaultValue = componentName |
| 33 | ? ({ value: componentName, label: displayName(componentName) } as ValueType<OptionTypeBase, false>) |
| 34 | : graphOptions[0]; |
| 35 | |
| 36 | return ( |
| 37 | <Select |
| 38 | value={defaultValue} |
| 39 | className="component-select" |
| 40 | classNamePrefix="react-select" |
| 41 | onChange={value => selectGraph((value as unknown as { value: string }).value)} |
| 42 | placeholder="Select graph..." |
| 43 | options={graphOptions} |
| 44 | /> |
| 45 | ); |
| 46 | }; |
nothing calls this directly
no test coverage detected