mathesar icon indicating copy to clipboard operation
mathesar copied to clipboard

Persist column widths via API

Open seancolsen opened this issue 1 year ago • 6 comments

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 a Column object is created
    • width field of the column settings objects has a default value of 20
  • 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.

seancolsen avatar May 31 '23 15:05 seancolsen

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.

github-actions[bot] avatar Aug 14 '23 21:08 github-actions[bot]

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.

github-actions[bot] avatar Sep 30 '23 21:09 github-actions[bot]

@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?

seancolsen avatar Oct 25 '23 15:10 seancolsen

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 avatar Oct 26 '23 12:10 silentninja

@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 avatar Oct 26 '23 17:10 seancolsen

@seancolsen I opened the PR for review. I would like you to review the PR and make sure the API is working as intended.

silentninja avatar Oct 26 '23 23:10 silentninja

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.

seancolsen avatar May 06 '24 14:05 seancolsen