Skip to content

fix: copy to Clipboard order#16299

Merged
betodealmeida merged 7 commits into
apache:masterfrom
preset-io:ch22095_clipboardIncorrectOrder
Aug 24, 2021
Merged

fix: copy to Clipboard order#16299
betodealmeida merged 7 commits into
apache:masterfrom
preset-io:ch22095_clipboardIncorrectOrder

Conversation

@AAfghahi
Copy link
Copy Markdown
Member

@AAfghahi AAfghahi commented Aug 17, 2021

SUMMARY

This fixes this issue: #16149

The reason for this issue occurring is that Javascript orders objects based on integer and integer-like keys first, and then all strings: https://2ality.com/2015/10/property-traversal-order-es6.html

Therefore to prep the data for copyToClipboard, this code goes through and orders the keys based on the column names.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Also fixed the table order, which was previously wrong.
Before:
Screen Shot 2021-08-20 at 10 20 21 AM

After:
Screen Shot 2021-08-19 at 11 39 13 AM

TESTING INSTRUCTIONS

To test:

  1. Create a google sheet/database that has a mix of integers and strings as columns
  2. run a query on the database
  3. Use the copy to clipboard feature.
  4. Go into explore, use the copy to clipboard feature.

Also-

  1. Go to charts
  2. make sure the different visualization types have the south data pane rendering

ADDITIONAL INFORMATION

  • [ x] Has associated issue: [copy to clipboard] Column order sometimes goes wrong #16149
  • 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
Copy Markdown

codecov Bot commented Aug 17, 2021

Codecov Report

Merging #16299 (f8f8726) into master (6cd15d5) will decrease coverage by 0.38%.
The diff coverage is 60.20%.

❗ Current head f8f8726 differs from pull request most recent head 078816e. Consider uploading reports for the commit 078816e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #16299      +/-   ##
==========================================
- Coverage   76.75%   76.37%   -0.39%     
==========================================
  Files         997     1000       +3     
  Lines       53195    53494     +299     
  Branches     6764     6818      +54     
==========================================
+ Hits        40830    40855      +25     
- Misses      12135    12403     +268     
- Partials      230      236       +6     
Flag Coverage Δ
hive ?
javascript 70.78% <54.78%> (-0.26%) ⬇️
presto ?

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

Impacted Files Coverage Δ
superset-frontend/src/addSlice/App.tsx 0.00% <ø> (ø)
superset-frontend/src/common/components/index.tsx 100.00% <ø> (ø)
...rontend/src/dashboard/containers/DashboardPage.tsx 0.00% <0.00%> (ø)
...set-frontend/src/explore/actions/exploreActions.ts 36.20% <ø> (ø)
...ntend/src/explore/components/ExploreChartPanel.jsx 15.00% <0.00%> (ø)
...controls/DndColumnSelectControl/DndSelectLabel.tsx 77.27% <ø> (ø)
...ontrols/FilterControl/AdhocFilterControl/index.jsx 57.69% <ø> (ø)
.../FilterControl/AdhocFilterPopoverTrigger/index.tsx 80.76% <ø> (ø)
...ntrols/MetricControl/AdhocMetricPopoverTrigger.tsx 72.30% <ø> (ø)
...mponents/controls/MetricControl/MetricsControl.jsx 42.05% <ø> (ø)
... and 167 more

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 6cd15d5...078816e. Read the comment docs.

@pull-request-size pull-request-size Bot added size/M and removed size/S labels Aug 18, 2021
@AAfghahi AAfghahi force-pushed the ch22095_clipboardIncorrectOrder branch 2 times, most recently from a88a393 to 78c0fbe Compare August 18, 2021 20:06
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: deconstruct all_columns

const { all_columns } = queryFormData

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

made the changes!

