Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: optimize multi-line mongo json display (#9687)

Liu Jibf9c0c19739c
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
index 33a4104278..08968bc134 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
@@ -63,7 +63,7 @@ const database = computed(() => {
const valueContainerAdditionalClass = computed(() => {
// Always only show the first line for MongoDB.
if (database.value.instanceEntity.engine === Engine.MONGODB) {
- return "line-clamp-1";
+ return "!whitespace-nowrap";
}
return "";
});
@@ -72,8 +72,10 @@ const clickable = computed(() => {
if (truncated.value) return true;
if (database.value.instanceEntity.engine === Engine.MONGODB) {
// A cheap way to check JSON string without paying the parsing cost.
+ const maybeJSON = String(props.value).trim();
return (
- String(props.value).startsWith("{") && String(props.value).endsWith("}")
+ (maybeJSON.startsWith("{") && maybeJSON.endsWith("}")) ||
+ (maybeJSON.startsWith("[") && maybeJSON.endsWith("]"))
);
}
return false;