diff --git a/frontend/src/components/GenomicVariations/VariantsResults.js b/frontend/src/components/GenomicVariations/VariantsResults.js index 4615f2d..d88cc36 100644 --- a/frontend/src/components/GenomicVariations/VariantsResults.js +++ b/frontend/src/components/GenomicVariations/VariantsResults.js @@ -120,10 +120,13 @@ function VariantsResults (props) { } if (token === null) { + console.log(jsonData1) res = await axios.post( configData.API_URL + '/g_variants', jsonData1 ) + + console.log(res) } else { const headers = { Authorization: `Bearer ${token}` } @@ -298,9 +301,9 @@ function VariantsResults (props) { } } } catch (error) { + setError('Connection error. Please retry') setTimeOut(true) console.log(error) - setError(error) } } apiCall() @@ -379,6 +382,9 @@ function VariantsResults (props) { )} )} + {timeOut && error === 'Connection error. Please retry' && ( +

  {error}

+ )} )} diff --git a/frontend/src/components/Individuals/IndividualsResults.js b/frontend/src/components/Individuals/IndividualsResults.js index 92356d9..58e619b 100644 --- a/frontend/src/components/Individuals/IndividualsResults.js +++ b/frontend/src/components/Individuals/IndividualsResults.js @@ -210,14 +210,34 @@ function IndividualsResults (props) { setBoolean(false) } else { res.data.response.resultSets.forEach((element, index) => { + console.log(res.data.response) if (element.id && element.id !== '') { - let arrayResultsPerDataset = [ - element.beaconId, - element.id, - element.exists, - element.resultsCount - ] - resultsPerDataset.push(arrayResultsPerDataset) + if (resultsPerDataset.length > 0) { + resultsPerDataset.forEach(element2 => { + if (element2[0] === element.beaconId) { + element2[1].push(element.id) + element2[2].push(element.exists) + element2[3].push(element.resultsCounts) + } else { + console.log('hola') + let arrayResultsPerDataset = [ + element.beaconId, + [element.id], + [element.exists], + [element.resultsCount] + ] + resultsPerDataset.push(arrayResultsPerDataset) + } + }) + } else { + let arrayResultsPerDataset = [ + element.beaconId, + [element.id], + [element.exists], + [element.resultsCount] + ] + resultsPerDataset.push(arrayResultsPerDataset) + } } if (element.id === undefined || element.id === '') { @@ -238,9 +258,6 @@ function IndividualsResults (props) { } }) } - - - } else { var jsonData2 = { meta: { @@ -292,14 +309,34 @@ function IndividualsResults (props) { setBoolean(false) } else { res.data.response.resultSets.forEach((element, index) => { + console.log(res.data.response) if (element.id && element.id !== '') { - let arrayResultsPerDataset = [ - element.beaconId, - element.id, - element.exists, - element.resultsCount - ] - resultsPerDataset.push(arrayResultsPerDataset) + if (resultsPerDataset.length > 0) { + resultsPerDataset.forEach(element2 => { + if (element2[0] === element.beaconId) { + element2[1].push(element.id) + element2[2].push(element.exists) + element2[3].push(element.resultsCounts) + } else { + console.log('hola') + let arrayResultsPerDataset = [ + element.beaconId, + [element.id], + [element.exists], + [element.resultsCount] + ] + resultsPerDataset.push(arrayResultsPerDataset) + } + }) + } else { + let arrayResultsPerDataset = [ + element.beaconId, + [element.id], + [element.exists], + [element.resultsCount] + ] + resultsPerDataset.push(arrayResultsPerDataset) + } } if (element.id === undefined || element.id === '') { diff --git a/frontend/src/components/Results/IndividualsResults/TableResultsIndividuals.js b/frontend/src/components/Results/IndividualsResults/TableResultsIndividuals.js index c38f5ac..4e7a0f1 100644 --- a/frontend/src/components/Results/IndividualsResults/TableResultsIndividuals.js +++ b/frontend/src/components/Results/IndividualsResults/TableResultsIndividuals.js @@ -348,7 +348,7 @@ function TableResultsIndividuals (props) { sex: stringSex, diseases: diseases }) - + if (index === resultsSelectedFinal.length - 1) { setEditable(rows.map(o => ({ ...o }))) setTrigger2(true) @@ -358,7 +358,9 @@ function TableResultsIndividuals (props) { }, [trigger, resultsSelectedFinal]) useEffect(() => { - + console.log(props.resultsPerDataset) + console.log(props.beaconsList) + console.log(arrayBeaconsIds) let count = 0 props.beaconsList.forEach((element2, index2) => { count = getOccurrence(arrayBeaconsIds, element2.meta.beaconId) @@ -390,40 +392,56 @@ function TableResultsIndividuals (props) { return ( <> {props.show !== 'full' && ( -
-
-
- {result[0].meta.beaconId} -

{result[0].response.organization.name}

-
- + <> {props.resultsPerDataset.map((element, index) => { return ( <> {element[0] === result[0].meta.beaconId && ( -
- - {openDatasetArray[index] === true && - triggerArray[index] === true && - element[2] === true && - props.show === 'boolean' &&
FOUND
} - {openDatasetArray[index] === true && - triggerArray[index] === true && - element[2] === false && - props.show === 'boolean' &&
NOT FOUND
} - {props.show === 'count' && - triggerArray[index] === true && ( -
{element[3]}
- )} +
+
+
+ {result[0].meta.beaconId} +

+ {result[0].response.organization.name} +

+
+ + {element[1].map((datasetObject, indexDataset) => { + return ( + +
+ + {openDatasetArray[indexDataset] === true && + triggerArray[indexDataset] === true && + element[2][indexDataset] === true && + props.show === 'boolean' &&
FOUND
} + {openDatasetArray[indexDataset] === true && + triggerArray[indexDataset] === true && + element[2][indexDataset] === false && + props.show === 'boolean' && ( +
NOT FOUND
+ )} + {props.show === 'count' && + triggerArray[index] === true && ( +
{element[3][indexDataset]}
+ )} +
+ ) + })} + + +
)} @@ -436,44 +454,93 @@ function TableResultsIndividuals (props) { {result[2] === true && props.show === 'boolean' && element[0] === result[0].meta.beaconId && ( -
- No datasets available -
FOUND
+
+
+
+ {result[0].meta.beaconId} +

+ {result[0].response.organization.name} +

+
+ +
+ No datasets available +
FOUND
+
+
)} {result[2] === false && props.show === 'boolean' && element[0] === result[0].meta.beaconId && ( -
- No datasets available -
NOT FOUND
+
+
+
+ {result[0].meta.beaconId} +

+ {result[0].response.organization.name} +

+
+
+ No datasets available +
NOT FOUND
+
+
)} + {props.show === 'count' && element[0] === result[0].meta.beaconId && ( -
- No datasets available -
- {result[1]} results -
+
+
+
+ {result[0].meta.beaconId} +

+ {result[0].response.organization.name} +

+
+
+ No datasets available +
+ {result[1]} results +
+
+ +
)} ) })} - - -
-
+ )} {props.show === 'full' && result[2] === true && (
diff --git a/frontend/src/config.json b/frontend/src/config.json index d994725..431d66c 100644 --- a/frontend/src/config.json +++ b/frontend/src/config.json @@ -1,5 +1,5 @@ { - "API_URL": "https://beacon-network-backend-test.ega-archive.org/beacon-network/v2.0.0", + "API_URL": "https://beacons.bsc.es/beacon-network/v2.0.0", "REDIRECT_URL": "http://localhost:3000/", "KEYCLOAK_URL": "https://beacon-network-demo2.ega-archive.org" } \ No newline at end of file