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

Finish implementing EntityUpload except for warnings #961

Merged
merged 29 commits into from
Apr 19, 2024

Conversation

matthew-white
Copy link
Member

@matthew-white matthew-white commented Mar 18, 2024

Closes getodk/central#589.

What has been done to verify that this works as intended?

This PR includes some changes to tests, but mostly I've just been doing manual testing locally. The QA team will also be taking a look at this PR. I'll be adding more tests as part of #979.

Before submitting this PR, please make sure you have:

  • run npm run test and npm run lint and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

@matthew-white matthew-white requested a review from ktuite March 18, 2024 23:15
@matthew-white matthew-white marked this pull request as draft March 19, 2024 22:26
@matthew-white matthew-white changed the title Add tables to EntityUpload Finish implementing EntityUpload Mar 19, 2024
@matthew-white matthew-white marked this pull request as ready for review April 16, 2024 22:12
Copy link
Member Author

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

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

Notes from interactive code review

src/components/pagination.vue Outdated Show resolved Hide resolved
// no height to use.
let previousHeight = 0;
watch(
[() => props.entities, () => props.pageSize],
Copy link
Member Author

@matthew-white matthew-white Apr 16, 2024

Choose a reason for hiding this comment

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

props.pageSize can change before props.entities, not just concurrently. After the user makes a selection, props.pageSize changes pretty much immediately, but for the first table, props.entities lags behind it: it only changes after the response. That's a problem, because changing props.pageSize will reset minHeight above, yet we don't want to do that while the request is in progress. We should probably watch just props.entities, not props.pageSize.

Let's make sure to add a test for this case.

Copy link
Member Author

Choose a reason for hiding this comment

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

This issue is now being tracked at getodk/central#655.

const resizeLastColumn = () => {
// Undo previous resizing.
const th = container.value.querySelector('th:last-child');
th.style.width = '';
Copy link
Member Author

@matthew-white matthew-white Apr 16, 2024

Choose a reason for hiding this comment

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

I think there's an issue with the approach here:

  • Use an entity list with enough properties that the tables scroll horizontally.
  • Cause the file pop-up to overlap the second table, e.g., by increasing the page size of the first table. Doing so will cause the last column to widen.
  • Scroll all the way to the right of the second table.
  • Cause a change in the modal body that doesn't change the conditions above, e.g., go to the next page of a table.
  • Observe that the scroll position of the second table has changed: it is no longer at the end (all the way to the right).

Copy link
Member Author

Choose a reason for hiding this comment

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

This issue is now being tracked at getodk/central#655.

test/components/modal.spec.js Outdated Show resolved Hide resolved
src/components/entity/upload.vue Outdated Show resolved Hide resolved
src/components/entity/upload.vue Outdated Show resolved Hide resolved
test/components/entity/upload.spec.js Show resolved Hide resolved
test/components/entity/upload.spec.js Outdated Show resolved Hide resolved
);

const overlapsPopup = ref(false);
const resizeLastColumn = () => {
Copy link
Member Author

@matthew-white matthew-white Apr 19, 2024

Choose a reason for hiding this comment

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

I'm seeing an issue that may have to do with this function:

  1. Set up the modal such that when a file is selected, the pop-up will overlap the second table. For example, select a larger page size for the first table.
  2. (Not sure whether this matters:) Use an entity with fewer properties, such that the tables don't scroll horizontally, and the last column ends up being wider than the other columns.
  3. Select a file. Notice that a scrollbar appears below the second table. Once the animation ends, the scrollbar disappears again. A scrollbar should never appear.
    • Maybe another variable is the width of the viewport?

Are we definitely waiting for the animation to end before calling this function?

  • Is popupAnimating.value set before resizeColumnUnlessAnimating() is called? Is the animationstart event fired in time?
  • What if we don't listen for animationstart and instead set popupAnimating.value to true at the end of selectFile()?

Copy link
Member Author

Choose a reason for hiding this comment

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

This issue can actually be seen in the forum announcement for v2024.1: https://forum.getodk.org/t/odk-central-v2024-1-add-entities-by-uploading-a-csv/46616. You can see that a scrollbar appears below the second table during the animation.

This issue is now being tracked at getodk/central#655.

@matthew-white
Copy link
Member Author

matthew-white commented Apr 19, 2024

I've pushed a commit that resolves some, but not all of the comments above. Most of the comments that I didn't resolve are a bit fiddly. I don't think they need to be resolved before regression testing begins. I'm going to go ahead and merge this PR, then follow up with another PR later to resolve the remaining comments. These are the comments that are currently remaining:

@matthew-white matthew-white merged commit 095baec into master Apr 19, 2024
1 check passed
@matthew-white matthew-white deleted the upload-tables branch April 19, 2024 19:54
@matthew-white matthew-white changed the title Finish implementing EntityUpload Finish implementing EntityUpload except for warnings Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add additional Entities to an Entity List by uploading a spreadsheet
2 participants