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

fix: Making the database/cluster read-only #10823

Merged

Conversation

john-bodley
Copy link
Member

SUMMARY

This PR makes a few related consistency updates to ensure that the database/cluster et al. is read-only either in the FAB CRUD or React data editor. Note one could reason that you could potential make the schema, table, etc. read-only, though my sense is that is that could be somewhat controversial.

Specially this PR:

  1. For the React data editor makes the database read-only which is consistent with the FAB CRUD views.
  2. Moves the React data editor warning above the tabs, i.e., users should be aware that changing any fields (metrics, columns, etc.) will impact all charts using said datasource.
  3. For the Druid datasource CRUD view makes the cluster and datasource name read only. The cluster is akin to the database and thus this ensures consistency. Additionally the Druid datasource name is fixed hence this was also defined as read-only.

@dpgaspar I noticed that there seems to have been a regression in FAB and the read-only selector logic which we are using (per the documentation) no longer works. I've also verified this using the FAB examples and was wondering whether you could look into it?

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

Screen Shot 2020-09-09 at 4 43 44 PM

AFTER

Screen Shot 2020-09-09 at 4 28 33 PM

TEST PLAN

Tested locally.

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

@john-bodley john-bodley changed the title fix: Making the database read-only fix: Making the database/cluster read-only Sep 9, 2020
@john-bodley john-bodley requested a review from villebro September 9, 2020 23:46
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2020

Codecov Report

Merging #10823 into master will decrease coverage by 4.21%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10823      +/-   ##
==========================================
- Coverage   65.43%   61.21%   -4.22%     
==========================================
  Files         803      803              
  Lines       37930    37935       +5     
  Branches     3561     3561              
==========================================
- Hits        24818    23223    -1595     
- Misses      13008    14526    +1518     
- Partials      104      186      +82     
Flag Coverage Δ
#cypress ?
#javascript 61.59% <ø> (+<0.01%) ⬆️
#python 60.99% <77.77%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset-frontend/src/components/TableSelector.jsx 79.08% <ø> (-5.89%) ⬇️
...erset-frontend/src/datasource/DatasourceEditor.jsx 69.94% <ø> (-2.74%) ⬇️
superset/connectors/sqla/views.py 67.28% <ø> (ø)
superset/connectors/base/views.py 71.42% <66.66%> (-3.58%) ⬇️
superset/connectors/druid/views.py 69.79% <100.00%> (+0.41%) ⬆️
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
... and 161 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 c2216e0...368babf. Read the comment docs.

@john-bodley john-bodley force-pushed the john-bodley--database-read-only branch from 368babf to b00acd8 Compare September 9, 2020 23:59
@mistercrunch
Copy link
Member

related: #10731, I could add this logic into my PR

We're looking to deprecate the CRUD for tables soon-ish.

@@ -160,7 +160,7 @@ class TableColumnInlineView( # pylint: disable=too-many-ancestors
add_form_extra_fields = {
"table": QuerySelectField(
"Table",
query_factory=lambda: db.session().query(models.SqlaTable),
query_factory=lambda: db.session.query(models.SqlaTable),
Copy link
Member

Choose a reason for hiding this comment

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

nice catch!

"cluster": QuerySelectField(
"Cluster",
query_factory=lambda: db.session.query(models.DruidCluster),
widget=Select2Widget(extra_classes="readonly"),
Copy link
Member

Choose a reason for hiding this comment

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

I'll make a patch release for FAB to make the readonly work again
dpgaspar/Flask-AppBuilder#1467

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@john-bodley john-bodley merged commit a3e2e65 into apache:master Sep 10, 2020
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Sep 10, 2020
Co-authored-by: John Bodley <john.bodley@airbnb.com>
(cherry picked from commit a3e2e65)
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
Co-authored-by: John Bodley <john.bodley@airbnb.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.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 size/M 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants