mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
small refactor
This commit is contained in:
parent
7d09350967
commit
2884015678
@ -14,14 +14,14 @@ interface JobsProps {
|
||||
ddo: DDO
|
||||
}
|
||||
|
||||
export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
const rawAlgorithmMeta = {
|
||||
const rawAlgorithmMeta = {
|
||||
rawcode: `console.log('Hello world'!)`,
|
||||
format: 'docker-image',
|
||||
version: '0.1',
|
||||
container: {}
|
||||
}
|
||||
}
|
||||
|
||||
export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
const [isJobStarting, setIsJobStarting] = useState(false)
|
||||
const [step, setStep] = useState(99)
|
||||
const [error, setError] = useState('')
|
||||
@ -37,6 +37,7 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
const fileText = await readFileContent(files[0])
|
||||
setAlgorithmRawCode(fileText)
|
||||
}
|
||||
|
||||
const handleSelectChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
const comType = event.target.value
|
||||
setComputeType(comType)
|
||||
@ -83,14 +84,12 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
setFile(null)
|
||||
} catch (error) {
|
||||
setError('Failed to start job!')
|
||||
console.log(error)
|
||||
console.error(error)
|
||||
}
|
||||
setIsJobStarting(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<div>
|
||||
<span className={styles.bold}>New job</span>
|
||||
<div className={styles.dataType}>
|
||||
@ -118,13 +117,8 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
</div>
|
||||
)}
|
||||
{file !== null && (
|
||||
<div
|
||||
className={
|
||||
styles.filleddragndrop
|
||||
}
|
||||
>
|
||||
You selected:{' '}
|
||||
{(file as any).path}
|
||||
<div className={styles.filleddragndrop}>
|
||||
You selected: {(file as any).path}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@ -136,9 +130,7 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
primary
|
||||
onClick={() => startJob()}
|
||||
disabled={
|
||||
isJobStarting ||
|
||||
file === null ||
|
||||
computeType === ''
|
||||
isJobStarting || file === null || computeType === ''
|
||||
}
|
||||
name="Purchase access"
|
||||
>
|
||||
@ -147,9 +139,7 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
</div>
|
||||
</div>
|
||||
{isJobStarting ? <Spinner message={messages[step]} /> : ''}
|
||||
{error !== '' && (
|
||||
<div className={styles.error}>{error}</div>
|
||||
)}
|
||||
{error !== '' && <div className={styles.error}>{error}</div>}
|
||||
{isPublished ? (
|
||||
<div className={styles.success}>
|
||||
<p>Your job started!</p>
|
||||
@ -161,7 +151,5 @@ export default function AssetsJobs({ ddo, ocean }: JobsProps) {
|
||||
''
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user