-
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor styles and some behavior of dashboard queue filter
- Loading branch information
Showing
13 changed files
with
135 additions
and
79 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
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 |
---|---|---|
@@ -1,28 +1,46 @@ | ||
import { Status } from '@bull-board/api/dist/typings/app'; | ||
import React from 'react'; | ||
import { Trans, useTranslation } from 'react-i18next'; | ||
import { NavLink } from 'react-router-dom'; | ||
import { QueueCard } from '../../components/QueueCard/QueueCard'; | ||
import { StatusLegend } from '../../components/StatusLegend/StatusLegend'; | ||
import { useQuery } from '../../hooks/useQuery'; | ||
import { useQueues } from '../../hooks/useQueues'; | ||
import { links } from '../../utils/links'; | ||
import s from './OverviewPage.module.css'; | ||
import { useSelectedStatuses } from '../../hooks/useSelectedStatuses'; | ||
|
||
export const OverviewPage = () => { | ||
const { t } = useTranslation(); | ||
const { actions, queues } = useQueues(); | ||
actions.pollQueues(); | ||
|
||
const selectedStatus = useSelectedStatuses(); | ||
const overviewPageStatus = selectedStatus['']; | ||
const query = useQuery(); | ||
|
||
actions.pollQueues(); | ||
const selectedStatus = query.get('status') as Status; | ||
const queuesToView = | ||
queues?.filter((queue) => !selectedStatus || queue.counts[selectedStatus] > 0) || []; | ||
return ( | ||
<section> | ||
<StatusLegend /> | ||
|
||
<ul className={s.overview}> | ||
{queues?.filter((queue) => overviewPageStatus === 'latest' || queue.counts[overviewPageStatus] > 0).map((queue) => ( | ||
<li key={queue.name}> | ||
<QueueCard queue={queue} /> | ||
</li> | ||
))} | ||
</ul> | ||
{queuesToView.length > 0 && ( | ||
<ul className={s.overview}> | ||
{queuesToView.map((queue) => ( | ||
<li key={queue.name}> | ||
<QueueCard queue={queue} /> | ||
</li> | ||
))} | ||
</ul> | ||
)} | ||
{queuesToView.length === 0 && !!selectedStatus && ( | ||
<div className={s.message}> | ||
<Trans | ||
t={t} | ||
i18nKey="DASHBOARD.NO_FILTERED_MESSAGE" | ||
values={{ status: t(`QUEUE.STATUS.${selectedStatus.toUpperCase()}`) }} | ||
components={{ lnk: <NavLink to={links.dashboardPage()} /> }} | ||
/> | ||
</div> | ||
)} | ||
</section> | ||
); | ||
}; |
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