Skip to content

Commit

Permalink
fix: show only relevant option in overview dropdown
Browse files Browse the repository at this point in the history
feat: add missing translations
  • Loading branch information
felixmosh committed Jan 19, 2025
1 parent 62ecfbb commit 98aaa5d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
import React from 'react';
import { AppQueue } from '@bull-board/api/dist/typings/app';
import { Item, Portal, Root, Trigger } from '@radix-ui/react-dropdown-menu';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { QueueActions } from '../../../typings/app';
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,
queues,
}: {
actions: ReturnType<typeof useQueues>['actions'];
actions: QueueActions;
queues: AppQueue[] | null;
}) => {
const { t } = useTranslation();

if (!queues) {
return null;
}

const areAllPaused = queues.every((queue) => queue.isPaused);

return (
<Root>
<Trigger asChild>
Expand All @@ -25,14 +34,17 @@ export const OverviewActions = ({

<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>
{areAllPaused ? (
<Item onClick={actions.resumeAll}>
<PlayIcon />
{t('QUEUE.ACTIONS.RESUME_ALL')}
</Item>
) : (
<Item onClick={actions.pauseAll}>
<PauseIcon />
{t('QUEUE.ACTIONS.PAUSE_ALL')}
</Item>
)}
</DropdownContent>
</Portal>
</Root>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/pages/OverviewPage/OverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const OverviewPage = () => {
<section>
<div className={s.header}>
<StatusLegend />
<OverviewDropDownActions actions={actions} />
<OverviewDropDownActions actions={actions} queues={queues} />
</div>
{queuesToView.length > 0 && (
<ul className={s.overview}>
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/static/locales/es-ES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"CLEAN_ALL": "Limpiar todas",
"RESUME": "Reanudar",
"PAUSE": "Pausar",
"RESUME_ALL": "Reanudar todo",
"PAUSE_ALL": "Pausar todo",
"EMPTY": "Vaciar",
"ADD_JOB": "Añadir tarea",
"CONFIRM": {
Expand All @@ -74,7 +76,9 @@
"PROMOTE_ALL": "¿Estás seguro de que quieres promover todas las tareas retrasadas?",
"PAUSE_QUEUE": "¿Estás seguro de que quieres pausar el procesamiento de la cola?",
"EMPTY_QUEUE": "¿Estás seguro de que quieres vaciar la cola?",
"RESUME_QUEUE": "¿Estás seguro de que quieres reanudar el procesamiento de la cola?"
"RESUME_QUEUE": "¿Estás seguro de que quieres reanudar el procesamiento de la cola?",
"PAUSE_ALL": "¿Estás seguro de que deseas pausar todas las colas?",
"RESUME_ALL": "¿Estás seguro de que deseas reanudar todas las colas?"
}
},
"STATUS": {
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/static/locales/fr-FR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"CLEAN_ALL": "Tout nettoyer",
"RESUME": "Reprendre",
"PAUSE": "Pause",
"RESUME_ALL": "Reprendre tout",
"PAUSE_ALL": "Mettre tout en pause",
"EMPTY": "Vider",
"ADD_JOB": "Ajouter une tâche",
"CONFIRM": {
Expand All @@ -74,7 +76,9 @@
"PROMOTE_ALL": "Êtes-vous sûr de vouloir promouvoir toutes les tâches retardées ?",
"PAUSE_QUEUE": "Êtes-vous sûr de vouloir mettre en pause le traitement de la file ?",
"EMPTY_QUEUE": "Êtes-vous sûr de vouloir vider la file ?",
"RESUME_QUEUE": "Êtes-vous sûr de vouloir reprendre le traitement de la file ?"
"RESUME_QUEUE": "Êtes-vous sûr de vouloir reprendre le traitement de la file ?",
"PAUSE_ALL": "Êtes-vous sûr de vouloir mettre toutes les files d'attente en pause ?",
"RESUME_ALL": "Êtes-vous sûr de vouloir reprendre toutes les files d'attente ?"
}
},
"STATUS": {
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/static/locales/pt-BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"CLEAN_ALL": "Limpar todos",
"RESUME": "Resumir",
"PAUSE": "Pausar",
"RESUME_ALL": "Retomar tudo",
"PAUSE_ALL": "Pausar tudo",
"EMPTY": "Limpar",
"ADD_JOB": "Adicionar trabalho",
"CONFIRM": {
Expand All @@ -74,7 +76,9 @@
"PROMOTE_ALL": "Deseja realmente promover todas as tarefas atrasadas?",
"PAUSE_QUEUE": "Deseja realmente pausar o processamento da fila?",
"EMPTY_QUEUE": "Deseja realmente limpar a fila?",
"RESUME_QUEUE": "Deseja realmente retomar o processamento da fila?"
"RESUME_QUEUE": "Deseja realmente retomar o processamento da fila?",
"PAUSE_ALL": "Tem certeza de que deseja pausar todas as filas?",
"RESUME_ALL": "Tem certeza de que deseja retomar todas as filas?"
}
},
"STATUS": {
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/src/static/locales/zh-CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
"CLEAN_ALL": "清理全部",
"RESUME": "恢复",
"PAUSE": "暂停",
"RESUME_ALL": "全部恢复",
"PAUSE_ALL": "全部暂停",
"EMPTY": "清空",
"ADD_JOB": "添加作业",
"CONFIRM": {
Expand All @@ -71,7 +73,9 @@
"PROMOTE_ALL": "您确定要提升所有延迟作业吗?",
"PAUSE_QUEUE": "您确定要暂停队列处理吗?",
"EMPTY_QUEUE": "您确定要清空队列吗?",
"RESUME_QUEUE": "您确定要恢复队列处理吗?"
"RESUME_QUEUE": "您确定要恢复队列处理吗?",
"PAUSE_ALL": "您确定要暂停所有队列吗?",
"RESUME_ALL": "您确定要恢复所有队列吗?"
}
},
"STATUS": {
Expand Down

0 comments on commit 98aaa5d

Please sign in to comment.