mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
requested changes
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
/**
|
||||
* Converts a JSON array of objects to CSV format
|
||||
* @param {Array} jsonData - Array of objects to convert
|
||||
* @param {string} filename - Name of the file to download (without extension)
|
||||
*/
|
||||
export const convertJsonToCsv = (jsonData: Record<string, string | number | boolean>[]) => {
|
||||
// Get headers from the first object
|
||||
|
||||
if (jsonData.length === 0) {
|
||||
return new Blob([""], { type: "text/csv;charset=utf-8;" });
|
||||
}
|
||||
@@ -14,24 +11,19 @@ export const convertJsonToCsv = (jsonData: Record<string, string | number | bool
|
||||
|
||||
const csvRows = [
|
||||
headers.join(","),
|
||||
// Add all data rows
|
||||
...jsonData.map((row) => {
|
||||
return headers
|
||||
.map((header) => {
|
||||
// Handle special cases in the data
|
||||
let cell = row[header];
|
||||
|
||||
// Convert null/undefined to empty string
|
||||
if (cell === null || cell === undefined) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Handle normal values
|
||||
if (typeof cell === "number" || typeof cell === "boolean") {
|
||||
return cell;
|
||||
}
|
||||
|
||||
// Convert objects/arrays to JSON string
|
||||
if (typeof cell === "object") {
|
||||
cell = JSON.stringify(cell);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const SecretScanningPage = withPermission(
|
||||
() => {
|
||||
const queryParams = useSearch({
|
||||
from: ROUTE_PATHS.Organization.SecretScanning.id
|
||||
}) as Record<string, string>;
|
||||
});
|
||||
|
||||
const { config } = useServerConfig();
|
||||
const { currentOrg } = useOrganization();
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import { createFileRoute /* stripSearchParams */ } from "@tanstack/react-router";
|
||||
import { createFileRoute, stripSearchParams } from "@tanstack/react-router";
|
||||
import { zodValidator } from "@tanstack/zod-adapter";
|
||||
import { z } from "zod";
|
||||
|
||||
// import { zodValidator } from "@tanstack/zod-adapter";
|
||||
// import { z } from "zod";
|
||||
import { SecretScanningPage } from "./SecretScanningPage";
|
||||
|
||||
// const SecretScanningQueryParams = z.object({
|
||||
// state: z.string().catch(""),
|
||||
// installation_id: z.string().catch("")
|
||||
// });
|
||||
const SecretScanningQueryParams = z.object({
|
||||
state: z.string().catch(""),
|
||||
installation_id: z.coerce.number().optional()
|
||||
});
|
||||
|
||||
export const Route = createFileRoute(
|
||||
"/_authenticate/_inject-org-details/organization/_layout/secret-scanning"
|
||||
)({
|
||||
component: SecretScanningPage
|
||||
// validateSearch: zodValidator(SecretScanningQueryParams),
|
||||
// search: {
|
||||
// middlewares: [
|
||||
// stripSearchParams({
|
||||
// installation_id: "",
|
||||
// state: ""
|
||||
// })
|
||||
// ]
|
||||
// }
|
||||
component: SecretScanningPage,
|
||||
validateSearch: zodValidator(SecretScanningQueryParams),
|
||||
search: {
|
||||
middlewares: [
|
||||
stripSearchParams({
|
||||
installation_id: 0,
|
||||
state: ""
|
||||
})
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user