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

Show a single sync option for the initial sync. #2858

Merged
merged 6 commits into from
Aug 10, 2022
Merged

Conversation

JakePT
Copy link
Contributor

@JakePT JakePT commented Jun 24, 2022

Description of the Change

If a user skips setup when they visit the Sync page they are presented the usual Sync and Delete & Sync options. Th problem is that a Delete & Sync is required for the first sync, so if the user just presses Sync errors will occur.

This PR changes the Sync page so that only the correct syncing option is displayed when a sync hasn't been performed yet.

elasticpress test_wp-admin_admin php_page=elasticpress-sync

For implementation this PR:

  1. Abstracts the sync panels into a SyncPanel component to reduce repetitive code.
  2. Hides the Delete & Sync panel and changes the wording of the Sync panel if there is no information for a previous sync.
  3. Forces put_mapping for any Sync requests from the Sync page if there has not been a previous Sync.

Closes #2695

Alternate Designs

I've opted for changing the behaviour and wording of the top Sync option for the first sync, rather than just displaying the "Delete & Sync" option. This is because I though it could be confusing if the user was asked to "Delete & Sync" when there was nothing to delete.

For the wording of the panel I drew on the wording of the Getting Started page of the website, and the documentation, but this could be anything.

Possible Drawbacks

I'm not aware of any.

Verification Process

After entering the hosting details during install choose to Skip Setup to bypass the initial sync._ Then manually navigate to ElasticPress > Sync. Instead of seeing both Sync and Delete & Sync panels, only a single panel should be displayed.

Similarly, when choosing to Sync during setup, this is the only panel that should appear during that sync.

Checklist:

  • I have read the CONTRIBUTING document.
  • 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 change.
  • All new and existing tests passed.

Changelog Entry

Fixed - An issue where syncing after skipping setup, instead of deleting and syncing, resulted in an error.

Credits

Props @JakePT

@JakePT JakePT requested a review from felipeelia June 24, 2022 08:30
@JakePT JakePT self-assigned this Jun 24, 2022
@JakePT JakePT added module:sync Issues related to the Sync functionality needs discussion labels Jun 24, 2022
@JakePT JakePT added this to the 4.3.0 milestone Jun 24, 2022
@felipeelia felipeelia assigned JakePT and unassigned JakePT Jul 19, 2022
@JakePT JakePT assigned felipeelia and unassigned JakePT Aug 9, 2022
@JakePT JakePT removed the needs tests label Aug 9, 2022
@felipeelia felipeelia assigned JakePT and unassigned felipeelia Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module:sync Issues related to the Sync functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Hide last sync element info box if there's no info to display
2 participants