1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

update download buttons text

This commit is contained in:
Bogdan Fazakas 2022-04-14 12:38:13 +03:00
parent bc6af3a839
commit 5b415e615c

View File

@ -1,4 +1,5 @@
import {
ComputeResultType,
downloadFileBrowser,
LoggerInstance,
Provider
@ -21,6 +22,28 @@ export default function Results({
const [isLoading, setIsLoading] = useState(false)
const isFinished = job.dateFinished !== null
function getDownloadButtonValue(type: ComputeResultType): String {
let buttonName
switch (type) {
case 'output':
buttonName = 'Download results'
break
case 'algorithmLog':
buttonName = 'Download algorithm logs'
break
case 'configrationLog':
buttonName = 'Download configuration logs'
break
case 'publishLog':
buttonName = 'Download publish logs'
break
default:
buttonName = 'Download results'
break
}
return buttonName
}
async function downloadResults(resultIndex: number) {
if (!accountId || !job) return
@ -56,7 +79,7 @@ export default function Results({
onClick={() => downloadResults(i)}
disabled={isLoading || !isFinished}
>
{`Download ${jobResult.filename}`}
{getDownloadButtonValue(jobResult.type)}
</Button>
</ListItem>
) : (