-
Notifications
You must be signed in to change notification settings - Fork 53
Sync Pull: Update the progress from percentage from the backup response #1278
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
Sync Pull: Update the progress from percentage from the backup response #1278
Conversation
Adding the Importing states will provide more context to the Pull whole action
ivan-ottinger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposed changes look good to me and work correctly in my tests. The progress is smoother and displays relevant status messages. Great work, Roberto!
I have left a couple smaller comments below.
It took me a bit longer to review this one as I haven't touched this part of the codebase before. Because of that, I think it makes sense if more eyes take a look at the proposed changes in case I missed something. 🙂
| type SyncBackupResponse = { | ||
| status: 'in-progress' | 'finished' | 'failed'; | ||
| download_url: string; | ||
| percent: number; | ||
| }; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for extracting out this type. It is more readable to me now.
| if ( response.status === 'in-progress' ) { | ||
| newProgressInfo = pullStatesProgressInfo[ frontendStatus ]; | ||
| newProgressInfo.progress = | ||
| IN_PROGRESS_INITIAL_VALUE + IN_PROGRESS_TO_DOWNLOADING_STEP * ( response.percent / 100 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this spread of the percentage / progress. Nice!
| { importState[ connectedSite.localSiteId ]?.statusMessage || | ||
| sitePullState.status.message } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bit subjective, but maybe we could consider extracting out this logic for better readability (e.g. into a separate const statusMessage).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes total sense to me, updated as part of 6afe9c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!, Great idea using the import states to give more information to the user.
In the future we could even improve when importing certain tables in both features, pull and import.
One thing I would like to improve is displaying "Import completed" for a few seconds before showing "Pull complete." Can we omit or replace that message? Perhaps something like: "Applying final details…", "Finishing the import…" or "Starting the site…" could work.
We should also test it in other languages, such as Ukrainian, because the change in the length of the new strings affects the size of the progress bar.
Video BEFORE
before-pressable-pull.mp4
Video AFTER
after-pressable-pull.mp4
|
Thanks @sejas, for the review and the suggestions. I have created a PoC of the Import step that updates the bar progress based on the Import inner steps. Also, I have replaced the I have used an external function for that, but I would like to get some feedback. Other options that I would like to try are:
Commit here e1c64bc Please let me know your view on this. |
sejas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! It runs super smoothly.
Let's add ellipsis to the Applying final details …
pull-with-import-states.mp4
| } | ||
| if ( importState ) { | ||
| if ( importState.progress === 100 ) { | ||
| return { message: __( 'Applying final details' ), progress: 99 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add ellipsis to this sentence:
| return { message: __( 'Applying final details' ), progress: 99 }; | |
| return { message: __( 'Applying final details…' ), progress: 99 }; |
…dio-sync-add-percentage-based-or-more-states-into-account

Related issues
Resolves STU-167
Proposed Changes
importStatemessages when available to provide greater detail of theImporting BackupstepTesting Instructions
npm startSynctab and connect with a non-trivial site, for example a WooCommerce site with multiple products. You can find an example of a non-trivial site here 37a5a-pb that you can Import if requiredDownloadstepPulland check the progressPre-merge Checklist