Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Group queues in Menu #867

Merged
merged 8 commits into from
Jan 5, 2025

Conversation

ahnwarez
Copy link
Contributor

@ahnwarez ahnwarez commented Jan 2, 2025

No description provided.

This change enhances the flexibility of queue configurations by allowing the specification of a delimiter.
- Introduced a new `QueueTree` component to render queues in a hierarchical structure based on a delimiter.
- Updated the `Menu` component to utilize the new `QueueTree` for displaying queues.
- Enhanced CSS styles for the menu, including padding adjustments and added margin for nested levels.
@felixmosh
Copy link
Owner

Hi, thank you for this PR.
Can you share how the ui looks?
I'll review the code ASAP

@ahnwarez
Copy link
Contributor Author

ahnwarez commented Jan 2, 2025

Thanks for your quick reply 🙂

This PR implements #633
I've always wanted to have this feature in Bull-Board where I can see all queues like a tree.

Here are notable things in this PR:

  • The user decides how they name their queues and how they are delimited when creating queues and when passing the queues to createBullBoard
const newRegistration = createQueueMQ('Notifications.User.NewRegistration');
const resetPassword = createQueueMQ('Notifications.User.ResetPassword');

createBullBoard({
    queues: [
      new BullMQAdapter(newRegistration, { delimiter: '.' }),
      new BullMQAdapter(resetPassword, { delimiter: '.' }),
    ],
    serverAdapter,
  });
  • Expanding and collapsing is done using details and summary tags. All details are expanded by default.
  • Added a new React component AppQueueTree to recursively render nodes until a leaf is found.

I welcome any feedback. Thanks to all contributors.

REC-20250102160303.mp4

@ahnwarez ahnwarez marked this pull request as ready for review January 2, 2025 03:21
Copy link
Owner

@felixmosh felixmosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the code looks awsome 🙏🏽
Thank you for this PR, it will implement a much request feature :]

packages/ui/src/utils/toTree.ts Outdated Show resolved Hide resolved
packages/ui/src/utils/toTree.ts Outdated Show resolved Hide resolved
packages/ui/src/utils/toTree.ts Outdated Show resolved Hide resolved
@ahnwarez
Copy link
Contributor Author

ahnwarez commented Jan 2, 2025

Thank you for your review @felixmosh, really appreciate your feedback.
I've pushed the new changes and addressed your feedback regarding using objects.

@felixmosh
Copy link
Owner

Im AFK at the weekend, will publish it on Monday.
Thank you 🙏🏽

@felixmosh felixmosh merged commit 094fcc1 into felixmosh:master Jan 5, 2025
@felixmosh
Copy link
Owner

I've noticed a bug, the nav link links to queues final part (which is not the full queue name), therefore, it returns, Queue not found.

I'll fix it.

@felixmosh
Copy link
Owner

I've improved a bit the design...
image

@felixmosh
Copy link
Owner

Thank you for this PR, it released in v6.6.0

@ahnwarez ahnwarez deleted the f/633/group-by-prefix branch January 5, 2025 16:00
@Diluka
Copy link
Contributor

Diluka commented Jan 17, 2025

@ahnwarez I don't use delimiter but some prefixes. How can I use this feature?

for examples:

  • a-queue-1
  • b-queue-1
  • b-queue-2
  • a-users-update

@felixmosh
Copy link
Owner

You can try to set the prefix to be a; , b;
Then set the delimiter to be ;

@ahnwarez
Copy link
Contributor Author

There are optional parameters to set the delimiter and in the example below it's ., so in your case you need to change it to { delimiter: '-'}

  // before
  createBullBoard({
    queues: [
      new BullMQAdapter(exampleBullMq, { delimiter: '.' }),
      new BullAdapter(exampleBull, { delimiter: '.' }),
      new BullMQAdapter(newRegistration, { delimiter: '.' }),
      new BullMQAdapter(resetPassword, { delimiter: ':' }),
    ],
    serverAdapter,
  });
// after 
createBullBoard({
   queues: [
     new BullMQAdapter(exampleBullMq, { delimiter: '-' }),
   ],
   serverAdapter,
 });

I hope this answers your question 🙂

@Diluka
Copy link
Contributor

Diluka commented Jan 17, 2025

My queues are named as prefix-the-rest-of-name. the prefix is prefix and the-rest-of-name is the queue name. And I have multiple prefixes.

@andreasciamanna
Copy link

This works.

However, with my queues are all wrapped with curly braces (e.g. {my-queue-something}), the look of the grouping is a bit ugly:

image

As of why I name queues like that, see Hash tags.

Is there an option I can use to handle this case?

@felixmosh
Copy link
Owner

@andreasciamanna can you open a separate bug?

@andreasciamanna
Copy link

@andreasciamanna can you open a separate bug?

Of course.

I wasn't sure if it was a bug or just an option I should set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants