Skip to content

Commit

Permalink
✨ Added remove delayed job feature and fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hans-lizihan committed May 13, 2020
1 parent cd3b327 commit fad87a4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/pages/Job.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const Job = ({ match, history }) => {
Retry
</Button>
)}
{['failed', 'completed', 'waiting', 'paused'].includes(
{['delayed', 'failed', 'completed', 'waiting', 'paused'].includes(
status,
) && (
<Button
Expand Down
22 changes: 18 additions & 4 deletions client/pages/Queue.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { Fragment, useState } from 'react';
import PropTypes from 'prop-types';
import Grid from '@material-ui/core/Grid';
import { useResource } from 'react-request-hook';
Expand Down Expand Up @@ -121,7 +121,6 @@ const Queue = ({ match, history, location }) => {

const data = jobs.data?.data || [];

// TODO: move selected countrol outside
const handleSelectAllClick = event => {
if (event.target.checked) {
const newSelecteds = data.map(n => n.id);
Expand Down Expand Up @@ -175,6 +174,18 @@ const Queue = ({ match, history, location }) => {
.then(refreshTable);
};

const handleBulkRemove = () => {
client({
url: `/queues/${match.params.queueName}/removes`,
method: 'POST',
data: {
jobs: selected,
},
})
.then(() => setSelected([]))
.then(refreshTable);
};

const { name, counts } = queue.data || {};

return (
Expand All @@ -188,7 +199,7 @@ const Queue = ({ match, history, location }) => {
</Breadcrumbs>
<div>
<Button variant="outlined" onClick={pauseQueue}>
Puase Queue
Pause Queue
</Button>
<Button onClick={resumeQueue}>Resume Queue</Button>
<Button onClick={cleanQueue}>Clean Queue</Button>
Expand Down Expand Up @@ -289,7 +300,10 @@ const Queue = ({ match, history, location }) => {
bulkActions={
<div>
{status === 'delayed' && (
<Button onClick={handleBulkPromote}>Promote</Button>
<Fragment>
<Button onClick={handleBulkPromote}>Promote</Button>
<Button onClick={handleBulkRemove}>Remove</Button>
</Fragment>
)}
{status === 'failed' && (
<Button onClick={handleBulkRetry}>Retry</Button>
Expand Down

0 comments on commit fad87a4

Please sign in to comment.