Skip to content

Commit

Permalink
biosamples
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemma committed Dec 7, 2023
1 parent 8a7bfd0 commit 406148a
Show file tree
Hide file tree
Showing 10 changed files with 291 additions and 226 deletions.
13 changes: 8 additions & 5 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


html {
margin: 0px !important;
height: 100vh;
Expand Down Expand Up @@ -281,7 +279,11 @@ html {

.spanQE {
display: block;
padding: 14px 15px;
padding: 8px 4px;
font-size: 12px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;

}

.btn-3::before,
Expand Down Expand Up @@ -628,7 +630,8 @@ hr {

.bulbLogo {
height: 16px;
margin-right: 10px;
margin-right: 11px;
margin-left: 4px;
}

.arrowLogo {
Expand Down Expand Up @@ -681,7 +684,7 @@ hr {
.example {
display: flex;
align-items: center;
margin-right: -114px;
margin-right: -106px;
margin-top: 22px;
margin-bottom: 22px;
flex-direction: row-reverse;
Expand Down
94 changes: 61 additions & 33 deletions frontend/src/components/Biosamples/BiosamplesResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ function BiosamplesResults (props) {
}
}

if (isAuthenticated) {
setLoginRequired(false)
} else {
setLoginRequired(true)
setMessageLoginCount('PLEASE LOG IN FOR GETTING THE NUMBER OF RESULTS')
setMessageLoginFullResp('PLEASE LOG IN FOR GETTING THE FULL RESPONSE')
}

if (props.query !== null) {
if (props.query.includes(',')) {
queryStringTerm = props.query.split(',')
Expand Down Expand Up @@ -157,7 +149,7 @@ function BiosamplesResults (props) {
beaconsList.reverse()

if (props.query === null) {
// show all individuals
// show all biosamples

var jsonData1 = {
meta: {
Expand All @@ -177,15 +169,27 @@ function BiosamplesResults (props) {
jsonData1 = JSON.stringify(jsonData1)
console.log(jsonData1)

const token = auth.userData.access_token
let token = null
if (auth.userData === null) {
token = getStoredToken()
} else {
token = auth.userData.access_token
}
console.log(token)
const headers = { Authorization: `Bearer ${token}` }
if (token === null) {
res = await axios.post(
configData.API_URL + '/biosamples',
jsonData1
)
} else {
const headers = { Authorization: `Bearer ${token}` }

res = await axios.post(
configData.API_URL + '/biosamples',
jsonData1,
{ headers: headers }
)
res = await axios.post(
configData.API_URL + '/biosamples',
jsonData1,
{ headers: headers }
)
}

console.log(res)
setTimeOut(true)
Expand Down Expand Up @@ -232,12 +236,29 @@ function BiosamplesResults (props) {
jsonData2 = JSON.stringify(jsonData2)
console.log(jsonData2)

const token = auth.userData.access_token
console.log(token)
const headers = { Authorization: `Bearer ${token}` }

res = await axios.post(configData.API_URL + '/biosamples', jsonData2, {headers: headers})
let token = null
if (auth.userData === null) {
token = getStoredToken()
} else {
token = auth.userData.access_token
}

if (token === null) {
console.log('Querying without token')
res = await axios.post(
configData.API_URL + '/biosamples',
jsonData2
)
} else {
console.log('Querying WITH token')
const headers = { Authorization: `Bearer ${token}` }

res = await axios.post(
configData.API_URL + '/biosamples',
jsonData2,
{ headers: headers }
)
}
console.log(res)
setTimeOut(true)

Expand Down Expand Up @@ -348,25 +369,32 @@ function BiosamplesResults (props) {
{show3 && logInRequired === false && !error && (
<div>
<TableResultsBiosamples
show={'full'}
results={results}
beaconsList={beaconsList}
></TableResultsBiosamples>
</div>
)}
{show3 && logInRequired === true && <h3>{messageLoginFullResp}</h3>}
{show3 && error && <h3>&nbsp; {error} </h3>}
<div className='resultsContainer'>
{show1 && boolean && <p className='p1'>YES</p>}
{show1 && !boolean && <p className='p1'>NO</p>}

{show2 && logInRequired === false && numberResults !== 1 && (
<p className='p1'>{numberResults} &nbsp; Results</p>
)}
{show2 && numberResults === 1 && logInRequired === false && (
<p className='p1'>{numberResults} &nbsp; Result</p>
)}
{show2 && logInRequired === true && <h3>{messageLoginCount}</h3>}
</div>
{show2 && (
<div>
<TableResultsBiosamples
show={'count'}
results={results}
beaconsList={beaconsList}
></TableResultsBiosamples>
</div>
)}
{show1 && (
<div>
<TableResultsBiosamples
show={'boolean'}
results={results}
beaconsList={beaconsList}
></TableResultsBiosamples>
</div>
)}
</div>
</div>
</div>
Expand Down
48 changes: 31 additions & 17 deletions frontend/src/components/Datasets/ResultsDatasets.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@
}

.datasetCardResults {
width: 20vw;
margin: 11px;
/* width: 20vw; */
height: 207px;
margin: 54px;
/* border: 2px solid #3b9ad5; */
padding: 3px;
display: flex;
box-shadow: 1 (0, 0, 0, -0.75) 0px 1px 0px, rgba(1, 1, 2, 12) 0px 1 3px;
box-shadow: 18 (0, 0, 0, -0.75) 0px 1px 0px, rgba(1, 1, 2, 12);
align-items: center;
align-content: center;
flex-direction: column;
background-color: #ebebeb;
justify-content: flex-start;
border-radius: 2px;
background-color:#495782;
justify-content: center;
border-radius: 8px;
}

.tittle h2 {
Expand Down Expand Up @@ -125,38 +126,50 @@
}

.tittleResults {
width: 20vw;
width: 34vw;
background: white;
border-radius: 2px;
/* height: 80px; */
height: 167px;
display: flex;
padding: 2px;
flex-direction: column;
}

.buttonResults {
margin-top: 29px;
/* width: 100%; */
/* display: flex; */
/* align-items: center; */
/* justify-content: center; */
}

.tittle h2 {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
color: rgba(12, 16, 64, 0.606);
font-size: 12px;
font-weight: 600;

}

.tittleResults h2 {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
height: 46px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
color: rgba(12, 16, 64, 0.606);
font-size: 12px;
font-weight: 600;
background: #c8d4e6;
padding: 9px;
margin: 0px;
}

.tittle2 {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background: #c8d4e6;
}

.resultsRecord h3 {
Expand Down Expand Up @@ -187,18 +200,19 @@
}

.datasetCardResults {
width: 100vw;
margin: 11px;
/* width: 20vw; */
height: 207px;
margin: 54px;
/* border: 2px solid #3b9ad5; */
padding: 3px;
display: flex;
box-shadow: 1 (0, 0, 0, -0.75) 0px 1px 0px, rgba(1, 1, 2, 12) 0px 1 3px;
box-shadow: 18 (0, 0, 0, -0.75) 0px 1px 0px, rgba(1, 1, 2, 12);
align-items: center;
align-content: center;
flex-direction: column;
background-color: #ebebeb;
justify-content: flex-start;
border-radius: 2px;
background-color: #495782;
justify-content: center;
border-radius: 8px;
}

.datasetCard {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/FilteringTerms/FilteringTerms.css
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ thead {

.select-checkbox {
cursor: pointer;
margin-right: 7px;
}

.searchTermInput {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/Individuals/Individuals.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,14 @@ h4 {
.resultsContainer {
display: flex;
justify-content: center;
margin-top: 54px;
}

.selectGranularity {
align-items: center;
display: flex;
justify-content: center;
margin-top: 23px;
}

.loader2 {
Expand Down
45 changes: 26 additions & 19 deletions frontend/src/components/Individuals/IndividualsResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ function IndividualsResults (props) {
}

//if (isAuthenticated) {
//setLoginRequired(false)
//setLoginRequired(false)
//} else {
//setLoginRequired(true)
//setMessageLoginCount('PLEASE LOG IN FOR GETTING THE NUMBER OF RESULTS')
//setMessageLoginFullResp('PLEASE LOG IN FOR GETTING THE FULL RESPONSE')
//setLoginRequired(true)
//setMessageLoginCount('PLEASE LOG IN FOR GETTING THE NUMBER OF RESULTS')
//setMessageLoginFullResp('PLEASE LOG IN FOR GETTING THE FULL RESPONSE')
//}

if (props.query !== null) {
Expand Down Expand Up @@ -152,7 +152,7 @@ function IndividualsResults (props) {

try {
let res = await axios.get(configData.API_URL + '/info')

res.data.responses.forEach(element => {
beaconsList.push(element)
})
Expand Down Expand Up @@ -256,13 +256,13 @@ function IndividualsResults (props) {
}

if (token === null) {
console.log("Querying without token")
console.log('Querying without token')
res = await axios.post(
configData.API_URL + '/individuals',
jsonData2
)
} else {
console.log("Querying WITH token")
console.log('Querying WITH token')
const headers = { Authorization: `Bearer ${token}` }

res = await axios.post(
Expand Down Expand Up @@ -381,25 +381,32 @@ function IndividualsResults (props) {
{show3 && logInRequired === false && !error && (
<div>
<TableResultsIndividuals
show={'full'}
results={results}
beaconsList={beaconsList}
></TableResultsIndividuals>
</div>
)}
{show3 && logInRequired === true && <h3>{messageLoginFullResp}</h3>}
{show3 && error && <h3>&nbsp; {error} </h3>}
<div className='resultsContainer'>
{show1 && boolean && <p className='p1'>YES</p>}
{show1 && !boolean && <p className='p1'>NO</p>}

{show2 && logInRequired === false && numberResults !== 1 && (
<p className='p1'>{numberResults} &nbsp; Results</p>
)}
{show2 && numberResults === 1 && logInRequired === false && (
<p className='p1'>{numberResults} &nbsp; Result</p>
)}
{show2 && logInRequired === true && <h3>{messageLoginCount}</h3>}
</div>
{show2 && (
<div>
<TableResultsIndividuals
show={'count'}
results={results}
beaconsList={beaconsList}
></TableResultsIndividuals>
</div>
)}
{show1 && (
<div>
<TableResultsIndividuals
show={'boolean'}
results={results}
beaconsList={beaconsList}
></TableResultsIndividuals>
</div>
)}
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 406148a

Please sign in to comment.