From ac0c7efd13b2c1162c0c17577bf06e33c4da2139 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Wed, 20 Nov 2024 11:08:17 -0500 Subject: [PATCH 1/4] add filter tooltip --- src/components/Repository/FileList.js | 81 +++++++++++++++++++++------ 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/src/components/Repository/FileList.js b/src/components/Repository/FileList.js index 361c63b..ef792ca 100644 --- a/src/components/Repository/FileList.js +++ b/src/components/Repository/FileList.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { DndProvider } from 'react-dnd' import { HTML5Backend } from 'react-dnd-html5-backend' -import { Button, Col, Container, Row, Spinner, Modal, ModalHeader, ModalBody, ModalFooter } from "reactstrap"; +import { Button, Col, Container, Row, Spinner, Modal, ModalHeader, ModalBody, ModalFooter, UncontrolledTooltip } from "reactstrap"; import { resultConverter } from "../../helpers/dataHelper"; import { faXmark, faAnglesRight, faAnglesLeft, faDownload, faUnlock, faUnlockKeyhole, faTrashCan } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; @@ -436,23 +436,70 @@ class FileList extends Component { }; getFilterPills = (filters) => { - return filters.map( - filter => { - return filter.values.map(value => { - return ( -
- {value} { - this.props.removeFilter(filter.field, value) - }} - className="close-button fas fa-xmark ms-2" - icon={faXmark} /> -
) - }) - }) + const filterDisplayNames = { + participant: "Participant", + sample_type: "Sample Type", + data_format: "Data Format", + access: "Access", + redcap_id: "Participant ID", + file_name: "File Name", + data_category: "Data Category", + workflow_type: "Workflow Type", + platform: "Platform", + file_size: "File Size", + file_id: "File ID", + data_type: "Data Type", + dois: "DOIs", + experimental_strategy: "Experimental Strategy", + sex: "Sex", + age_binned: "Age (Binned)", + enrollment_category: "Enrollment Category", + tissue_source: "Tissue Source", + protocol: "Protocol", + release_version: "Release Version", + race: "Race", + proteinuria: "Proteinuria", + hypertension_history: "Hypertension History", + hypertension_duration: "Hypertension Duration", + on_raas_blockade: "RAAS Blockade", + diabetes_duration: "Diabetes Duration", + diabetes_history: "Diabetes History", + kdigo_stage: "KDIGO Stage", + a1c: "A1c", + albuminuria: "Albuminuria", + baseline_egfr: "Baseline eGFR", + primary_adjudicated_category: "Primary Adjudicated Category" + }; + + return filters.map(filter => { + return filter.values.map(value => { + const sanitizedId = `${filter.field.toString()}-${value.toString()}`.replace(/[^a-zA-Z0-9-_]/g, '_'); + return ( +
+ {value} + + {filterDisplayNames[filter.field] || filter.field} + + { + this.props.removeFilter(filter.field, value); + }} + className="close-button fas fa-xmark ms-2" + icon={faXmark} + /> + +
+ ); + }); + }); }; + + getTotalPages = () => { let val = Math.ceil(this.props.totalResults / this.props.resultsPerPage); From 95d3626fba2d54b4a5fe69eea7e269cc41b29162 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Thu, 21 Nov 2024 10:49:02 -0500 Subject: [PATCH 2/4] fix test --- src/helpers/dataHelper.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/dataHelper.test.js b/src/helpers/dataHelper.test.js index e0f1135..49c9b04 100644 --- a/src/helpers/dataHelper.test.js +++ b/src/helpers/dataHelper.test.js @@ -89,7 +89,7 @@ describe('dataHelper', () => { "kdigoStage": "testdkigo_stage", "onRaasBlockade": "test-on_raas_blockade", "proteinuria": "proteinuria", - "race": "test-race", + "race": "test-Race", "age": "test-Age", "sex": "test-sex", "protocol": "test-protocol", From 0e984cc1a577b0ce575c72600b016b9b443d2f35 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Thu, 21 Nov 2024 11:02:55 -0500 Subject: [PATCH 3/4] remove (Binned) --- src/components/Repository/FileList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Repository/FileList.js b/src/components/Repository/FileList.js index ef792ca..1f416ca 100644 --- a/src/components/Repository/FileList.js +++ b/src/components/Repository/FileList.js @@ -452,7 +452,7 @@ class FileList extends Component { dois: "DOIs", experimental_strategy: "Experimental Strategy", sex: "Sex", - age_binned: "Age (Binned)", + age_binned: "Age", enrollment_category: "Enrollment Category", tissue_source: "Tissue Source", protocol: "Protocol", From 68f30342747dc300716efd568ab5483e03efbe0a Mon Sep 17 00:00:00 2001 From: dert1129 Date: Thu, 21 Nov 2024 11:25:11 -0500 Subject: [PATCH 4/4] change expected output --- src/helpers/dataHelper.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/dataHelper.test.js b/src/helpers/dataHelper.test.js index 49c9b04..2e4f130 100644 --- a/src/helpers/dataHelper.test.js +++ b/src/helpers/dataHelper.test.js @@ -89,7 +89,7 @@ describe('dataHelper', () => { "kdigoStage": "testdkigo_stage", "onRaasBlockade": "test-on_raas_blockade", "proteinuria": "proteinuria", - "race": "test-Race", + "race": "test-race", "age": "test-Age", "sex": "test-sex", "protocol": "test-protocol", @@ -109,7 +109,7 @@ describe('dataHelper', () => { 'KDIGO Stage': 'testdkigo_stage', 'RAAS Blockade': 'test-on_raas_blockade', 'Proteinuria (mg)': 'proteinuria', - 'Race': 'test-Race', + 'Race': 'test-race', 'Age (Years)': 'test-Age', 'Sample Type': 'test-sample_type', 'Sex': 'test-sex',