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(sql lab): enable ACE editor search in SQL editors #19328

Merged

Conversation

diegomedina248
Copy link
Contributor

SUMMARY

Currently, in the SQL editor inside the Lab, the search available is the native one provided by the browser.

For performance reasons, the editor only renders a subset of the entire content. So, the native search cannot find content in the editor that's not currently rendered.

This PR changes the search mechanism to use the ACE plugin one, which will enable full search inside the editor.
The search is only enabled if the editor is focused, otherwise the normal native search is used.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2022-03-23.at.09.06.22.mov

After:

Screen.Recording.2022-03-23.at.09.02.58.mov

TESTING INSTRUCTIONS

  1. Open the SQL Lab
  2. Write (or copy paste) a large text inside the editor.

Ensure the search inside the editor can find anything inside it, including text that's not currently visible.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Mar 23, 2022

Codecov Report

Merging #19328 (efcab77) into master (54c521b) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master   #19328   +/-   ##
=======================================
  Coverage   66.65%   66.65%           
=======================================
  Files        1674     1674           
  Lines       64603    64603           
  Branches     6500     6500           
=======================================
  Hits        43058    43058           
  Misses      19862    19862           
  Partials     1683     1683           
Flag Coverage Δ
javascript 51.32% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/src/SqlLab/components/AceEditorWrapper/index.tsx 43.85% <ø> (-0.97%) ⬇️
...t-frontend/src/components/AsyncAceEditor/index.tsx 91.11% <100.00%> (+0.20%) ⬆️
.../superset-ui-core/src/query/types/QueryFormData.ts 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54c521b...efcab77. Read the comment docs.

@yousoph
Copy link
Member

yousoph commented Mar 23, 2022

/testenv up

@github-actions
Copy link
Contributor

@yousoph Ephemeral environment spinning up at http://34.211.6.2:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Contributor

@codemaster08240328 codemaster08240328 left a comment

Choose a reason for hiding this comment

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

Approved, but need to confirm why find option is previously removed from editor command.

@@ -127,8 +127,6 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
}

onEditorLoad(editor: any) {
editor.commands.removeCommand('find');
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you get a chance to look at why they removed find command previously?

We may face side effect by adding it again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The editor originally trapped the find command, but it wasn't working.
So, we removed it to offer basic search functionality using the browser.
This re-enables search within the editor with a plugin, which is far better at searching

@eschutho eschutho merged commit eab9388 into apache:master Mar 31, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Mar 31, 2022
sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Apr 1, 2022
@villebro villebro added the lts-v1 label Apr 1, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
villebro pushed a commit that referenced this pull request Apr 4, 2022
@sadpandajoe
Copy link
Member

🏷️ preset:2022.11

philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 and removed 🚢 2.0.1 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels lts-v1 preset:2022.11 Preset-Patch size/XS 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants