From aecc37a80f66d6a1b9d3a16de00119a1db19fc14 Mon Sep 17 00:00:00 2001 From: Aaron Taylor Date: Wed, 2 Oct 2024 01:46:34 -0700 Subject: [PATCH] webui: add support for jsonl/ndjson file diffing as text files (#8136) 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 dc41c1bcfa1..72132c746d2 100644 --- a/webui/src/lib/components/repository/ObjectsDiff.jsx +++ b/webui/src/lib/components/repository/ObjectsDiff.jsx @@ -10,7 +10,7 @@ import {useStorageConfig} from "../../hooks/storageConfig"; import {AppContext} from "../../hooks/appContext"; 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))