-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display failed job error message, if available
- Loading branch information
Showing
2 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
packages/libs/multi-blast/src/lib/components/BlastJobError.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
Error as ErrorPage, | ||
Link, | ||
Loading, | ||
} from '@veupathdb/wdk-client/lib/Components'; | ||
import { LongJobResponse } from '../utils/ServiceTypes'; | ||
import { useBlastApi } from '../hooks/api'; | ||
import { usePromise } from '@veupathdb/wdk-client/lib/Hooks/PromiseHook'; | ||
import Banner from '@veupathdb/coreui/lib/components/banners/Banner'; | ||
|
||
interface Props { | ||
job: LongJobResponse; | ||
} | ||
|
||
export function BlastJobError(props: Props) { | ||
const { job } = props; | ||
const blastApi = useBlastApi(); | ||
const jobErrorResult = usePromise(() => { | ||
return blastApi.fetchJobError(job.id); | ||
}, [blastApi, job]); | ||
|
||
if (jobErrorResult.loading) { | ||
return <Loading />; | ||
} | ||
|
||
return ( | ||
<ErrorPage> | ||
<div style={{ fontSize: 'larger' }}> | ||
{jobErrorResult.value && ( | ||
<Banner | ||
banner={{ | ||
type: 'error', | ||
message: jobErrorResult.value, | ||
}} | ||
/> | ||
)} | ||
<p> | ||
Your job did not run successfully. Please{' '} | ||
<Link | ||
target="_blank" | ||
to={{ | ||
pathname: '/contact-us', | ||
search: new URLSearchParams({ | ||
ctx: 'multi-blast job ' + job.id, | ||
}).toString(), | ||
}} | ||
> | ||
contact us | ||
</Link>{' '} | ||
for support. | ||
</p> | ||
</div> | ||
</ErrorPage> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters