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

feat: refresh multiple archives #1723

Merged
merged 15 commits into from
Jul 5, 2023

Conversation

diivi
Copy link
Contributor

@diivi diivi commented Jun 1, 2023

Description

First task for one of my GSoC Projects, "Enhancing the Archive Table actions". I listed these tasks out in the proposal, in total they should take me around 50 hours:

This will allow Vorta users to select multiple archives and refresh them at once, hence improving UX.

Motivation and Context

Saves the user's time.

How Has This Been Tested?

I tested this manually:

refresh-multiple

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
@diivi diivi marked this pull request as ready for review June 2, 2023 13:43
Copy link
Collaborator

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

The PR works as expected.
I am a bit unsure about the implementation, a bit more discussion is needed here.

src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
Hofer-Julian
Hofer-Julian previously approved these changes Jun 9, 2023
Copy link
Collaborator

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Great job!

Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

Until now the buttons where visually grouped into single and multi archive options. This PR dismisses this grouping logic. However I am starting to think that grouping the buttons like that might not be so useful afterall. What do you think?

src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
src/vorta/views/archive_tab.py Outdated Show resolved Hide resolved
job.updated.connect(self._set_status)
job.result.connect(self.info_result)
self._toggle_all_buttons(False)
self.app.jobs_manager.add_job(job)

def info_result(self, result):
self._toggle_all_buttons(True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will enable the buttons again although the other info jobs are still running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So should I connect just the last job's result to this function?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, theoretically you don't know which job finishes first. Did you try to run the current code? I would think that only one borg jobs succeeds because of the repo lock.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I tried running it (I attached a GIF above).

Copy link
Contributor Author

@diivi diivi Jun 14, 2023

Choose a reason for hiding this comment

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

Nevermind, I didn't attach the GIF. Here,
Peek 2023-06-15 02-22

They do blink, but all jobs are succeeding right?

@m3nu
Copy link
Contributor

m3nu commented Jun 14, 2023

The enabled/disabled state of buttons seems to go on and off. Or is that just the GIF?

And didn't we want to rename "Refresh" to something else? I recall a discussion here or elsewhere.

@diivi
Copy link
Contributor Author

diivi commented Jun 14, 2023

And didn't we want to rename "Refresh" to something else? I recall a discussion here or elsewhere.

Ah yes, done in the next commit.

The enabled/disabled state of buttons seems to go on and off.

Yes, I am confused how to disable them until all jobs are completed though (so they don't get enabled after every single job), looking around.

@m3nu
Copy link
Contributor

m3nu commented Jun 14, 2023

Yes, I am confused how to disable them until all jobs are completed though (so they don't get enabled after every single job), looking around.

Depends on how they are toggled right now. If it's from the BorgJob directly, there isn't much to be done without larger changes.

@diivi
Copy link
Contributor Author

diivi commented Jun 14, 2023

If it's from the BorgJob directly, there isn't much to be done without larger changes.

Yeah, it's connected to the BorgJob's result :/

@diivi
Copy link
Contributor Author

diivi commented Jun 16, 2023

Yeah, it's connected to the BorgJob's result :/

What can I do now?

@m3nu
Copy link
Contributor

m3nu commented Jun 23, 2023

OK for me. An isolated change, which doesn't add much new code.

Comments should be resolved, if any action is needed on them.

@m3nu m3nu self-assigned this Jun 23, 2023
@diivi
Copy link
Contributor Author

diivi commented Jun 23, 2023

Comments should be resolved, if any action is needed on them.

I am only stuck with your question here:
#1723 (comment)

But you said

If it's from the BorgJob directly, there isn't much to be done without larger changes.

other issues are solved, so probably ready to merge.

@real-yfprojects
Copy link
Collaborator

I am only stuck with your question here:
#1723 (comment)

Then we will need to open a follow-up issue for that problem. Or decide to fix the flashing problem first.

@jetchirag
Copy link
Contributor

jetchirag commented Jun 24, 2023

Not sure if I'm missing something but they seem to toggled in archive_tab.py, instead of BorgJob

https://github.com/borgbase/vorta/blob/92608f9eaaa6ac9d4bf28f9fa59edaae6001fe07/src/vorta/views/archive_tab.py#L532C1-L536C48

So if you move self._toggle_all_buttons(False) outside of for loop, it should stop the constant state change. Perhaps also add a parameter to info_result to change state back only conditionally.

Edit: Didn't factor in re-enabling button after last job.
How about maintaining a variable with length of archive_names, passing it onto info_result which would substract one each time and enable buttons back when it's 0?

@diivi
Copy link
Contributor Author

diivi commented Jun 24, 2023

How about maintaining a variable with length of archive_names, passing it onto info_result which would substract one each time and enable buttons back when it's 0?

This seems like a reasonable approach, I'll try this and update the PR, thanks!

@diivi
Copy link
Contributor Author

diivi commented Jun 25, 2023

It ended up being a little more complex than that 😅, but it works the way we want it to now:

Peek 2023-06-25 20-14

Of course I already had the sizes recalculated so it looks like there's less user feedback, but for no info it looks good.

m3nu
m3nu previously approved these changes Jun 28, 2023
@m3nu
Copy link
Contributor

m3nu commented Jul 4, 2023

Minor issue, maybe due to rebasing just now: The "Start" button stays disabled after it's done.

Screenshot 2023-07-04 at 19 09 43

@m3nu m3nu dismissed their stale review July 4, 2023 18:11

Minor issue after rebasing?

@diivi
Copy link
Contributor Author

diivi commented Jul 5, 2023

Updated so that the start backup button gets enabled again after refreshing all archives.

@m3nu
Copy link
Contributor

m3nu commented Jul 5, 2023

Works as expected locally. Merging. Thanks for your patience on polishing this. 👏

@m3nu m3nu merged commit 157ac37 into borgbase:master Jul 5, 2023
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.

5 participants