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

Progress notifications #192

Closed
damianmoore opened this issue Feb 18, 2021 · 4 comments
Closed

Progress notifications #192

damianmoore opened this issue Feb 18, 2021 · 4 comments
Assignees
Milestone

Comments

@damianmoore
Copy link
Collaborator

damianmoore commented Feb 18, 2021

First time users are likely to add their photo collection and see the thumbnails appear. This might seem like the import is complete but they are not seeing all the classification and therefore might be unimpressed by the lack of filtering or think that it is not working. Showing a status/progress of what is ongoing should let people know that they can expect more in a while.

Create a GraphQL endpoint which can bring back the number of remaining Tasks objects with status='P' or 'S' for each of the types:

  • generate_thumbnails
  • process_raw
  • classify.color
  • classify.location
  • classify.object
  • classify.style

This GraphQL query should be called regularly every minute in the <Header /> component. If there are any tasks remaining it should show the notification icon that is currently commented out.

Hovering and clicking the notification should show a dropdown menu in the same way as the user menu next to it. When this is expanded any of the task types with greater than 0 should show a row with the following string that map to the task types above:

  • Generating thumbnails
  • Processing raw files
  • Analysing colors
  • Analysing locations
  • Analysing objects
  • Analysing styles

There is no obvious number of completed tasks as we don't know the time since when we should be measuring. It is nice to show a progress bar though. To calculate the bar percentage we calculate:

(total - remaining) / total

For our total value we should use window.sessionStorage to store when we first get a number larger than 0. In the next API call, if we get a remaining value larger than our current total then we should increase the sessionStorage total to the new value. Once the remaining number has finally gone back down to 0 then 0 should be stored in sessionStorage.

This means that when a job starts running, the number of tasks can continue to go up - the user may still be importing photos and therefore the number of tasks can increase faster than they get processed. In this case the percentage will go down initally until import completes and tasks get completed.

If all tasks of a particular type complete and the bar reaches 100%, the item should then be removed from the list and total value in sessionStorage should be set to 0. This means that if tasks of this type start up again there will be a new total and the progress bar starts again at a low number.

There is a pause button which toggles to a play button when clicked. The play/pause state should synchronise to the Library values visible in the settings modal.

Icons:
https://fonts.google.com/icons?selected=Material%20Icons%3Apause_circle
https://fonts.google.com/icons?selected=Material%20Icons%3Aplay_circle

progress_mockup

@GyanP
Copy link
Collaborator

GyanP commented Jun 28, 2021

Task Done and changes pushed on branch 192-progress-notifications

@damianmoore
Copy link
Collaborator Author

Hi @GyanP, I've just been trying this out again and merged in master. The UI looks good and play/pause works well. There is one main issue and a couple of questions I have:

Bug:

  • If page is already loaded and then I add photos to the folder, the notification doesn't display. I can see the GraphQL query polling every 15 secs in the network inspector. If I refresh after that the notification icon shows but it needs to show when new tasks start running.

Questions:

  • In photonix/photos/utils/tasks.py I see that requeue_stuck_tasks age_hours has reduced a lot. Was this for debugging or does this need to be this value? If so, why?
  • Could you add support for the face classification please now we have added that?

@GyanP
Copy link
Collaborator

GyanP commented Jul 16, 2021

Task done and changes pushed on branch 192-progress-notifications
I have merged master in 192-progress-notifications

@damianmoore
Copy link
Collaborator Author

Merged as of 4b9ef8e and release v0.17.0

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

No branches or pull requests

2 participants