Skip to content

Commit

Permalink
Merge pull request #32 from elixir-europe/elixir-bsc
Browse files Browse the repository at this point in the history
Elixir bsc
  • Loading branch information
Gemma Milla authored Dec 27, 2023
2 parents 8079665 + a588cd8 commit 00df030
Show file tree
Hide file tree
Showing 9 changed files with 531 additions and 207 deletions.
1 change: 0 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ COPY yarn.lock .
COPY public ./public
COPY src ./src


RUN yarn install --production


40 changes: 32 additions & 8 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,8 @@ html {
font-variant-caps: all-petite-caps;
}

.modeVariants:hover {
color: white;
background-color: #e3eefe;
padding-left: 5px;
padding-right: 5px;
border-radius: 3px;
margin-left: 10px;
.modeVariants:hover h2{
color: rgb(236, 149, 0)!important;
}

.variantsFilters {
Expand Down Expand Up @@ -377,7 +372,7 @@ html {

.buttonVariants:hover {
margin-top: 12px;
margin-right: -9px;
margin-right: -2px;
margin-bottom: 20px;
font-weight: 600;
color: rgb(118, 151, 228);
Expand Down Expand Up @@ -1012,6 +1007,35 @@ h5 {
text-underline-offset: 1px;
}

.inputVariants {
height: 18px;
border: 1.5px solid #dfdfdf;
border-radius: 2px;
margin-bottom: 30px;
font-size: 12px;
}

.labelVariants {
font-size: 11.5px;
margin-bottom: 18px;
margin-right: 4px;
margin-left: 18px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto',
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
'Helvetica Neue', sans-serif;
}

.buttonVariants {
margin-top: 12px;
margin-bottom: 20px;
box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 1px,
rgba(179, 179, 179, 0.22) 0px 1px 1px;
padding: 5px;
cursor: pointer;
font-size: 12px;
margin-right: 7px;
}

.switchDescendants h3 {
color: #e16e00;
text-transform: uppercase;
Expand Down
12 changes: 10 additions & 2 deletions frontend/src/components/Datasets/ResultsDatasets.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
overflow-y: scroll;
}

.seeResultsContainer{
.seeResultsContainer {
height: 100%;
display: flex;
align-items: center;
Expand Down Expand Up @@ -193,7 +193,7 @@
background: #c8d4e6;
}

.tittle4{
.tittle4 {
display: flex;
flex-direction: row;
justify-content: center;
Expand Down Expand Up @@ -231,6 +231,14 @@
width: 100vw;
}

.datasetCard p {
font-size: 11px;
font-weight: normal;
color: rgb(61 60 60);
line-height: 18px;
margin-top: -5px;
}

.datasetCardResults {
/* width: 20vw; */
height: 247px;
Expand Down
197 changes: 117 additions & 80 deletions frontend/src/components/GenomicVariations/VariantsResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ function VariantsResults (props) {

const { getStoredToken, authenticateUser } = useContext(AuthContext)

const [resultsPerDataset, setResultsDataset] = useState([])
const [resultsNotPerDataset, setResultsNotPerDataset] = useState([])

let queryStringTerm = ''
const handleTypeResults1 = () => {
setShow1(true)
Expand Down Expand Up @@ -64,15 +67,6 @@ function VariantsResults (props) {
}
}

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

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

Expand Down Expand Up @@ -118,39 +112,51 @@ function VariantsResults (props) {
}
jsonData1 = JSON.stringify(jsonData1)

const token = auth.userData.access_token
let token = null
if (auth.userData === null) {
token = getStoredToken()
} else {
token = auth.userData.access_token
}

if (token === null) {
res = await axios.post(
configData.API_URL + '/g_variants',
jsonData1
)
} else {
const headers = { Authorization: `Bearer ${token}` }

const headers = { Authorization: `Bearer ${token}` }
res = await axios.post(
configData.API_URL + '/g_variants',
jsonData1,
{ headers: headers }
)
}

const res = await axios.post(
configData.API_URL + '/g_variants',
jsonData1,
{ headers: headers }
)
//const res = await axios.post(
//configData.API_URL + '/g_variants',
//jsonData1
//)
setTimeOut(true)

if (res.data.responseSummary.exists === false) {
setBoolean(false)
if (res.data.responseSummary.numTotalResults < 1) {
setError('No results. Please check the query and retry')
setNumberResults(0)
setError('No results found. Please retry')
setBoolean(false)
} else {
res.data.response.resultSets.forEach((element, index) => {
res.data.response.resultSets[index].results.forEach(
(element2, index2) => {
let arrayResult = [
res.data.response.resultSets[index].id,
res.data.response.resultSets[index].results[index2]
]
results.push(arrayResult)
}
)
if (res.data.response.resultSets[index].resultsCount > 0) {
res.data.response.resultSets[index].results.forEach(
(element2, index2) => {
let arrayResult = [
res.data.response.resultSets[index].beaconId,
res.data.response.resultSets[index].results[index2]
]
results.push(arrayResult)
}
)
}
})
setBoolean(res.data.responseSummary.exists)

setNumberResults(res.data.responseSummary.numTotalResults)
setBoolean(res.data.responseSummary.exists)
}
} else {
setShowVariantsResults(true)
Expand Down Expand Up @@ -230,15 +236,28 @@ function VariantsResults (props) {
}
jsonData1 = JSON.stringify(jsonData1)

const token = auth.userData.access_token

const headers = { Authorization: `Bearer ${token}` }
const res = await axios.post(
configData.API_URL + '/g_variants',
jsonData1,
{ 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 + '/g_variants',
jsonData1
)
} else {
const headers = { Authorization: `Bearer ${token}` }
res = await axios.post(
configData.API_URL + '/g_variants',
jsonData1,
{ headers: headers }
)
}

setTimeOut(true)
if (
res.data.responseSummary.numTotalResults < 1 ||
Expand All @@ -248,26 +267,32 @@ function VariantsResults (props) {
setNumberResults(0)
setBoolean(false)
} else {

props.setHideForm(true)
setNumberResults(res.data.responseSummary.numTotalResults)
setBoolean(res.data.responseSummary.exists)


res.data.response.resultSets.forEach((element, index) => {
if (element.id && element.id !== '') {
let arrayResultsPerDataset = [
element.beaconId,
element.id,
element.exists,
element.resultsCount
]
resultsPerDataset.push(arrayResultsPerDataset)
}

if (element.id === undefined || element.id === '') {
let arrayResultsNoDatasets = [element.beaconId]
resultsNotPerDataset.push(arrayResultsNoDatasets)
}

if (res.data.response.resultSets[index].results) {
if (res.data.response.resultSets[index].results.length === 0) {
} else {
res.data.response.resultSets[index].results.forEach(
(element2, index2) => {
let arrayResult = [
res.data.response.resultSets[index].beaconId,
res.data.response.resultSets[index].results[index2]
]
results.push(arrayResult)
}
)
}
res.data.response.resultSets[index].results.forEach(
(element2, index2) => {
let arrayResult = [
res.data.response.resultSets[index].beaconId,
res.data.response.resultSets[index].results[index2]
]
results.push(arrayResult)
}
)
}
})
}
Expand Down Expand Up @@ -296,7 +321,7 @@ function VariantsResults (props) {
</div>
</div>
)}
{timeOut && (
{timeOut && error !== 'Connection error. Please retry' && (
<div>
<div className='selectGranularity'>
<h4>Granularity:</h4>
Expand All @@ -311,35 +336,47 @@ function VariantsResults (props) {
</button>
</div>

{show3 && logInRequired === false && error === '' && (
{timeOut && error === 'Connection error. Please retry' && (
<h3>&nbsp; {error} </h3>
)}
{show3 && logInRequired === false && !error && (
<div>
<TableResultsVariant
show={'full'}
results={results}
resultsPerDataset={resultsPerDataset}
beaconsList={beaconsList}
></TableResultsVariant>
</div>
)}
{show3 && logInRequired === true && (
<h3>{messageLoginFullResp}</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 && logInRequired === false && numberResults === 1 && (
<p className='p1'>{numberResults} &nbsp; Result</p>
)}
{show2 && logInRequired === true && (
<h3>{messageLoginCount}</h3>
)}
{show3 && error !== '' && (
<h5 className='variantsResultsError'>
Please check the query and retry
</h5>
)}
</div>
{show3 && error && <h3>&nbsp; {error} </h3>}

{show2 && (
<div>
<TableResultsVariant
show={'count'}
resultsPerDataset={resultsPerDataset}
resultsNotPerDataset={resultsNotPerDataset}
results={results}
beaconsList={beaconsList}
></TableResultsVariant>
</div>
)}

{show1 && (
<div className='containerTableResults'>
<TableResultsVariant
show={'boolean'}
resultsPerDataset={resultsPerDataset}
resultsNotPerDataset={resultsNotPerDataset}
results={results}
beaconsList={beaconsList}
></TableResultsVariant>
</div>
)}
</div>
)}
</div>
Expand Down
Loading

0 comments on commit 00df030

Please sign in to comment.