useJob
A hook for working with jobs.
Parameters
Name | Type | Optional | Description |
---|---|---|---|
entityId | string | True | The ID of the job entity present in DMSS |
jobId | string | True | The ID of the job |
Returns
No return value.
Usage
Code example:
import { useJob } from '@data-modelling-tool/core' const { start, status, fetchStatusAndLogs, remove, fetchResult, logs, isLoading, error, } = useJob('SomedataSource/iuni-1321-fsfr) if (isLoading) return <div>Loading...</div> if (error) { console.error(error) return <div>Error getting the document</div> } return (<div> <Chip>Status: {status}</Chip> <br /> <button onClick={() => start()}>Start job</button> <button onClick={() => remove()}>Remove job</button> <button onClick={() => fetchStatusAndLogs()}>Refresh status and logs</button> <button onClick={() => fetchResult().then((res: GetJobResultResponse) => setResult(res))} >Get results</button> <h4>Logs:</h4> <pre>{logs}</pre> <h4>Result:</h4> {result && <> <pre>{result.message}</pre> <pre>{result.result}</pre> </> }