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

Single button to copy all the info #63

Merged
merged 15 commits into from
Mar 22, 2023

Conversation

MARQAS
Copy link
Contributor

@MARQAS MARQAS commented Jan 31, 2023

Description of the Change

This PR will replace the copy cURL buttons into a single copy button that will be used to copy the whole data instead of single cURL request. The position is also changed from bottom of the cURL request to top of all the cURL calls for better visibility and usage

Closes #59

How to test the Change

  • Install Debug bar and Debug bar ElasticPress along with ElasticPress.
  • Go to the website and search for anything after activating ElasticPress.
  • Enable query logging
  • From the top right corner: Click on Debug->ElasticPress
  • Notice that the multiple copy button will now be replaced by single copy button
  • Click on it and it will copy all the cURL requests of the page

Changelog Entry

Changed - Copy link per query to a single copy button to copy all cURL requests instead of individual queries.

Credits

Props @MARQAS

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@MARQAS MARQAS requested a review from felipeelia January 31, 2023 12:01
@MARQAS MARQAS self-assigned this Jan 31, 2023
@MARQAS MARQAS removed their assignment Jan 31, 2023
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

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

@MARQAS In addition to the git conflict we need to solve, we will need to make some changes on this one:

  1. We do not want to replace the "Copy cURL Request". That is useful when someone wants to replay a specific query.
  2. The button that copies everything can't be named "Copy cURL Requests" because it is copying much more than the cURL commands to replay the request. Something like "Copy Requests Info" would work better.
  3. We can come up with better formatting for the copied report. Following the format we have in the Status Report would make it easier to read.

In addition to that, it would be great if the user could also download the debug info as a txt file. I've created an issue in the ElasticPress repo talking about that.

@MARQAS MARQAS added this to the 2.2.0 milestone Mar 2, 2023
assets/css/main.css Outdated Show resolved Hide resolved
const request = copyBtn.getAttribute('data-request');

copyBtn.addEventListener('click', function () {
navigator.clipboard.writeText(request).then(function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting this error Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')

Copy link
Member

Choose a reason for hiding this comment

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

@burhandodhy I wasn't able to reproduce this one. In which browser are you seeing this?

classes/QueryFormatter.php Outdated Show resolved Hide resolved
@felipeelia felipeelia merged commit a1a15c7 into develop Mar 22, 2023
@felipeelia felipeelia deleted the feature/59-copy-button-improvement branch March 22, 2023 11:44
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.

Copy and paste the full query panel info
3 participants