-
-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
163 additions
and
52 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,28 @@ | ||
import { Request, RequestHandler, Response } from 'express-serve-static-core' | ||
import { BullBoardQueues } from '../@types/app' | ||
|
||
export const jobLogs: RequestHandler = async (req: Request, res: Response) => { | ||
const { bullBoardQueues } = req.app.locals as { | ||
bullBoardQueues: BullBoardQueues | ||
} | ||
const { queueName, id } = req.params | ||
const { queue } = bullBoardQueues[queueName] | ||
|
||
if (!queue) { | ||
return res.status(404).send({ | ||
error: 'Queue not found', | ||
}) | ||
} | ||
|
||
const job = await queue.getJob(id) | ||
|
||
if (!job) { | ||
return res.status(404).send({ | ||
error: 'Job not found', | ||
}) | ||
} | ||
|
||
const logs = await queue.getJobLogs(id) | ||
|
||
return res.json(logs) | ||
} |
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 |
---|---|---|
|
@@ -74,6 +74,7 @@ | |
|
||
.tabContent > div { | ||
overflow: auto; | ||
padding-bottom: 2rem; | ||
height: 100%; | ||
} | ||
|
||
|
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
48 changes: 48 additions & 0 deletions
48
src/ui/components/JobCard/Details/DetailsContent/DetailsContent.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,48 @@ | ||
import React from 'react' | ||
import { AppJob } from '../../../../../@types/app' | ||
import { TabsType } from '../../../../hooks/useDetailsTabs' | ||
import { Highlight } from '../../../Highlight/Highlight' | ||
import { JobLogs } from './JobLogs/JobLogs' | ||
|
||
interface DetailsContentProps { | ||
job: AppJob | ||
selectedTab: TabsType | ||
actions: { | ||
getJobLogs: () => Promise<string[]> | ||
} | ||
} | ||
|
||
export const DetailsContent = ({ | ||
selectedTab, | ||
job: { stacktrace, data, returnValue, opts, failedReason }, | ||
actions, | ||
}: DetailsContentProps) => { | ||
switch (selectedTab) { | ||
case 'Data': | ||
return ( | ||
<Highlight language="json"> | ||
{JSON.stringify({ data, returnValue }, null, 2)} | ||
</Highlight> | ||
) | ||
case 'Options': | ||
return ( | ||
<Highlight language="json">{JSON.stringify(opts, null, 2)}</Highlight> | ||
) | ||
case 'Error': | ||
return ( | ||
<> | ||
{stacktrace.length === 0 ? ( | ||
<div className="error">{!!failedReason ? failedReason : 'NA'}</div> | ||
) : ( | ||
<Highlight language="stacktrace" key="stacktrace"> | ||
{stacktrace} | ||
</Highlight> | ||
)} | ||
</> | ||
) | ||
case 'Logs': | ||
return <JobLogs actions={actions} /> | ||
default: | ||
return null | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
src/ui/components/JobCard/Details/DetailsContent/JobLogs/JobLogs.module.css
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,3 @@ | ||
.jobLogs { | ||
margin: 0; | ||
} |
28 changes: 28 additions & 0 deletions
28
src/ui/components/JobCard/Details/DetailsContent/JobLogs/JobLogs.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,28 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import s from './JobLogs.module.css' | ||
|
||
interface JobLogsProps { | ||
actions: { | ||
getJobLogs: () => Promise<string[]> | ||
} | ||
} | ||
|
||
export const JobLogs = ({ actions }: JobLogsProps) => { | ||
const [logs, setLogs] = useState<string[]>([]) | ||
|
||
useEffect(() => { | ||
actions.getJobLogs().then((logs) => setLogs(logs)) | ||
}, []) | ||
|
||
if (!Array.isArray(logs) || !logs.length) { | ||
return null | ||
} | ||
|
||
return ( | ||
<ul className={s.jobLogs}> | ||
{logs.map((log, idx) => ( | ||
<li key={idx}>{log}</li> | ||
))} | ||
</ul> | ||
) | ||
} |
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
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
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
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
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