diff --git a/.gitignore b/.gitignore index 9baf8f84..aec704e6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ static/ -yarn-error.log \ No newline at end of file +yarn-error.log +*.rdb \ No newline at end of file diff --git a/index.js b/index.js index a1b5c416..3a72eb79 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,7 @@ function UI() { router.get('/queues', require('./routes/queues')) router.put('/queues/:queueName/retry', require('./routes/retryAll')) router.put('/queues/:queueName/:id/retry', require('./routes/retryJob')) + router.put('/queues/:queueName/clean', require('./routes/cleanAll')) router.get('/', require('./routes/index')) app.use(bodyParser.json()) diff --git a/routes/cleanAll.js b/routes/cleanAll.js new file mode 100644 index 00000000..e69de29b diff --git a/ui/components/App.js b/ui/components/App.js index 0f6709cb..564abe69 100644 --- a/ui/components/App.js +++ b/ui/components/App.js @@ -11,6 +11,7 @@ export default function App({ basePath }) { setSelectedStatuses, retryJob, retryAll, + cleanAll, } = useStore(basePath) return ( @@ -30,6 +31,7 @@ export default function App({ basePath }) { selectStatus={setSelectedStatuses} retryJob={retryJob(queue.name)} retryAll={retryAll(queue.name)} + cleanAll={cleanAll(queue.name)} /> ))} diff --git a/ui/components/Queue.js b/ui/components/Queue.js index 25e165a7..36b7cf4c 100644 --- a/ui/components/Queue.js +++ b/ui/components/Queue.js @@ -251,6 +251,9 @@ const actions = { failed: ({ retryAll }) => { return }, + delayed: ({ cleanAll }) => { + return + }, } function QueueActions(props) { @@ -269,6 +272,7 @@ function QueueActions(props) { export default function Queue({ retryAll, retryJob, + cleanAll, queue, selectStatus, selectedStatus, @@ -291,6 +295,7 @@ export default function Queue({ <> diff --git a/ui/components/hooks/useStore.js b/ui/components/hooks/useStore.js index 71504834..15f6a356 100644 --- a/ui/components/hooks/useStore.js +++ b/ui/components/hooks/useStore.js @@ -54,5 +54,17 @@ export default function useStore(basePath) { update, ) - return { state, retryJob, retryAll, selectedStatuses, setSelectedStatuses } + const cleanAll = queueName => () => + fetch(`${basePath}/queues/${queueName}/clean`, { method: 'put' }).then( + update, + ) + + return { + state, + retryJob, + retryAll, + cleanAll, + selectedStatuses, + setSelectedStatuses, + } }