mathesar
mathesar copied to clipboard
Persist column widths via API
Fixes #1421
The PR adds introduces new API /api/ui/v0/tables/{table_id}/columns/{column_id}/settings/
.
Specs
Users read/write the settings via the API.
/api/ui/v0/tables/{table_id}/columns/{column_id}/settings/
-
GET response:
{ "width": 20 // defaults to 20 }
-
Defaults
- A
ColumnSetting
object is automatically created when aColumn
object is created -
width
field of the columnsettings
objects has a default value of 20
- A
-
PATCH request
{ "width": 20 }
-
Same schema as GET response
-
Just like any other
PATCH
request, the request body can contain only the fields that need to be updated and the backend will update the specified fields and won't affect other field values.
/api/v0/tables/<id>/columns/
{
// other column API fields go here
"settings":
{
"width": 20
}
}
Checklist
- [x] My pull request has a descriptive title (not a vague title like
Update index.md
). - [x] My pull request targets the
develop
branch of the repository - [x] My commit messages follow best practices.
- [x] My code follows the established code style of the repository.
- [x] I added tests for the changes I made (if applicable).
- [x] I added or updated documentation (if applicable).
- [x] I tried running the project locally and verified that there are no visible errors.
Developer Certificate of Origin
Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
This pull request has not been updated in 45 days and is being marked as stale. It will automatically be closed in 30 days if not updated by then.
This pull request has not been updated in 45 days and is being marked as stale. It will automatically be closed in 30 days if not updated by then.
@silentninja Can you post a brief summary of the status of this PR and what you see as the remaining steps to bring this work to completion?
The PR currently contains only the backend API changes necessary for persisting column width. We still need to add the frontend changes for storing column width to this PR in order to close #1421
@silentninja I made some adjustments to the tickets:
- #1421, which is "Fixed" by this PR was previously scoped to cover front end and back end changes. I de-scoped that ticket so that it is focused only on back end changes.
- I added #3263 to cover the front end changes
- I added #3262 as a meta ticket to encapsulated changes across the stack.
Given the manner in which the tickets are now organized, do you think we could move this PR out of draft state? From your previous comment, it sounds like the back end changes might be ready for review. Yes?
@seancolsen I opened the PR for review. I would like you to review the PR and make sure the API is working as intended.
I'm closing this because I think enough has changed (and will have changed) that we'll be better off starting from scratch when we decide to pick this up again.