Skip to content

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

chore: copy formatted value (#14572)

Liu Jid135bbbebfe6
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue
index 03af0e450d..7728e1eeef 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DetailPanel/DetailPanel.vue
@@ -198,7 +198,20 @@ const contentClass = computed(() => {
const { copy, copied } = useClipboard({
source: computed(() => {
- return content.value ?? "";
+ const raw = content.value ?? "";
+ if (guessedIsJSON.value && format.value) {
+ try {
+ const obj = JSON.parse(raw);
+ return JSON.stringify(obj, null, " ");
+ } catch {
+ console.warn(
+ "[DetailPanel]",
+ "failed to parse and format (maybe) JSON value"
+ );
+ return raw;
+ }
+ }
+ return raw;
}),
legacy: true,
});