@AAfghahi AAfghahi force-pushed the ch22095_clipboardIncorrectOrder branch from 78c0fbe to 1b40fb3 Compare August 18, 2021 22:13
@AAfghahi AAfghahi force-pushed the ch22095_clipboardIncorrectOrder branch from d28a78a to 0491d42 Compare August 19, 2021 15:42
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Aug 19, 2021
@AAfghahi AAfghahi force-pushed the ch22095_clipboardIncorrectOrder branch from 9774c97 to f6e8767 Compare August 19, 2021 23:18
@AAfghahi AAfghahi force-pushed the ch22095_clipboardIncorrectOrder branch from f6e8767 to 078816e Compare August 19, 2021 23:52
@junlincc
Copy link
Copy Markdown
Member

/testenv up

@github-actions
Copy link
Copy Markdown
Contributor

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

@betodealmeida betodealmeida merged commit 631ad02 into apache:master Aug 24, 2021
@github-actions
Copy link
Copy Markdown
Contributor

Ephemeral environment shutdown and build artifacts deleted.

amitmiran137 pushed a commit to nielsen-oss/superset that referenced this pull request Aug 26, 2021
* upstream/master: (25 commits)
  chore(ci): bump pylint to 2.10.2 (apache#16463)
  fix: prevent page crash when chart can't render (apache#16464)
  chore: fixed slack invite link (apache#16466)
  fix(native-filters): handle null values in value filter (apache#16460)
  feat: add function list to auto-complete to Clickhouse datasource (apache#16234)
  refactor(explore): improve typing for Dnd controls (apache#16362)
  fix(explore): update overwrite button on perm change (apache#16437)
  feat: Draggable and Resizable Modal (apache#16394)
  refactor: sql_json view endpoint (apache#16441)
  fix(dashboard): undo and redo buttons weird alignment  (apache#16417)
  fix: setupPlugin in chart list page (apache#16413)
  fix: Disable Slack notification method if no api token (apache#16367)
  feat: add Shillelagh DB engine spec (apache#16416)
  fix: copy to Clipboard order (apache#16299)
  docs: make FEATURE_FLAGS.md reference a link (apache#16415)
  chore(viz): bump superset-ui to 0.17.87 (apache#16420)
  feat: add activate command (apache#16404)
  Revert "fix(explore): let admin overwrite slice (apache#16290)" (apache#16408)
  fix(explore): retain chart ownership on query context update (apache#16419)
  chore: Removes the TODOs and uses the default page size (apache#16422)
  ...
@villebro villebro added the v1.3 label Sep 6, 2021
villebro pushed a commit that referenced this pull request Sep 6, 2021
* copy to Clipboard order

* centralized copyToClipboard

* fixed table order

* fixed tests

* added colnames to all viz types

* added colnames to all viz types

* added colnames to all viz types

(cherry picked from commit 631ad02)
@jinghua-qa
Copy link
Copy Markdown
Member

added test cases

opus-42 pushed a commit to opus-42/incubator-superset that referenced this pull request Nov 14, 2021
* copy to Clipboard order

* centralized copyToClipboard

* fixed table order

* fixed tests

* added colnames to all viz types

* added colnames to all viz types

* added colnames to all viz types
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 28, 2021
* copy to Clipboard order

* centralized copyToClipboard

* fixed table order

* fixed tests

* added colnames to all viz types

* added colnames to all viz types

* added colnames to all viz types
@mistercrunch mistercrunch added 🍒 1.3.1 Cherry-picked to 1.3.1 🍒 1.3.2 Cherry-picked to 1.3.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.4.0 First shipped in 1.4.0 labels Mar 13, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
* copy to Clipboard order

* centralized copyToClipboard

* fixed table order

* fixed tests

* added colnames to all viz types

* added colnames to all viz types

* added colnames to all viz types
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 size/L test:case v1.3 🍒 1.3.1 Cherry-picked to 1.3.1 🍒 1.3.2 Cherry-picked to 1.3.2 🚢 1.4.0 First shipped in 1.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants