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: Add download csv button to people management #1369

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

marlonkeating
Copy link
Contributor

Jira Ticket

This change adds a button for downloading the filtered results of the people table on the People Management tab.

Testing Instructions

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 6 lines in your changes missing coverage. Please review.

Project coverage is 85.79%. Comparing base (383989c) to head (e611011).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...gement/data/hooks/useEnterpriseMembersTableData.js 20.00% 4 Missing ⚠️
.../components/PeopleManagement/DownloadCSVButton.jsx 92.30% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1369   +/-   ##
=======================================
  Coverage   85.79%   85.79%           
=======================================
  Files         609      610    +1     
  Lines       13384    13429   +45     
  Branches     2780     2784    +4     
=======================================
+ Hits        11483    11522   +39     
- Misses       1831     1837    +6     
  Partials       70       70           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kiram15 kiram15 self-requested a review January 2, 2025 22:44
Copy link
Contributor

@kiram15 kiram15 left a comment

Choose a reason for hiding this comment

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

Just a couple things but looks good!

src/components/PeopleManagement/DownloadCSVButton.jsx Outdated Show resolved Hide resolved
src/components/PeopleManagement/DownloadCSVButton.jsx Outdated Show resolved Hide resolved
src/components/PeopleManagement/DownloadCSVButton.jsx Outdated Show resolved Hide resolved
const expectedHeaders = ['Name', 'Email', 'Joined Organization', 'Enrollments'];
expect(downloadCsv).toHaveBeenCalledWith(expectedFileName, mockData.results, expectedHeaders, expect.any(Function));
});
it('download button should handle error returned by the API endpoint.', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add in a test for filtered results?

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 point! The DownloadCsvButton component doesn't have awareness of filters, and this would have to be tested at the level of the PeopleManagementPage. As of right now there are no unit tests for the table part of the PeopleManagementPage, and adding that I feel is a substantial enough task outside the scope of this change to address it as a separate ticket.

test: Add DownloadCsvButton unit test

refactor: move getTimeStampedFilename into utils
@marlonkeating marlonkeating merged commit fdc0a9a into master Jan 3, 2025
6 checks passed
@marlonkeating marlonkeating deleted the mkeating/ENT-9467 branch January 3, 2025 19:48
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.

2 participants