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:
parent
bc6af3a839
commit
5b415e615c
@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
ComputeResultType,
|
||||||
downloadFileBrowser,
|
downloadFileBrowser,
|
||||||
LoggerInstance,
|
LoggerInstance,
|
||||||
Provider
|
Provider
|
||||||
@ -21,6 +22,28 @@ export default function Results({
|
|||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const isFinished = job.dateFinished !== null
|
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) {
|
async function downloadResults(resultIndex: number) {
|
||||||
if (!accountId || !job) return
|
if (!accountId || !job) return
|
||||||
|
|
||||||
@ -56,7 +79,7 @@ export default function Results({
|
|||||||
onClick={() => downloadResults(i)}
|
onClick={() => downloadResults(i)}
|
||||||
disabled={isLoading || !isFinished}
|
disabled={isLoading || !isFinished}
|
||||||
>
|
>
|
||||||
{`Download ${jobResult.filename}`}
|
{getDownloadButtonValue(jobResult.type)}
|
||||||
</Button>
|
</Button>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user