-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
chore: Changes the DatabaseSelector and TableSelector to use the new Select component #16334
chore: Changes the DatabaseSelector and TableSelector to use the new Select component #16334
Conversation
82d5770
to
f72be89
Compare
5ca149c
to
77825ed
Compare
Codecov Report
@@ Coverage Diff @@
## master #16334 +/- ##
==========================================
- Coverage 76.57% 76.55% -0.02%
==========================================
Files 1000 1000
Lines 53489 53479 -10
Branches 6816 6816
==========================================
- Hits 40957 40943 -14
- Misses 12296 12298 +2
- Partials 236 238 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
5306809
to
f465414
Compare
This now fixed on master as of #16369 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement! One last problem related to always force refreshing the data from the db, other than that looks great!
// The endpoint currently does not support pagination | ||
return SupersetClient.get({ endpoint }).then(({ json }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could potentially change this to a TODO:
if you have to push commits to the PR (would be nice to add pagination in a follow-up)
const encodedSchema = encodeURIComponent(dbSchema); | ||
const encodedSubstr = encodeURIComponent(search || 'undefined'); | ||
const endpoint = encodeURI( | ||
`/superset/tables/${currentDbId}/${encodedSchema}/${encodedSubstr}/true/`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also default to not force updating the metadata from the db
`/superset/tables/${currentDbId}/${encodedSchema}/${encodedSubstr}/true/`, | |
`/superset/tables/${currentDbId}/${encodedSchema}/${encodedSubstr}/false/`, |
} | ||
} | ||
|
||
function changeSchema(schemaOpt: any, force = false) { | ||
const value = schemaOpt ? schemaOpt.value : null; | ||
function onRefresh() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to add a force param here that the force refresh calls. Something like
function onRefresh(forceRefresh: boolean) {
const loadTable = useMemo( | ||
() => async (dbId: number, schema: string, tableName: string) => { | ||
const endpoint = encodeURI( | ||
`/superset/tables/${actualDbId}/${encodedSchema}/${encodedSubstr}/${!!forceRefresh}/`, | ||
`/superset/tables/${dbId}/${schema}/${encodeURIComponent( | ||
tableName, | ||
)}/true/true`, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will force table metadata to be refetched from the db as opposed to the cache. We should probably retain the forceRefresh
variable and pass it along here, like
const loadTable = useMemo(
() => async (dbId: number, schema: string, tableName: string, forceRefresh: boolean) => {
const endpoint = encodeURI(
`/superset/tables/${dbId}/${schema}/${encodeURIComponent(
tableName,
)}/${forceRefresh}/true`,
);```
f465414
to
00b99b5
Compare
@villebro I changed the |
/testenv up |
@michael-s-molina Ephemeral environment spinning up at http://52.32.213.248:8080. Credentials are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for all the hard work here!
Ephemeral environment shutdown and build artifacts deleted. |
* master: (582 commits) feat: config to customize bootstrap data overrides (apache#16386) fix: regex for multi-region IPs (apache#16410) chore: Changes the DatabaseSelector to use the new Select component (apache#16334) chore: Displays the dataset description in a tooltip in the datasets list (apache#16392) fix(pylint): Fix master (apache#16405) chore(pylint): Enable useless-suppression check (apache#16388) feat: Add extraVolumes and extraVolumeMounts to all main containers (apache#16361) initial commit (apache#16366) fix: big number default date format (apache#16383) initial commit (apache#16380) fix: import dashboard w/o metadata (apache#16360) test: Functional RTL for email report modal II (apache#16148) fix: update table ID in query context on chart import (apache#16374) docs: document FLASK_APP_MUTATOR (apache#16286) feat: Add new dev commands to Makefile (apache#16327) fix: call external metadata endpoint with correct rison object (apache#16369) fix: Fix parsing onSaving reports toast when user hasn't saved chart (apache#16330) fix: columns/index rebuild (apache#16355) chore(viz): bump deckgl plugin to 0.4.11 (apache#16353) fix: Blank space in Change dataset modal without warning message (apache#16324) ... # Conflicts: # superset/app.py # superset/models/dashboard.py # tests/integration_tests/charts/filter_sets/__init__.py # tests/integration_tests/charts/filter_sets/conftest.py # tests/integration_tests/charts/filter_sets/consts.py # tests/integration_tests/charts/filter_sets/create_api_tests.py # tests/integration_tests/charts/filter_sets/delete_api_tests.py # tests/integration_tests/charts/filter_sets/get_api_tests.py # tests/integration_tests/charts/filter_sets/update_api_tests.py # tests/integration_tests/charts/filter_sets/utils.py # tests/integration_tests/superset_test_config.py
database_name: string; | ||
backend: string; | ||
} | ||
| undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Michael, why is this set to undefined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think it's just a leftover from the whole refactoring. I touched so many files and this was probably a loose end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, sounds good.
* upstream/master: fix: create example DB if needed (apache#16451) fix(native-filters): add handle undefined control value gracefully (apache#16468) Revert "chore: Changes the DatabaseSelector to use the new Select component (apache#16334)" (apache#16478) fix(explore): JS error for creating new metrics from columns (apache#16477) fix: queryEditor bug (apache#16452) docs: make code snippet usable with required imports (apache#16473) perf(dashboard): decouple redux props from dashboard components (apache#16421) perf(dashboard): reduce number of rerenders of Charts (apache#16444)
…ponent (apache#16334)" (apache#16478) This reverts commit c768941. (cherry picked from commit 8adc31d)
…ponent (apache#16334)" (apache#16478) This reverts commit c768941.
…ponent (apache#16334)" (apache#16478) This reverts commit c768941.
SUMMARY
Changes the
DatabaseSelector
andTableSelector
to use the new Select component@junlincc @rusackas @villebro @jinghua-qa @rosemarie-chiu
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Screen.Recording.2021-08-18.at.5.13.22.PM.mov
Screen.Recording.2021-08-18.at.5.09.49.PM.mov
PS: There's an error that is also happening on master when we try to change the table of a saved dataset. It raises "An error has occurred". On the server logs, we can see a 401. @villebro This is not related to this PR but if it's something simple we can add the fix here.
TESTING INSTRUCTIONS
Check the videos for instructions.
ADDITIONAL INFORMATION