-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(no-access): add no access message (#1301) * feat(twoAttritionTables): Created separate component to modularize attrition table * feat(twoAttritionTables): Added prop types to Attrition table * feat(twoAttritionTables): Renamed test for AttritionTableWrapper * feat(twoAttritionTables): Refactored test for AttritionTableWrapper * feat(twoAttritionTables): Resolved linting issues * feat(twoAttritionTables): Reverted file to master * feat(twoAttritionTables): Reverted file to sprint branch version * feat(twoAttritionTables): Refactored test to validate correct output of data * feat(twoAttritionTables): simplified error messaging logic * feat(twoAttritionTables): Ran linter * feat(twoAttritionTables): Added support for capitalized type columns and Outcome Phenotype label * feat(twoAttritionTables): Ran linter --------- Co-authored-by: Thanh Dang Nguyen <thanhnd@uchicago.edu>
- Loading branch information
1 parent
ab1286e
commit 3f46033
Showing
6 changed files
with
160 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/Analysis/GWASResults/Views/Input/AttritionTable/AttrtitionTableWrapper.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useContext } from 'react'; | ||
import { useQuery } from 'react-query'; | ||
import { Spin } from 'antd'; | ||
import { | ||
getDataForWorkflowArtifact, | ||
queryConfig, | ||
} from '../../../Utils/gwasWorkflowApi'; | ||
import SharedContext from '../../../Utils/SharedContext'; | ||
import LoadingErrorMessage from '../../../Components/LoadingErrorMessage/LoadingErrorMessage'; | ||
import './AttritionTable.css'; | ||
import AttritionTable from './AttrtitionTable'; | ||
|
||
const AttritionTableWrapper = () => { | ||
const { selectedRowData } = useContext(SharedContext); | ||
const { name, uid } = selectedRowData; | ||
const { data, status } = useQuery( | ||
[`getDataForWorkflowArtifact${name}`, name, uid, 'attrition_json_index'], | ||
() => getDataForWorkflowArtifact(name, uid, 'attrition_json_index'), | ||
queryConfig, | ||
); | ||
|
||
if (status === 'error') { | ||
return ( | ||
<LoadingErrorMessage | ||
data-testid='loading-error-message' | ||
message='Error getting attrition table data' | ||
/> | ||
); | ||
} | ||
|
||
if (status === 'loading') { | ||
return ( | ||
<div className='spinner-container' data-testid='spinner'> | ||
<Spin /> | ||
</div> | ||
); | ||
} | ||
|
||
if (!data || data.length === 0 || data[0].table_type !== 'case' || data.error) { | ||
return ( | ||
<LoadingErrorMessage message='Error Getting Attrition Table Data' /> | ||
); | ||
} | ||
|
||
return ( | ||
<section data-testid='attrition-table-wrapper' className='attrition-table-wrapper'> | ||
<AttritionTable tableData={data[0]} title='Case Cohort Attrition Table' /> | ||
{data[1]?.table_type === 'control' | ||
&& <AttritionTable tableData={data[1]} title='Control Cohort Attrition Table' />} | ||
</section> | ||
); | ||
}; | ||
export default AttritionTableWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters