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

CSV download include selected or all columns #552 #595

Closed
wants to merge 4 commits into from

Conversation

vishalmaurya850
Copy link

Added the download CSV for selected and All PR's

Linked Issue(s)

Issue No. #552

Acceptance Criteria

When I hit 'Download CSV', I get a csv with either
a) the columns currently configured
or
b) all possible columns

Added the download CSV for selected and All PR's
npm install file-saver
@CLAassistant
Copy link

CLAassistant commented Oct 16, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@jayantbh jayantbh left a comment

Choose a reason for hiding this comment

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

I think you can you can just include all the columns by default instead of actually respecting the current column selections.

Someone who's analyzing the whole thing can filter our/hide specific columns in their spreadsheet, but the current implementation requires them to manually change the column selection to include everything.

Additionally, please share screenshots/screen recordings for visual changes. :)

@jayantbh
Copy link
Contributor

@vishalmaurya850 I see you've requested a review, but I don't see any changes since my last review.

@vishalmaurya850
Copy link
Author

It was by mistake, give me some time

Created CSV headers dynamically and also created a blob and trigger download and mapped the columnHeaders dynamically
@vishalmaurya850
Copy link
Author

Please review the changes

Copy link
Contributor

@jayantbh jayantbh left a comment

Choose a reason for hiding this comment

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

Definitely needs tests.

Comment on lines +130 to +141
{/* Map through the columnHeaders object to dynamically generate table headers */}
{Object.entries(columnHeaders).map(([key, label]) => (
<TableCell key={key} sx={{ minWidth: '40%', p: CELL_PAD, py: 1.5 }}>
<TableSortLabel
direction={conf.field === 'commits' ? conf.order : 'asc'}
active={conf.field === 'commits'}
onClick={() => updateSortConf('commits')}
direction={conf.field === key ? conf.order : 'asc'}
active={conf.field === key}
onClick={() => updateSortConf(key as keyof PR)}
>
Commits
{label}
</TableSortLabel>
</TableCell>
)}
))}
Copy link
Contributor

Choose a reason for hiding this comment

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

While this is concise, this makes the order of the column headers susceptible to unexpected change.

The order of object also appears to not be guaranteed to the order of insertion:
https://stackoverflow.com/a/5525820

You may use a Map.
Regardless, it still doesn't account for the fact that not every header had the exact same styling properties. Some had a minWidth, some had no styling, some had nowrap, some had centered alignment.

This combined with a lack of screenshots, and a lack of tests, makes me think you didn't actually properly test this PR at all.

In think for your purposes, the simplest overall change would be to use the property names (like created_at) as headers instead of using formatted names (like Created At). That way, you retain the type safety without touching any of the existing code.

Copy link
Contributor

@jayantbh jayantbh left a comment

Choose a reason for hiding this comment

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

My last review was supposed to request changes.

@jayantbh
Copy link
Contributor

Hey @vishalmaurya850, still looking into it?

@vishalmaurya850
Copy link
Author

No i am done with it

@jayantbh jayantbh closed this Nov 1, 2024
@vishalmaurya850
Copy link
Author

I am unable to understand what the issue is because what you are telling is already in the code of middleware and I understood middleware is downloading the csv files perfectly

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.

3 participants