Skip to content

Conversation

@AAfghahi
Copy link
Member

@AAfghahi AAfghahi commented Feb 13, 2021

SUMMARY

Made Query Search into a functional component from a class component.

Added to package.json because I added userEvent.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen Shot 2021-02-13 at 1 18 46 AM

Only refreshesQueries when you press enter in the QuerySearch or press the enter key:
Screen Shot 2021-02-13 at 1 19 45 AM

TEST PLAN

I need to implement two more tests for checking when refreshQueries works.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

@AAfghahi AAfghahi force-pushed the querySearch branch 3 times, most recently from 492d934 to c9efdd2 Compare February 15, 2021 23:10
Copy link
Member

Choose a reason for hiding this comment

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

remove?

@eschutho
Copy link
Member

@AAfghahi just ping me when you need another look!

Copy link
Member

Choose a reason for hiding this comment

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

I see the issue here. You're saying that setDatabaseId and setUserId are called elsewhere and it would trigger the refreshQueries function as well. Yeah, looks like what you have is the best bet. good catch on that.

@AAfghahi AAfghahi force-pushed the querySearch branch 5 times, most recently from 28033e9 to 554f481 Compare February 24, 2021 22:12
@codecov
Copy link

codecov bot commented Feb 26, 2021

Codecov Report

Merging #13102 (0ec95d2) into master (892eef1) will decrease coverage by 3.91%.
The diff coverage is 72.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13102      +/-   ##
==========================================
- Coverage   77.05%   73.14%   -3.92%     
==========================================
  Files         897      599     -298     
  Lines       45710    21135   -24575     
  Branches     5497     5406      -91     
==========================================
- Hits        35224    15460   -19764     
+ Misses      10362     5549    -4813     
- Partials      124      126       +2     
Flag Coverage Δ
cypress 58.00% <56.40%> (+0.40%) ⬆️
hive ?
javascript 62.94% <56.91%> (+0.45%) ⬆️
mysql ?
postgres ?
presto ?
python ?
sqlite ?

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

Impacted Files Coverage Δ
superset-frontend/src/chart/ChartContainer.jsx 100.00% <ø> (ø)
superset-frontend/src/chart/ChartRenderer.jsx 76.00% <0.00%> (-1.03%) ⬇️
...rset-frontend/src/components/ButtonGroup/index.tsx 100.00% <ø> (ø)
...et-frontend/src/components/ErrorBoundary/index.jsx 95.45% <ø> (ø)
...perset-frontend/src/components/FormLabel/index.tsx 100.00% <ø> (ø)
...-frontend/src/components/Select/Select.stories.tsx 0.00% <0.00%> (ø)
superset-frontend/src/components/Select/Select.tsx 90.81% <ø> (ø)
superset-frontend/src/components/Select/styles.tsx 86.30% <ø> (ø)
...et-frontend/src/components/Timer/Timer.stories.tsx 0.00% <0.00%> (ø)
superset-frontend/src/components/Timer/index.tsx 95.83% <ø> (ø)
... and 372 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 892eef1...93e3a59. Read the comment docs.

@eschutho
Copy link
Member

@AAfghahi you can remove the package-lock.json file since you don't have a package.json update.

Copy link
Member

Choose a reason for hiding this comment

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

prob don't need this async here/no await

Copy link
Member Author

Choose a reason for hiding this comment

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

you don't need it for the test to pass, but without them the console throws a console warning and tells you to do it.

Copy link
Member

Choose a reason for hiding this comment

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

we usually call name these in TS with the name of the component, i.e., QuerySearchProps

Copy link
Member

Choose a reason for hiding this comment

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

can we be more specific on the type? string or number?

Copy link
Member

Choose a reason for hiding this comment

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

array type?

Copy link
Member Author

Choose a reason for hiding this comment

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

So, this one is a bit wonky because the queriesArray is actually taking in a json object that it puts in is an object. I went through some iteration where i was parsing through the json object you receive and pushing it into the empty array, but it wasn't rendering the table.

My issue here was that I can create an object prop and then put it in there, but then that would need me to also create aa prop object for the useState (though I could potentially use null, now that I am thinking about it?).

Copy link
Member

Choose a reason for hiding this comment

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

this looks great. I think you can remove the comment?

Copy link
Member

Choose a reason for hiding this comment

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

you can name this response. It looks like it's returning an object rather than a promise.

Copy link
Member

Choose a reason for hiding this comment

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

I think React.KeyboardEvent will work

Copy link
Member

Choose a reason for hiding this comment

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

React.ChangeEvent

Copy link
Member

Choose a reason for hiding this comment

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

what does this do?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh! Yeah this is totally because of the debouncer. Apparently when you have a debouncer in hooks the event.target.value gets lost, so you have to tell it to persist the value. Without this formatting you could type something into the search bar, and it would show up on the screen but it wouldn't actually search for it. Kind of wild.

Copy link
Member

Choose a reason for hiding this comment

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

you can also put the debounce where you call onChange below, so
onChange={debounce(onChange, 200)}

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried this, but ran into the same problem as above.

Copy link
Member

Choose a reason for hiding this comment

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

ok, we can loop back to this another time.

Copy link
Member

Choose a reason for hiding this comment

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

let's try to define something here rather than any

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah this bothered me too, and I looked through it is, is there a way to set up an object type without having to go through and create all the props for the object? Looking through the typescript documentation it didn't seem that there was.

Copy link
Member

Choose a reason for hiding this comment

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

same thing on any

Copy link
Member

Choose a reason for hiding this comment

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

nit, but you might as well destructure id and database_name in the arg list.

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

looking great. I just left some ts feedback!

@AAfghahi
Copy link
Member Author

@AAfghahi you can remove the package-lock.json file since you don't have a package.json update.
How do I do that? Is this a rebase or git merge master? Becuase I've tried both and this still persists.

Copy link
Member

@eschutho eschutho left a comment

Choose a reason for hiding this comment

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

Thanks @AAfghahi. I think we're ready!

@eschutho
Copy link
Member

eschutho commented Mar 3, 2021

🏷 ready-to-merge

@superset-github-bot superset-github-bot bot added the need:merge The PR is ready to be merged label Mar 3, 2021
@hughhhh hughhhh self-requested a review March 3, 2021 15:17
@hughhhh hughhhh merged commit 66a7318 into apache:master Mar 3, 2021
@hughhhh hughhhh deleted the querySearch branch March 3, 2021 15:18
allanco91 pushed a commit to allanco91/superset that referenced this pull request May 21, 2021
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.2.0 First shipped in 1.2.0 labels Mar 12, 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 need:merge The PR is ready to be merged preset-io size/XL 🚢 1.2.0 First shipped in 1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants