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

[connectors] Make cluster/database and datasource/table read-only in views #7073

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Mar 20, 2019

In the CRUD views the cluster/database and datasource/table are required in the forms to ensure that either an added or edited entity is correctly assigned to the parent. This value is normally left blank however it does provide the ability for the user to re-assign (possibly without intent) an entity to another parent which is undesirable.

@mistercrunch ideally it would be great to simply hide these fields from the views, however this doesn't seem to be possible. The only viable solution I am aware of is simply to make the fields read-only per the suggestion outlined here.

Edit

Screen Shot 2019-03-20 at 11 18 55 AM
Screen Shot 2019-03-20 at 11 18 43 AM
Screen Shot 2019-03-20 at 11 20 39 AM

Add

Note for adding we allow blanks otherwise the default displayed value is ill-defined entity even though the entity is correctly parented.

Screen Shot 2019-03-20 at 11 28 43 AM

to: @graceguo-supercat @michellethomas @mistercrunch @xtinec

@john-bodley john-bodley force-pushed the john-bodley--connectors-views-hide-datasource-et-al branch 2 times, most recently from b94fd12 to db58bae Compare March 20, 2019 21:13
@john-bodley john-bodley force-pushed the john-bodley--connectors-views-hide-datasource-et-al branch from db58bae to ae13516 Compare March 20, 2019 23:45
@codecov-io
Copy link

Codecov Report

Merging #7073 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #7073      +/-   ##
=========================================
+ Coverage   64.48%   64.5%   +0.02%     
=========================================
  Files         421     421              
  Lines       20547   20561      +14     
  Branches     2250    2250              
=========================================
+ Hits        13249   13263      +14     
  Misses       7171    7171              
  Partials      127     127
Impacted Files Coverage Δ
superset/connectors/druid/views.py 67.74% <100%> (+1.52%) ⬆️
superset/connectors/sqla/views.py 65.28% <100%> (+2.13%) ⬆️

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 30f88ca...ae13516. Read the comment docs.

@mistercrunch
Copy link
Member

mistercrunch commented Mar 21, 2019

I struggled with this in the past, it seemed like an odd FAB requirement/bug. @dpgaspar may have some input/pointers as to how to fix this in FAB.

@dpgaspar
Copy link
Member

Hi @john-bodley, @mistercrunch

This seems to be nicely done. The readonly field gives some context to the users, and prevents mistakes.

I've removed the database field from the edit fields on TableModelView without problems.

The problem is with the related view CompactCRUDMixin on master detail (Table->Metrics or Table-Columns), showing a blank on the table field. This is working fine for the edit but seems strange when adding, right?

@mistercrunch
Copy link
Member

mistercrunch commented Mar 21, 2019

Personally all I remember is issues with the Inline elements on add and/or edit when the "parent" field is missing. In the example above it would be metrics and columns add/edit columns need to have the table field or they won't get attach to the table in their context.

Knowing it's an Inline, we probably should not even allow to alter the link to the parent. Maybe the form that's built needs some sort of HiddenField for table_id, and FAB should inject it somehow in the context of an inline. [this may or may not be the path to solution]

Keep in mind now that I think those are the last FAB Inline used in Superset, and we're moving away from this particular form as I've re-written the TableEditor in React.

Maybe the real action item here is deprecating the Superset CRUD view for Tables/DruidDatasource. For that, we need to build our own CRUD list view in place of the FAB one.

@dpgaspar
Copy link
Member

Yes, probably the best plan of action. My two cents would be to implement it using React components backed by the "new" CRUD REST API.

@kristw kristw added enhancement:request Enhancement request submitted by anyone from the community .database labels Mar 27, 2019
@john-bodley
Copy link
Member Author

@dpgaspar @mistercrunch is there any additional changes you are requesting from this PR?

@stale
Copy link

stale bot commented Jun 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Jun 8, 2019
Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

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

LGTM

@stale stale bot removed the inactive Inactive for >= 30 days label Jun 8, 2019
@john-bodley john-bodley merged commit c6179b1 into apache:master Jun 10, 2019
@john-bodley john-bodley deleted the john-bodley--connectors-views-hide-datasource-et-al branch June 10, 2019 17:25
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 19, 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 enhancement:request Enhancement request submitted by anyone from the community 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants