Skip to content

Commit 879c914

Browse files
authored
Merge pull request #64 from newrelic/fix_sticky_radio_button
Fix sticky radio button
2 parents d2949ac + 5dd9c34 commit 879c914

File tree

3 files changed

+15
-666
lines changed

3 files changed

+15
-666
lines changed

nerdlets/e2m-gui-nerdlet/form-components/aggregator-selector.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import PropTypes from 'prop-types';
33

44
import { RadioGroup, Radio } from 'nr1';
55

6-
const AggregatorSelector = ({ setAggregator, selectedEventType }) => {
6+
const AggregatorSelector = ({
7+
setAggregator,
8+
selectedEventType,
9+
selectedAggregator
10+
}) => {
711
/* TODO: Pull the disabledOrNotObj out to AddRule Component */
812
const disabledOrNotObj = !selectedEventType ? { disabled: true } : {};
913
return (
@@ -12,19 +16,22 @@ const AggregatorSelector = ({ setAggregator, selectedEventType }) => {
1216
{...disabledOrNotObj}
1317
label="Summary--use if the query's function is min, max, sum, count, or average"
1418
value="summary"
15-
onChange={() => setAggregator('summary')}
19+
checked={selectedAggregator === 'summary'}
20+
onClick={() => setAggregator('summary')}
1621
/>
1722
<Radio
1823
{...disabledOrNotObj}
1924
label="Distribution--use if the query's function is percentile or histogram"
2025
value="distribution"
21-
onChange={() => setAggregator('distribution')}
26+
checked={selectedAggregator === 'distribution'}
27+
onClick={() => setAggregator('distribution')}
2228
/>
2329
<Radio
2430
{...disabledOrNotObj}
2531
label="Unique Count--use if the query's function is unique count"
2632
value="uniqueCount"
27-
onChange={() => setAggregator('uniqueCount')}
33+
checked={selectedAggregator === 'uniqueCount'}
34+
onClick={() => setAggregator('uniqueCount')}
2835
/>
2936
</RadioGroup>
3037
);

0 commit comments

Comments
 (0)