Skip to content

Commit

Permalink
Import from top level types
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurickh committed Jan 25, 2020
1 parent 4799c34 commit 69c93cd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { retryAll } from './routes/retryAll'
import { retryJob } from './routes/retryJob'
import { cleanAll } from './routes/cleanAll'
import { entryPoint } from './routes/index'
import { BullBoardQueues } from './@types'
import { BullBoardQueues } from './@types/app'

const bullBoardQueues: BullBoardQueues = {}

Expand All @@ -34,7 +34,7 @@ router.put('/queues/:queueName/clean/:queueStatus', wrapAsync(cleanAll))

export const setQueues = (bullQueues: Queue[] | QueueMq[]) => {
bullQueues.forEach((queue: Queue | QueueMq) => {
const name = queue instanceof QueueMq ? queue.toKey('~') : queue.name // TODO: Figure out what 'type' to give `toKey`
const name = queue instanceof QueueMq ? queue.toKey('~') : queue.name

bullBoardQueues[name] = {
queue,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/cleanAll.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RequestHandler } from 'express'
import { Queue as QueueMq } from 'bullmq'

import { BullBoardQueues } from '../@types'
import { BullBoardQueues } from '../@types/app'

export const cleanAll: RequestHandler = async (req, res) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/retryJob.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RequestHandler } from 'express'
import { BullBoardQueues } from '../@types'
import { BullBoardQueues } from '../@types/app'

export const retryJob: RequestHandler = async (req, res) => {
try {
Expand Down
33 changes: 13 additions & 20 deletions src/ui/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ import { Queue as QueueElement } from './Queue'
import { RedisStats } from './RedisStats'
import { Header } from './Header'
import { useStore } from './hooks/useStore'
import { Job, JobCounts } from 'bull'
import { Job as JobMq } from 'bullmq'

interface Queueue {
name: string
counts: JobCounts
jobs: (Job | JobMq)[]
}

export const App = ({ basePath }: { basePath: string }) => {
const {
Expand All @@ -38,18 +30,19 @@ export const App = ({ basePath }: { basePath: string }) => {
<>No stats to display </>
)}

{state.data.queues.map((queue: Queueue) => (
<QueueElement
queue={queue}
key={queue.name}
selectedStatus={selectedStatuses[queue.name]}
selectStatus={setSelectedStatuses}
retryJob={retryJob(queue.name)}
retryAll={retryAll(queue.name)}
cleanAllDelayed={cleanAllDelayed(queue.name)}
cleanAllFailed={cleanAllFailed(queue.name)}
/>
))}
{state.data &&
state.data.queues.map(queue => (
<QueueElement
queue={queue}
key={queue.name}
selectedStatus={selectedStatuses[queue.name]}
selectStatus={setSelectedStatuses}
retryJob={retryJob(queue.name)}
retryAll={retryAll(queue.name)}
cleanAllDelayed={cleanAllDelayed(queue.name)}
cleanAllFailed={cleanAllFailed(queue.name)}
/>
))}
</>
)}
</main>
Expand Down

0 comments on commit 69c93cd

Please sign in to comment.