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

fix(export vuln): change sheet name and download options name #417

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/__tests__/TagPage/VulnerabilitiesDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,13 @@ describe('Vulnerabilties page', () => {
fireEvent.click(downloadBtn[0]);
expect(await screen.findByTestId('export-csv-menuItem')).toBeInTheDocument();
expect(await screen.findByTestId('export-excel-menuItem')).toBeInTheDocument();
const exportAsCSVBtn = screen.getByText(/CSV/i);
const exportAsCSVBtn = screen.getByText(/csv/i);
expect(exportAsCSVBtn).toBeInTheDocument();
global.URL.createObjectURL = jest.fn();
await fireEvent.click(exportAsCSVBtn);
expect(await screen.findByTestId('export-csv-menuItem')).not.toBeInTheDocument();
fireEvent.click(downloadBtn[0]);
const exportAsExcelBtn = screen.getByText(/MS Excel/i);
const exportAsExcelBtn = screen.getByText(/xlsx/i);
expect(exportAsExcelBtn).toBeInTheDocument();
await fireEvent.click(exportAsExcelBtn);
expect(await screen.findByTestId('export-excel-menuItem')).not.toBeInTheDocument();
Expand Down
8 changes: 4 additions & 4 deletions src/components/Tag/Tabs/VulnerabilitiesDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const useStyles = makeStyles((theme) => ({
overflow: 'hidden',
padding: '0.3rem',
display: 'flex',
justifyContent: 'center'
justifyContent: 'left'
}
}));

Expand Down Expand Up @@ -195,7 +195,7 @@ function VulnerabilitiesDetails(props) {
const wb = XLSX.utils.book_new(),
ws = XLSX.utils.json_to_sheet(allCveData);

XLSX.utils.book_append_sheet(wb, ws, name + '_' + tag);
XLSX.utils.book_append_sheet(wb, ws, name.replaceAll('/', '_') + '_' + tag);

XLSX.writeFile(wb, `${name}:${tag}-vulnerabilities.xlsx`);

Expand Down Expand Up @@ -350,7 +350,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-csv-menuItem"
>
CSV
csv
</MenuItem>
<Divider sx={{ my: 0.5 }} />
<MenuItem
Expand All @@ -360,7 +360,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-excel-menuItem"
>
MS Excel
xlsx
</MenuItem>
</Menu>
</Stack>
Expand Down
Loading