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

Add ability to add table columns #540

Merged
merged 27 commits into from
Sep 28, 2021
Merged

Add ability to add table columns #540

merged 27 commits into from
Sep 28, 2021

Conversation

pegnott
Copy link
Contributor

@pegnott pegnott commented Aug 10, 2021

Fixes #495

This code adds functionality to create a new table column.
Resizing is in progress and coming soon

Technical details
Added addColumn function to TableData.ts to post to API
Added ui elements for column add in Header.svelte
Propagate events/data changes in TableView.svelte

Screenshots
New Add Column drop down UI:
image

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.

@kgodey kgodey requested a review from pavish August 10, 2021 14:42
Copy link
Member

@pavish pavish left a comment

Choose a reason for hiding this comment

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

Hey @pegnott, the add column functionality looks good! :)

I have some review comments, but most are minor and convention based.

mathesar_ui/src/sections/table-view/Header.scss Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/Header.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/Header.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/Header.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/Header.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/Header.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/sections/table-view/TableView.svelte Outdated Show resolved Hide resolved
mathesar_ui/src/stores/tableData.ts Outdated Show resolved Hide resolved
@pegnott pegnott marked this pull request as ready for review August 14, 2021 00:48
@pegnott pegnott requested review from a team and mathemancer August 14, 2021 00:48
mathesar_ui/src/components/moveable/Resizeable.svelte Outdated Show resolved Hide resolved
{#each columns.data as column, i (column.name)}
<div
bind:this={resizerRefs[i]}
on:mouseenter={(e) => showResizerForColumn(e, column)}
Copy link
Member

Choose a reason for hiding this comment

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

This changes the resizer instance from column to column.
Currently, this logic leads to errors and unexpected behaviour while trying to resize columns.

Issues with resizing columns - Watch Video

Screenshot 2021-08-17 at 12 58 04 AM

Once we have an action for the movable package, it might be better to:

  • create a separate column cell component, and handle the resizing logic within it.
  • save the column size while resizing instead of waiting until resize completes
  • create the resize instance on column component mount instead of during mouseover, and destroy the resize instance during component destroy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good afternoon. I have addressed the requested changes as follows:

mathesar_ui/src/stores/tableData.ts Outdated Show resolved Hide resolved
@pavish
Copy link
Member

pavish commented Aug 16, 2021

@pegnott The add column functionality looks good to me! Thanks!

Resizing columns do not seem stable. I have added a few review comments on it.

@pavish
Copy link
Member

pavish commented Aug 26, 2021

@pegnott, I'm testing column resizing in Firefox, and it still seems doesn't seem to be stable. Some of the previously mentioned issues in the video still persist. It is also breaking the grouping feature.

Since the resize feature is blocking the add column feature, I think it's best if we split them both up, as separate PRs.

Once they are separate PRs, we could merge the add column feature early, since there are other contributors working on columns and it may have a lot of conflicts if we wait longer.

The resize feature will need to be stabilized, and I assume it will take more rounds of review, and it is not an immediate priority.

@kgodey
Copy link
Contributor

kgodey commented Sep 6, 2021

@pavish @pegnott How do you want to handle splitting up this PR?

@pavish
Copy link
Member

pavish commented Sep 6, 2021

@kgodey @pegnott My suggestion would be to create a new branch from the last commit for 'adding a new column', and raise a PR from that branch.

I assume there weren't additional changes with respect to column addition, after starting work on column resizing feature. If there were, we could do them as new commits on top of the created branch.

@kgodey
Copy link
Contributor

kgodey commented Sep 7, 2021

@pegnott Would you be willing to create a new branch so that we can get the add column feature merged in as @pavish suggested?

@pegnott
Copy link
Contributor Author

pegnott commented Sep 8, 2021

Good evening - am looking at best strategy to split this PR up now, will follow up with any status/questions/etc.
Thanks

@pegnott pegnott changed the title Add ability to add and resize table columns Add ability to add table columns Sep 8, 2021
@pegnott
Copy link
Contributor Author

pegnott commented Sep 8, 2021

@pegnott Would you be willing to create a new branch so that we can get the add column feature merged in as @pavish suggested?

I have created a new branch and PR
branches are:

@kgodey
Copy link
Contributor

kgodey commented Sep 9, 2021

Thanks @pegnott!

@pavish pavish added the needs: unblocking Blocked by other work label Sep 10, 2021
@pavish pavish marked this pull request as draft September 10, 2021 08:17
@pavish
Copy link
Member

pavish commented Sep 10, 2021

@pegnott Thank you so much for splitting the PRs. This looks great!

I have approved the changes. I am currently half way through #651, which refactors a lot of areas this PR touches. I am blocking this PR, until that is merged.

Once the changes for the refactor is merged, I'll add an additional commit to this PR, and merge this.

@kgodey I hope this is okay.

@kgodey
Copy link
Contributor

kgodey commented Sep 10, 2021

@pavish that's fine, thanks for the update!

@pavish pavish removed the needs: unblocking Blocked by other work label Sep 20, 2021
@pavish pavish marked this pull request as ready for review September 28, 2021 09:20
@github-actions github-actions bot requested a review from pavish September 28, 2021 09:20
@pavish
Copy link
Member

pavish commented Sep 28, 2021

@kgodey I've added additional commits to handle merge conflicts with the refactor. I'm going to go ahead and merge this, since this was previously reviewed. Please feel free to add comments and we can take it up as separate issues.

@ghislaineguerin This functionality differs quite a bit from the UX. We will have to reevaluate this as well.

@pavish pavish merged commit 3fedc04 into mathesar-foundation:master Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Implement adding a new column
3 participants