-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
F/692 pause resume jobs at once (#868)
* feat(OverviewActions): add OverviewActions component with pause and resume functionality; update OverviewPage layout and styles - Introduced a new `OverviewActions` component that provides pause and resume actions for queues. - Updated `OverviewPage` to include the new `OverviewActions` component in the header. - Enhanced CSS for the header layout to improve UI alignment and spacing. - Added new translation keys for pause and resume actions in the localization files. * feat(OverviewActions): integrate pause and resume actions into OverviewActions component - Updated the OverviewActions component to accept actions as props, enabling pause and resume functionality for queues. - Implemented pauseAll and resumeAll actions in the useQueues hook. - Modified OverviewPage to pass the actions prop to OverviewActions, enhancing the user interface for queue management. * feat(api): add pause and resume queue functionality - Introduced `pauseAllHandler` and `resumeAllHandler` to handle pausing and resuming all queues. - Updated `appRoutes` to include new API endpoints for pausing and resuming queues. - Enhanced `useQueues` hook to integrate API calls for pausing and resuming queues with user confirmation. - Added corresponding methods in the `Api` service for making requests to the new endpoints. * refactor: renamed component OverviewActions is renamed to OverviewDropDownActions * feat: check for the queue pause state before resuming or pausing --------- Co-authored-by: ahmad anwar <[email protected]>
- Loading branch information
Showing
10 changed files
with
111 additions
and
3 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,13 @@ | ||
import { BullBoardRequest, ControllerHandlerReturnType } from '../../typings/app'; | ||
|
||
async function pauseAll(req: BullBoardRequest): Promise<ControllerHandlerReturnType> { | ||
req.queues.forEach(async (queue) => { | ||
const isPaused = await queue.isPaused(); | ||
if (!isPaused) { | ||
queue.pause(); | ||
} | ||
}); | ||
return { status: 200, body: { message: 'All queues paused' } }; | ||
} | ||
|
||
export const pauseAllHandler = pauseAll; |
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,13 @@ | ||
import { BullBoardRequest, ControllerHandlerReturnType } from '../../typings/app'; | ||
|
||
async function resumeAll(req: BullBoardRequest): Promise<ControllerHandlerReturnType> { | ||
req.queues.forEach(async (queue) => { | ||
const isPaused = await queue.isPaused(); | ||
if (isPaused) { | ||
await queue.resume(); | ||
} | ||
}); | ||
return { status: 200, body: { message: 'All queues resumed' } }; | ||
} | ||
|
||
export const resumeAllHandler = resumeAll; |
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/OverviewDropDownActions/OverviewDropDownActions.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 React from 'react'; | ||
import { Item, Portal, Root, Trigger } from '@radix-ui/react-dropdown-menu'; | ||
import { Button } from '../Button/Button'; | ||
import { DropdownContent } from '../DropdownContent/DropdownContent'; | ||
import { EllipsisVerticalIcon } from '../Icons/EllipsisVertical'; | ||
import { PauseIcon } from '../Icons/Pause'; | ||
import { PlayIcon } from '../Icons/Play'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useQueues } from '../../hooks/useQueues'; | ||
|
||
export const OverviewActions = ({ | ||
actions, | ||
}: { | ||
actions: ReturnType<typeof useQueues>['actions']; | ||
}) => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Root> | ||
<Trigger asChild> | ||
<Button> | ||
<EllipsisVerticalIcon /> | ||
</Button> | ||
</Trigger> | ||
|
||
<Portal> | ||
<DropdownContent align="end"> | ||
<Item onClick={actions.pauseAll}> | ||
<PauseIcon /> | ||
{t('QUEUE.ACTIONS.PAUSE_ALL')} | ||
</Item> | ||
<Item onClick={actions.resumeAll}> | ||
<PlayIcon /> | ||
{t('QUEUE.ACTIONS.RESUME_ALL')} | ||
</Item> | ||
</DropdownContent> | ||
</Portal> | ||
</Root> | ||
); | ||
}; | ||
|
||
export default OverviewActions; |
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 |
---|---|---|
|
@@ -21,3 +21,9 @@ | |
} | ||
} | ||
} | ||
|
||
.header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} |
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