diff --git a/frontend/src/App.css b/frontend/src/App.css index da4f55d8..dd687da9 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -166,8 +166,8 @@ html { margin-top: -1px; } .searchIcon:hover { - width: 40px; - margin-top: -4px; + width: 37px; + margin-top: -3px; } .forwardIcon { @@ -955,7 +955,6 @@ h5 { display: flex; align-content: center; justify-content: center; - width: 70%; } .searchButton { diff --git a/frontend/src/components/GenomicVariations/VariantsResults.js b/frontend/src/components/GenomicVariations/VariantsResults.js index cb5297a7..c068d31c 100644 --- a/frontend/src/components/GenomicVariations/VariantsResults.js +++ b/frontend/src/components/GenomicVariations/VariantsResults.js @@ -10,7 +10,7 @@ import TableResultsVariant from '../Results/VariantResults/TableResultsVariant' function VariantsResults (props) { const [error, setError] = useState('') - + const [timeOut, setTimeOut] = useState(false) const [logInRequired, setLoginRequired] = useState(true) const [messageLogin, setMessageLogin] = useState('') const [results, setResults] = useState([]) @@ -22,6 +22,8 @@ function VariantsResults (props) { const [boolean, setBoolean] = useState(false) const [arrayFilter, setArrayFilter] = useState([]) + const [showVariantsResults, setShowVariantsResults] = useState(false) + let queryStringTerm = '' const handleTypeResults1 = () => { setShow1(true) @@ -49,11 +51,13 @@ function VariantsResults (props) { useEffect(() => { const apiCall = async () => { + if (isAuthenticated) { setLoginRequired(false) try { if (props.showBar === true) { + setShowVariantsResults(true) if (props.query.includes(',')) { queryStringTerm = props.query.split(',') @@ -89,15 +93,20 @@ function VariantsResults (props) { } } jsonData1 = JSON.stringify(jsonData1) - + console.log(jsonData1) // const token = auth.userData.access_token // console.log(token) //const headers = { 'Authorization': `Bearer ${token}` } // const res = await axios.post("https://beacons.bsc.es/beacon-network/v2.0.0/g_variants", jsonData1, {headers: headers}) + // const res = await axios.post( + // configData.API_URL + '/g_variants', + //jsonData1 + // ) const res = await axios.post( - configData.API_URL + '/g_variants', + 'https://beacon-apis-test.ega-archive.org/api/g_variants', jsonData1 ) + setTimeOut(true) console.log(res) if (res.data.responseSummary.exists === false) { setBoolean(false) @@ -105,9 +114,10 @@ function VariantsResults (props) { setError('No results found. Please retry') } } else { + setShowVariantsResults(false) // referenceName={referenceName} start={start} end={end} variantType={variantType} alternateBases={alternateBases} referenceBases={referenceBases} aminoacid={aminoacid} geneID={geneID} /> // - + var requestParameters = {} if (props.referenceName !== '') { @@ -217,6 +227,7 @@ function VariantsResults (props) { } } } catch (error) { + setTimeOut(true) console.log(error) setError(error) } @@ -226,51 +237,66 @@ function VariantsResults (props) { } } apiCall() - }, []) + }, [props.showBar]) return ( -
- {logInRequired === true && ( -
-

{messageLogin}

-
- )} - {logInRequired === false && ( -
-
-

Granularity:

- - - -
- - {show3 && error === '' && ( -
- +
+ {showVariantsResults === true && ( +
+ {logInRequired === true && ( +
+

{messageLogin}

+
+ )} + {timeOut === false && ( +
+
+
+
+
+
+
+
)} + {logInRequired === false && timeOut && ( +
+
+

Granularity:

+ + + +
+ + {show3 && error === '' && ( +
+ +
+ )} -
- {show1 && boolean &&

YES

} - {show1 && !boolean &&

NO

} - {show2 && numberResults !== 1 && ( -

{numberResults}   Results

- )} - {show2 && numberResults === 1 && ( -

{numberResults}   Result

- )} - {show3 && error !== '' && ( -
- Please check the query and retry -
- )} -
+
+ {show1 && boolean &&

YES

} + {show1 && !boolean &&

NO

} + {show2 && numberResults !== 1 && ( +

{numberResults}   Results

+ )} + {show2 && numberResults === 1 && ( +

{numberResults}   Result

+ )} + {show3 && error !== '' && ( +
+ Please check the query and retry +
+ )} +
+
+ )}
)}
diff --git a/frontend/src/components/Layout/Layout.js b/frontend/src/components/Layout/Layout.js index 8d6267cf..eaf56e38 100644 --- a/frontend/src/components/Layout/Layout.js +++ b/frontend/src/components/Layout/Layout.js @@ -60,6 +60,8 @@ function Layout (props) { const [showVariants, setShowVariants] = useState(false) + const [showResultsVariants, setShowResultsVariants] = useState(true) + const [trigger, setTrigger] = useState(false) const { storeToken, @@ -376,6 +378,7 @@ function Layout (props) { const handleClick = () => { setShowBar(!showBar) + setShowResultsVariants(false) } const handleHideVariantsForm = e => { @@ -1060,6 +1063,8 @@ function Layout (props) {