From 45c64dc31c7b9aec41f409f5548ab31816ceae5b Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Fri, 6 Sep 2024 18:22:06 -0700 Subject: [PATCH] webui: add support for jsonl/ndjson file diffing as text files This change follows the approach taken for other similar formats, allowing newline-delimited JSON files to be viewed and diffed in the LakeFS UI. Closes https://github.com/treeverse/lakeFS/issues/8094 --- webui/src/lib/components/repository/ObjectsDiff.jsx | 2 +- webui/src/pages/repositories/repository/fileRenderers/index.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/webui/src/lib/components/repository/ObjectsDiff.jsx b/webui/src/lib/components/repository/ObjectsDiff.jsx index 63dc60810f1..f17060185f9 100644 --- a/webui/src/lib/components/repository/ObjectsDiff.jsx +++ b/webui/src/lib/components/repository/ObjectsDiff.jsx @@ -9,7 +9,7 @@ import {InfoIcon} from "@primer/octicons-react"; import {useStorageConfig} from "../../hooks/storageConfig"; const maxDiffSizeBytes = 120 << 10; -const supportedReadableFormats = ["txt", "text", "csv", "tsv", "yaml", "yml", "json"]; +const supportedReadableFormats = ["txt", "text", "csv", "tsv", "yaml", "yml", "json", "jsonl", "ndjson"]; export const ObjectsDiff = ({diffType, repoId, leftRef, rightRef, path}) => { const config = useStorageConfig(); diff --git a/webui/src/pages/repositories/repository/fileRenderers/index.tsx b/webui/src/pages/repositories/repository/fileRenderers/index.tsx index b6045faa8f6..e7f7b5deed1 100644 --- a/webui/src/pages/repositories/repository/fileRenderers/index.tsx +++ b/webui/src/pages/repositories/repository/fileRenderers/index.tsx @@ -141,6 +141,8 @@ export function guessType(contentType: string | null, fileExtension: string | nu case 'yaml': case 'yml': case 'json': + case 'jsonl': + case 'ndjson': return FileType.TEXT } if (guessLanguage(fileExtension, contentType))