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

Remove xlsx export from CLI's interactive tables #6439

Merged
merged 10 commits into from
May 21, 2024
95 changes: 0 additions & 95 deletions frontend-components/tables/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion frontend-components/tables/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"react-plotly.js": "^2.6.0",
"react-table": "^7.8.0",
"react-virtual": "^2.10.4",
"xlsx": "^0.18.5",
"xss": "^1.0.14"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions frontend-components/tables/src/components/Table/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ export default function Export({
case "csv":
downloadData("csv", columns, data, downloadFinished);
break;
case "xlsx":
downloadData("xlsx", columns, data, downloadFinished);
break;
case "png":
downloadImage("table", downloadFinished);
break;
Expand Down
2 changes: 1 addition & 1 deletion frontend-components/tables/src/components/Table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function getCellWidth(row, column) {
}
}

export const EXPORT_TYPES = ["csv", "xlsx", "png"];
export const EXPORT_TYPES = ["csv", "png"];
export default function Table({
data,
columns,
Expand Down
17 changes: 2 additions & 15 deletions frontend-components/tables/src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rankItem } from "@tanstack/match-sorter-utils";
import domtoimage from "dom-to-image";
import { utils, writeFile } from "xlsx";


export function formatNumberNoMagnitude(value: number | string) {
if (typeof value === "string") {
Expand Down Expand Up @@ -224,7 +224,7 @@ export const saveToFile = (
};

export async function downloadData(
type: "csv" | "xlsx",
type: "csv",
columns: any,
data: any,
downloadFinished: (changed: boolean) => void,
Expand Down Expand Up @@ -270,19 +270,6 @@ export async function downloadData(

return;
}

const wb = utils.book_new();
const ws = utils.aoa_to_sheet(csvData);
utils.book_append_sheet(wb, ws, "Sheet1");
await loadingOverlay("Saving XLSX");
non_blocking(async function () {
// @ts-ignore
// timeout to allow loading overlay to show
await new Promise((resolve) => setTimeout(resolve, 1500));
writeFile(wb, `${window.title}.xlsx`);
await loadingOverlay("", true);
downloadFinished?.(true);
}, 2)();
}

export async function downloadImage(
Expand Down
Loading