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

Custom job data formatter #204

Closed

Conversation

Jivings
Copy link
Contributor

@Jivings Jivings commented Dec 21, 2020

Summary

User can now specify AdapterOptions passed to the BullAdapter on creation. In this user can specify the dataFormatter, which provides an alternative way to parse job data to be displayed in the Jobs List UI.

Rationale

I have a rather large payload that I send over my queue, and parsing that causes the UI to be very unresponsive. Using a custom data parser I can now instead show a subset of the full payload in the UI.

image

image

User can now specify AdapterOptions passed to the BullAdapter on
creation. In this user can specify the jobParser, which provides an
alternative way to parse job data to be displayed in the Jobs List UI
@Jivings Jivings changed the title Create custom job parser Custom job parser Dec 21, 2020
@Jivings Jivings changed the title Custom job parser Custom job data formatter Dec 21, 2020
src/queueAdapters/bull.ts Outdated Show resolved Hide resolved
@@ -88,11 +91,11 @@ const getDataForQueues = async (
const status =
query[name] === 'latest' ? statuses : (query[name] as JobStatus[])
const jobs = await queue.getJobs(status, 0, 10)

const formatter = formatJob(queue.options?.dataFormatter)
Copy link
Owner

Choose a reason for hiding this comment

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

I think that it is better to incapsulate the formatting part inside the adapters (inside getJobs), therefore, making AdapterOptions as private field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yasss, maybe this is more correct. Will update 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to do this but reached the extent of my typescript knowledge and am bumbling around trying to figure it out. Sorry no more time to spend on it now.

@felixmosh
Copy link
Owner

Thank you for this PR, it is a great idea to filter out some data fields :]

@felixmosh
Copy link
Owner

I think that it can be handled from a different angle, since the issue that you are trying to solve related to many cards with heavy data, I think that we should consider some virtual-scroller implementation.

Do you think this will solve your issue?

@Jivings
Copy link
Contributor Author

Jivings commented Dec 28, 2020

It will solve the heavy DOM issue, but I also want to not show personal data in the UI :)

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.

2 participants