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

feat: edit/create rows from tables interactive content widget #952

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

elzody
Copy link
Contributor

@elzody elzody commented Mar 25, 2024

Issue(s)

Fixes #879

Overview

If a user has the ability to create/edit rows on a table/view, the user can also do so from the interactive table widget. The same "create row" button is used, as well as the "edit row" action button when hovering over a row. I made some edits to other components to better support this feature, such as dynamic importing of store.js and data.js and styling of the CreateRow.vue and EditRow.vue components (mostly from within ContentReferenceWidget.vue so as to not alter the original components elsewhere).

@elzody elzody added enhancement New feature or request 3. to review Waiting for reviews labels Mar 25, 2024
@juliushaertl

This comment was marked as resolved.

@enjeck

This comment was marked as outdated.

juliushaertl

This comment was marked as resolved.

@juliushaertl
Copy link
Member

juliushaertl commented Mar 28, 2024

Might be a dumb question, but what is the "interactive content widget"? Is that what pops up when I use the smartpicker?
I ask because I have no idea how to view what this PR changes 😅

When you open the smart picker and insert a table you will first see a custom picker element which is unrelated to the PR but just for understanding. The widgets then define the rendering of a preview for a link inserted through the smart picker or manually. We already have those widgets for a while but now make them more interactive by adding the ability to create/edit rows directly from the link preview widget. Hope that makes it a bit clearer :)

In short, to test it use the smart picker to insert a table link with content preview in a text document and toggle the preview on.

@elzody elzody force-pushed the feat/widget-create-edit-rows branch from a68d8e3 to ae17ca0 Compare April 5, 2024 19:23

This comment was marked as off-topic.

@elzody elzody force-pushed the feat/widget-create-edit-rows branch 2 times, most recently from d7f58ac to 110a7b7 Compare April 10, 2024 19:48
max-nextcloud

This comment was marked as resolved.

@max-nextcloud max-nextcloud self-assigned this Apr 23, 2024
webpack.config.js Outdated Show resolved Hide resolved
@elzody elzody force-pushed the feat/widget-create-edit-rows branch from 4471239 to 6501024 Compare May 8, 2024 15:26
@elzody elzody force-pushed the feat/widget-create-edit-rows branch 3 times, most recently from 0adbdc8 to 44e3745 Compare May 28, 2024 18:31
@elzody elzody force-pushed the feat/widget-create-edit-rows branch from 0ac0602 to 6fe5ae4 Compare May 31, 2024 17:31
@elzody elzody marked this pull request as draft May 31, 2024 17:35
@elzody elzody force-pushed the feat/widget-create-edit-rows branch 2 times, most recently from eae0c48 to 6fd1a08 Compare June 3, 2024 14:09
@elzody elzody marked this pull request as ready for review June 3, 2024 14:10
@elzody
Copy link
Contributor Author

elzody commented Jun 3, 2024

I don't think the failing Cypress tests are related, they are also failing on main it seems. Unsure what caused it 😔

Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

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

I tested it in Collectives and faced some issues:

  • In document editors with limited width (670px per default in Text and Collectives) the styling looks a bit off when scrolling completely to the right. See screenshot below.

    • There's a big padding right to the table that allows scrolling further than required.
    • the most right column (with the edit buttons) doesn't have a visible border to the right, but the line that splits heading rows from content rows extends over this most right column. grafik
  • I'm able to edit the table in place, but when I reload the page afterwards, my changes are gone. Both changed to existing columns and added new columns. I see a PUT request to the tables app when saving changes in the widget, but for some reason it's not persisted.

  • In read-only mode I'm still able to edit the table in place, this is unexpected. Maybe it's better to display the non-interactive version there?

I don't know the code base well enough to fully understand each line of code change, but changes look sensible to me.

@elzody
Copy link
Contributor Author

elzody commented Jun 5, 2024

@mejo- Thanks for bringing these up. A lot of the styling issues were present before I even started; I tried to fix some up as best I could, but there are definitely still some present. I will look at it some more

@elzody elzody force-pushed the feat/widget-create-edit-rows branch from 50128be to 5a5bc4c Compare June 6, 2024 18:39
@elzody
Copy link
Contributor Author

elzody commented Jun 6, 2024

I made some styling changes which I think make the widget look better than before. Specifically, I made the following changes:

  • The table headers for the rich text editor fields were misaligned, because the action button does not have any available actions due to it being a widget and less sophisticated than opening the actual table. I made it so that the spot where the action button goes will always take up a 44px * 44px space, aligning it with the other headers. This was the only way I knew how to do it after thinking on it for several hours; flexbox was NOT working properly there.
  • The extra space off to the right of the table was caused by the pagination footer, so I adjusted the space it takes up when rendered in a widget like this. It no longer takes up extra space, that I can see anyway.
  • There was some transparent space in the widget header off to the right, which has been fixed now by adding an element to group the table title and options row. They also stick properly now to the top.

The other things that you mentioned were not reproducible on my end. I tried the following:

  • When I add or edit a row, it is reflected immediately in the widget. If I reload normally, the changes are still there, as well as in the tables app. This also goes for a hard reload of the page.
  • I tested the permissions thing briefly, by sharing it with a non-admin account without write/update permissions for the table. At first, the buttons were still there, but after submitting the new/altered content, an error popped up stating I did not have sufficient permissions to update the table. When I did a hard reload on the page, the buttons disappeared. My guess is the browser caches the JS related to this, but not sure about it yet.

Maybe it would be worth it to expand the tests a bit to check for the read-only permissions or something? Also, I rebased onto main and resolved a small merge conflict.

@mejo-

@elzody elzody requested a review from mejo- June 6, 2024 18:49
@elzody elzody self-assigned this Jun 7, 2024
@juliushaertl
Copy link
Member

Pushed a small backend commit to ensure that the rich text fields are properly rendered, otherwise 👍

Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

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

Thanks @elzody.

The CSS/style fixes look great, much better now 👌

Regarding the problems with editing from Collectives, it's still the same:

  • Editing is possible in edit mode, and it alters the table. When I open the table in the Tables app afterwards, the changes are visible. But for some reason, after reloading the collectives page, the old state of the table before the change is displayed.
  • Editing in view mode is still possible. When switching to view mode in Collectives, all the buttons to edit the table in place are still there, and when editing the table the changes are pushed to the server.

I recorded a screencast to make more clear what I mean:

Screencast
recording1

elzody and others added 8 commits June 24, 2024 15:21
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: set store in widget

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: properly access store to create new row

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: search functionality

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: row reactivity

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

feat: add component testing skeleton files

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

test: start component testing for content reference widget

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: point package.json scripts to webpack.config.js

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix(test): properly mount component

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix(test): use default options and mix in given mount options

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix(tests): add styles for components

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

refactor(tests): move richObject to fixture

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

test: verify table title after mounting component

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

test: test searching in widget

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

refactor(tests): organize mount test

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: resolve pagination issues

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: change viewport dimensions in cypress config

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix: refine row selector

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

feat: create and edit rows from tables interactive widget

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix(css): edit row delete & save buttons

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>

fix(css): fullscreen rich text edit

Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
@elzody elzody force-pushed the feat/widget-create-edit-rows branch from c813449 to d124ed1 Compare June 24, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request feedback-requested
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

Interactive widget: Create and edit rows
5 participants