celery-progress icon indicating copy to clipboard operation
celery-progress copied to clipboard

Is there any way we can integrate this with a react project?

Open aashayamballi opened this issue 5 years ago • 7 comments

Hi, thanks for this library,

Can anyone please demonstrate how to use this in a react project with Django/Django Rest Framework backend?

aashayamballi avatar Jul 28 '20 08:07 aashayamballi

Hey! I have done this but so far only by dropping the JS dependency on the page. I've learned a lot about how JavaScript works since originally creating this.

It would be great to package the JS separately and distribute it via NPM so that it can more easily integrate with React and other frameworks. That work is something I'd love to make time for in the future. At the moment, I'm not sure when I'll be able to but would love help or will prioritize when I come back to this lib down the road.

czue avatar Jul 28 '20 15:07 czue

I think I figured out how to do this

TWEEDOriginal avatar Sep 28 '20 12:09 TWEEDOriginal

Hi, thanks for this library,

Can anyone please demonstrate how to use this in a react project with Django/Django Rest Framework backend?

Hello, I think I have figured out how to do this

TWEEDOriginal avatar Sep 28 '20 12:09 TWEEDOriginal

@TWEEDOriginal any more details? Guessing it would be helpful for others.

czue avatar Sep 30 '20 07:09 czue

In my models.py I created a specific model for task_id so whenever a celery task is initiated with .delay() a new task_id model which contains the task_id is created. // Django code

result_task = process_document.delay(instance.pk)

ResultTaskID.objects.create(task_id = result_task.task_id) // So in my front end(React) I get the task_id via an api call to the server, Then the rest is just like you explained in the documentation. // Django local host

var resultprogressUrl = http://127.0.0.1:8000/celery-progress/${actual_result_task_id}

I also copied your CeleryProgressBar class from your GitHub and I imported it into react the normal way. So to view the progress bar I do this.

CeleryProgressBar.initProgressBar(resultprogressUrl);

On 30 Sep 2020, at 08:26, Cory Zue [email protected] wrote:

 @TWEEDOriginal any more details? Guessing it would be helpful for others.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

TWEEDOriginal avatar Sep 30 '20 22:09 TWEEDOriginal

Hi there, I have integrated the celery-progress with react. I also have created a tutorial for it. Check out the tutorial on dev.to/iamtekson.

I think I have to apply a little bit more conditions on the frontend. @czue, @TWEEDOriginal, @aashayamballi, I am expecting your help to improve the integration. Thank you.

iamtekson avatar Feb 12 '21 06:02 iamtekson

thanks, I took a quick look and it looks like a great resource!

czue avatar Feb 20 '21 13:02 czue