Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/radio buttons508 #1644

Merged
merged 4 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/Analysis/GWASApp/Components/Covariates/Covariates.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { useQuery } from 'react-query';
import { Table, Spin } from 'antd';
import { Table, Spin, Radio } from 'antd';
import { fetchCovariates } from '../../Utils/cohortMiddlewareApi';
import queryConfig from '../../../SharedUtils/QueryConfig';
import { useFetch, useFilter } from '../../Utils/formHooks';
Expand Down Expand Up @@ -39,6 +39,13 @@ const Covariates = ({ selected, handleSelect, submittedCovariateIds }) => {
onChange: (_, selectedRows) => {
handleSelect(selectedRows[0]);
},
renderCell: (checked, record) => (
<Radio
checked={checked}
value={record.concept_id}
aria-label={'Select row for concept'}
/>
),
});

const covariateTableConfig = [
Expand Down Expand Up @@ -111,10 +118,12 @@ const Covariates = ({ selected, handleSelect, submittedCovariateIds }) => {
Covariates.propTypes = {
selected: PropTypes.object,
handleSelect: PropTypes.func.isRequired,
submittedCovariateIds: PropTypes.array,
};

Covariates.defaultProps = {
selected: null,
submittedCovariateIds: null,
};

export default Covariates;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useQuery } from 'react-query';
import { Table, Spin } from 'antd';
import { Table, Spin, Radio } from 'antd';
import { fetchCohortDefinitions } from '../../../Utils/cohortMiddlewareApi';
import queryConfig from '../../../../SharedUtils/QueryConfig';
import { useFetch, useFilter } from '../../../Utils/formHooks';
Expand Down Expand Up @@ -33,6 +33,13 @@ const CohortDefinitions = ({
onChange: (_, selectedRows) => {
handleCohortSelect(selectedRows[0]);
},
renderCell: (checked, record) => (
<Radio
checked={checked}
value={record.cohort_definition_id}
aria-label={'Select row for study population'}
/>
),
});
const cohortTableConfig = [
{
Expand Down
Loading