serratus-bio / serratus.io

Front-end code for Serratus project website
https://serratus.io
GNU Affero General Public License v3.0
11 stars 11 forks source link

Serratus Analysis Index API calls and Link Buttons #133

Closed ababaian closed 3 years ago

ababaian commented 3 years ago

Line 5-17 in /src/components/Explorer/Base/Result/MatchingRuns/SerratusApiCalls.jsx

export const getAnalysisIndexUrl = (run_id) => {
    const params = {
        run_id: run_id,
    }
    params[run_id] = run_id
    return `${baseUrl}/index/run=${run_id}`
}
export const getAnalysisMicro = async (run_id) => {
    const AnalysisUrl = getAnalysisIndexUrl(run_id)
    const response = await axios.get({ AnalysisUrl })
    return response
}

To the LinkButton added this in src/common/LinkButton.jsx I added option to hide

    if (show) {
        return (
            <button className='bg-gray-200 hover:bg-gray-400 mx-2 py-1 px-4 rounded inline-flex items-center'>
                <a className='text-blue-500' {...aAttrs} href={link} download={download}>
                    {text}
                    {icon}
                </a>
            </button>
        )
    } else {
        return null
    }

I can't get a proper API return

    const microAvailable = getAnalysisMicro(run_id)

This does not show the data return from the API

            <div>{microAvailable.data}</div>