mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
state renaming
This commit is contained in:
parent
40f9170eb4
commit
e3b751ea8b
@ -68,7 +68,8 @@ export default function Compute({
|
|||||||
const newAbortController = useAbortController()
|
const newAbortController = useAbortController()
|
||||||
const newCancelToken = useCancelToken()
|
const newCancelToken = useCancelToken()
|
||||||
|
|
||||||
const [isJobStarting, setIsJobStarting] = useState(false)
|
const [isOrdering, setIsOrdering] = useState(false)
|
||||||
|
const [isOrdered, setIsOrdered] = useState(false)
|
||||||
const [error, setError] = useState<string>()
|
const [error, setError] = useState<string>()
|
||||||
|
|
||||||
const [algorithmList, setAlgorithmList] = useState<AssetSelectionAsset[]>()
|
const [algorithmList, setAlgorithmList] = useState<AssetSelectionAsset[]>()
|
||||||
@ -76,7 +77,6 @@ export default function Compute({
|
|||||||
const [selectedAlgorithmAsset, setSelectedAlgorithmAsset] =
|
const [selectedAlgorithmAsset, setSelectedAlgorithmAsset] =
|
||||||
useState<AssetExtended>()
|
useState<AssetExtended>()
|
||||||
const [hasAlgoAssetDatatoken, setHasAlgoAssetDatatoken] = useState<boolean>()
|
const [hasAlgoAssetDatatoken, setHasAlgoAssetDatatoken] = useState<boolean>()
|
||||||
const [isPublished, setIsPublished] = useState(false)
|
|
||||||
const [algorithmDTBalance, setAlgorithmDTBalance] = useState<string>()
|
const [algorithmDTBalance, setAlgorithmDTBalance] = useState<string>()
|
||||||
|
|
||||||
const [validOrderTx, setValidOrderTx] = useState('')
|
const [validOrderTx, setValidOrderTx] = useState('')
|
||||||
@ -99,7 +99,7 @@ export default function Compute({
|
|||||||
|
|
||||||
const hasDatatoken = Number(dtBalance) >= 1
|
const hasDatatoken = Number(dtBalance) >= 1
|
||||||
const isComputeButtonDisabled =
|
const isComputeButtonDisabled =
|
||||||
isJobStarting === true ||
|
isOrdering === true ||
|
||||||
file === null ||
|
file === null ||
|
||||||
(!validOrderTx && !hasDatatoken && !isConsumablePrice) ||
|
(!validOrderTx && !hasDatatoken && !isConsumablePrice) ||
|
||||||
(!validAlgorithmOrderTx && !hasAlgoAssetDatatoken)
|
(!validAlgorithmOrderTx && !hasAlgoAssetDatatoken)
|
||||||
@ -291,8 +291,8 @@ export default function Compute({
|
|||||||
|
|
||||||
async function startJob(): Promise<string> {
|
async function startJob(): Promise<string> {
|
||||||
try {
|
try {
|
||||||
setIsJobStarting(true)
|
setIsOrdering(true)
|
||||||
setIsPublished(false) // would be nice to rename this
|
setIsOrdered(false) // would be nice to rename this
|
||||||
setError(undefined)
|
setError(undefined)
|
||||||
const computeService = getServiceByName(asset, 'compute')
|
const computeService = getServiceByName(asset, 'compute')
|
||||||
const computeAlgorithm: ComputeAlgorithm = {
|
const computeAlgorithm: ComputeAlgorithm = {
|
||||||
@ -400,14 +400,14 @@ export default function Compute({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
LoggerInstance.log('[compute] Starting compute job response: ', response)
|
LoggerInstance.log('[compute] Starting compute job response: ', response)
|
||||||
setIsPublished(true)
|
setIsOrdered(true)
|
||||||
setRefetchJobs(!refetchJobs)
|
setRefetchJobs(!refetchJobs)
|
||||||
initPriceAndFees()
|
initPriceAndFees()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setError('Failed to start job!')
|
setError('Failed to start job!')
|
||||||
LoggerInstance.error('[compute] Failed to start job: ', error.message)
|
LoggerInstance.error('[compute] Failed to start job: ', error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsJobStarting(false)
|
setIsOrdering(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ export default function Compute({
|
|||||||
ddoListAlgorithms={ddoAlgorithmList}
|
ddoListAlgorithms={ddoAlgorithmList}
|
||||||
selectedAlgorithmAsset={selectedAlgorithmAsset}
|
selectedAlgorithmAsset={selectedAlgorithmAsset}
|
||||||
setSelectedAlgorithm={setSelectedAlgorithmAsset}
|
setSelectedAlgorithm={setSelectedAlgorithmAsset}
|
||||||
isLoading={isJobStarting || isRequestingAlgoOrderPrice}
|
isLoading={isOrdering || isRequestingAlgoOrderPrice}
|
||||||
isComputeButtonDisabled={isComputeButtonDisabled}
|
isComputeButtonDisabled={isComputeButtonDisabled}
|
||||||
hasPreviousOrder={validOrderTx !== undefined}
|
hasPreviousOrder={validOrderTx !== undefined}
|
||||||
hasDatatoken={hasDatatoken}
|
hasDatatoken={hasDatatoken}
|
||||||
@ -482,7 +482,7 @@ export default function Compute({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<footer className={styles.feedback}>
|
<footer className={styles.feedback}>
|
||||||
{isPublished && (
|
{isOrdered && (
|
||||||
<SuccessConfetti success="Your job started successfully! Watch the progress below or on your profile." />
|
<SuccessConfetti success="Your job started successfully! Watch the progress below or on your profile." />
|
||||||
)}
|
)}
|
||||||
</footer>
|
</footer>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user