-
-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pause / resume on queue level, closes #214
- Loading branch information
Showing
26 changed files
with
377 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { BullBoardRequest, ControllerHandlerReturnType } from '../../typings/app'; | ||
import { queueProvider } from '../providers/queue'; | ||
import { BaseAdapter } from '../queueAdapters/base'; | ||
|
||
async function pauseQueue( | ||
_req: BullBoardRequest, | ||
queue: BaseAdapter | ||
): Promise<ControllerHandlerReturnType> { | ||
await queue.pause(); | ||
|
||
return { status: 200, body: {} }; | ||
} | ||
|
||
export const pauseQueueHandler = queueProvider(pauseQueue); |
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,14 @@ | ||
import { BullBoardRequest, ControllerHandlerReturnType } from '../../typings/app'; | ||
import { queueProvider } from '../providers/queue'; | ||
import { BaseAdapter } from '../queueAdapters/base'; | ||
|
||
async function resumeQueue( | ||
_req: BullBoardRequest, | ||
queue: BaseAdapter | ||
): Promise<ControllerHandlerReturnType> { | ||
await queue.resume(); | ||
|
||
return { status: 200, body: {} }; | ||
} | ||
|
||
export const resumeQueueHandler = queueProvider(resumeQueue); |
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
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,11 @@ | ||
import React from 'react'; | ||
|
||
export const EllipsisVerticalIcon = () => ( | ||
<svg aria-hidden="true" role="img" | ||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512" | ||
> | ||
<path | ||
d="M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z" | ||
></path> | ||
</svg> | ||
); |
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,10 @@ | ||
import React from 'react'; | ||
|
||
export const PauseIcon = () => ( | ||
<svg aria-hidden="true" focusable="false" role="img" | ||
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"> | ||
<path | ||
d="M144 479H48c-26.5 0-48-21.5-48-48V79c0-26.5 21.5-48 48-48h96c26.5 0 48 21.5 48 48v352c0 26.5-21.5 48-48 48zm304-48V79c0-26.5-21.5-48-48-48h-96c-26.5 0-48 21.5-48 48v352c0 26.5 21.5 48 48 48h96c26.5 0 48-21.5 48-48z" | ||
></path> | ||
</svg> | ||
); |
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,10 @@ | ||
import React from 'react'; | ||
|
||
export const PlayIcon = () => ( | ||
<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" | ||
viewBox="0 0 448 512"> | ||
<path | ||
d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z" | ||
></path> | ||
</svg> | ||
); |
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
42 changes: 42 additions & 0 deletions
42
packages/ui/src/components/QueueDropdownActions/QueueDropdownActions.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,42 @@ | ||
.trigger { | ||
padding: .5em .65em; | ||
margin-bottom: 0.25em; | ||
justify-self: flex-end; | ||
} | ||
|
||
.content { | ||
background: #fff; | ||
box-shadow: 0 2px 3px 0 rgba(34,36,38 ,0.15); | ||
border: 1px solid rgba(34,36,38,.15); | ||
border-radius: .28571429rem; | ||
padding-top: .25rem; | ||
padding-bottom: .25rem; | ||
font-size: .875rem; | ||
line-height: 1.25rem; | ||
font-weight: 400; | ||
min-width: 150px; | ||
} | ||
|
||
|
||
.item { | ||
display: block; | ||
color: rgba(0,0,0,.87); | ||
padding: .5rem 1rem; | ||
font-weight: 400; | ||
white-space: nowrap; | ||
cursor: pointer; | ||
} | ||
|
||
.item > svg { | ||
float: none; | ||
margin-right: .5rem; | ||
width: 1.18em; | ||
height: 1em; | ||
vertical-align: middle; | ||
fill: #718096; | ||
} | ||
|
||
.item:hover { | ||
color: rgba(0,0,0,.95); | ||
background: #e2e8f0; | ||
} |
42 changes: 42 additions & 0 deletions
42
packages/ui/src/components/QueueDropdownActions/QueueDropdownActions.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,42 @@ | ||
import { AppQueue } from '@bull-board/api/typings/app'; | ||
import { Content, Item, Root, Trigger } from '@radix-ui/react-dropdown-menu'; | ||
import React from 'react'; | ||
import { Store } from '../../hooks/useStore'; | ||
import { EllipsisVerticalIcon } from '../Icons/EllipsisVertical'; | ||
import { PauseIcon } from '../Icons/Pause'; | ||
import { PlayIcon } from '../Icons/Play'; | ||
import { Button } from '../JobCard/Button/Button'; | ||
import s from './QueueDropdownActions.module.css'; | ||
|
||
export const QueueDropdownActions = ({ | ||
queue, | ||
actions, | ||
}: { | ||
queue: AppQueue; | ||
actions: Store['actions']; | ||
}) => ( | ||
<Root> | ||
<Trigger as={Button} className={s.trigger}> | ||
<EllipsisVerticalIcon /> | ||
</Trigger> | ||
|
||
<Content className={s.content} align="end"> | ||
<Item | ||
className={s.item} | ||
onSelect={queue.isPaused ? actions.resumeQueue(queue.name) : actions.pauseQueue(queue.name)} | ||
> | ||
{queue.isPaused ? ( | ||
<> | ||
<PlayIcon /> | ||
Resume | ||
</> | ||
) : ( | ||
<> | ||
<PauseIcon /> | ||
Pause | ||
</> | ||
)} | ||
</Item> | ||
</Content> | ||
</Root> | ||
); |
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
Oops, something went wrong.