-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
UI for adding multi-column unique constraints #1005
Conversation
3b62716
to
d9e25c1
Compare
Codecov Report
@@ Coverage Diff @@
## 497_rename_column_b #1005 +/- ##
====================================================
Coverage 93.27% 93.27%
====================================================
Files 95 95
Lines 3463 3463
====================================================
Hits 3230 3230
Misses 233 233
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
@pavish this is ready for review now. @ghislaineguerin I'd also like you to look at this, since the UX is different than what we initially discussed. I explain a bit about this divergence in the "Demo 2" video. The direction I'm going here is to display multiple modals on top of each other. Pavish and I chatted a bit about this approach on a call. He expressed some reservations about it but figured it would be worth exploring. Pavish, we initially talked about hiding the lower modal in some cases when the upper modal is displaying. After giving this some more thought I decided to always show the lower modal. For one thing it's simpler to implement. But also I prefer it from a UX perspective too. I think that placing the lower modal under the overlay sufficiently communicates the UI state to the user, making it clear that they can only interact with the top-most modal. It also adds additional clarity that the steps they took within the lower modal have persisted. |
@seancolsen, your video provides a reasonable explanation for taking this approach. I don't feel that the modal on top of the modal is bad. If they are different enough, as you describe, it makes sense to overlap them. |
I'm not the biggest fan of the double modal UX, but I think it's fine for now. I think in the long run, perhaps we should show table constraints in a separate pane or page rather than a modal. Then we can have deletion confirmation etc. be a modal without the double modals. |
Yeah I think that's definitely worth considering. We could also consider separating the DDL and DML operations for each table into separate tabs. Many DB GUIs I've worked with behave this way. You get one tab that lists all the columns, constraints, indexes, allowing you to add/update/delete those things. Then separately there's a different tab which lists all the rows in the table. Right now that's not super easy to do without some refactoring to the tabs system. I think it's definitely worth trying to avoid multiple modals and we should be keeping this in mind going forward. If we're inclined to put something in a modal we should always be asking "is there anything the user might want to do inside this modal that would require another modal?". |
I think in Mathesar's use case, we could tuck DML operations into a separate page. I think users will be using Mathesar for DDL far more often than DML. We can figure out a good pattern for this when we start working on the Data Modeling milestone cc @ghislaineguerin.
Agreed, also cc @ghislaineguerin. |
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.
@seancolsen The PR looks good to me.
I do have my reservations of allowing opening multiple modals but I think we can come back to this after our alpha release. The discussion on this PR regarding a separate page for DML operations makes sense to me.
There are some action items:
- Update this PR to resolve merge conflicts.
- Stack this PR on top of Implement renaming a column #976. I'd like to merge Implement renaming a column #976 first.
- The
Form
andFormField
components focus on composing forms using slots, whereas theform-builder
component focuses on generating a form using a json config. Even though there is a clear different in usecase, they share the same component name and css classes. I'd like to avoid that. I think it makes more sense to keep the names of these components the same. I'll change the names of form-builder components as part of Type configuration for Text, Number, Boolean, and all mathesar types with single associated db type #926
Update:
The changes for 3 is done in deec945...45029a1.
Fixes #531
Demos
Changes
Modify table constraints dialog to allow users to add new unique constraints.
Allow multiple modals to display at once -- so that we can display the form for adding a new unique constraint on top of the modal which displays all constraints.
Change the UI for confirming the deletion of a constraint to use our modal confirmation system instead of the inline sliding confirmation. This reduces code complexity and leads to a more consistent UI.
Split
Modal
component intoIndependentModal
-- a simple base component for use-cases where we don't have a controller. (In Mathesar, I don't think we'll ever want to use this component, but people using the component library might.)ControlledModal
-- a higher-level component that composesIndependentModal
and requires aModalController
Refactor
AddEditSchema
andRenameTableModal
into simpler components that both composeModalTextInputForm
(a new component) to reduce code duplication and ensure consistent UI.Review tips
Issues
The
Form
andFormField
components (which exist only for styling) might overlap a bit with the form-builder system in terms of intended purpose. I haven't yet looked into this more deeply.Modal z index stacking is very primitive at the moment. All modals have the same z index, which means they are layered in the order in which they are first opened. Technically, this could lead to bugs, but it's a little hard to imagine a real-world scenario that would trigger the bug. You'd need to begin with no modals, then open modal A, then open modal B, then re-open modal A again (even though it's already open). At that point, you'd expect modal A to be re-layered on top of modal B, but due to its z-index being identical to modal B it would remain on bottom. The data structure already supports this re-layering correctly. It would just be a little extra work to set the z-index based on the stacking order we're storing. That's totally feasible. I just haven't yet taken the time to do it. We could take that up later if this whole multi-modal approach actually seems viable.
Checklist
Update index.md
).master
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin