fix: preserve large integer precision when formatting JSON in value editor (fixes #2765)

* fix: preserve large integer precision when formatting JSON in value editor (fixes #2765)

* fix: add missing showDiagramDialog to useNavigationTargets in AiAssistant
This commit is contained in:
gggaiitx authored and GitHub committed 2026-07-07 16:48:00 +08:00
1 parent 326c4f5495
commit 9410bf42a9
6 files changed
+116 -8

No files matched your search

@@ -3,6 +3,7 @@ import { formatError } from "@/lib/backend/errorUtils";
import { computed, ref } from "vue";
import type { MqRawResponse, TopicInfo } from "@/types/mq";
import { mqRawRequest } from "@/lib/backend/api";
import { safeJsonFormat } from "@/lib/common/safeJsonFormat";
interface Props {
connectionId: string;
@@ -156,7 +157,7 @@ function formatJsonBody() {
const text = bodyText.value.trim();
if (!text) return;
try {
bodyText.value = JSON.stringify(JSON.parse(text), null, 2);
bodyText.value = safeJsonFormat(text, 2);
error.value = undefined;
} catch (e: unknown) {
error.value = `JSON Body 格式错误: ${formatError(e)}`;
@@ -19,6 +19,7 @@ import { useEditorFontFamilyStyle } from "@/composables/useEditorFontFamilyStyle
import { createRedisShikiJsonHighlighter, type RedisJsonHighlighter } from "@/lib/redis/redisJsonHighlighter";
import { copyToClipboard } from "@/lib/common/clipboard";
import { formatTtl } from "@/lib/common/ttlFormat";
import { safeJsonFormat } from "@/lib/common/safeJsonFormat";
import { canEditRedisMemberDetail, clampRedisMemberDetailSheetWidth, formatRedisMemberDetail, getRedisMemberSelectionKey } from "@/lib/redis/redisValuePresentation";
const { t } = useI18n();
@@ -347,8 +348,7 @@ function handleStringInput() {
function formatJsonText(raw: string): string | null {
try {
const parsed = JSON.parse(raw);
return JSON.stringify(parsed, null, 2);
return safeJsonFormat(raw, 2);
} catch {
return null;
}
@@ -356,8 +356,7 @@ function formatJsonText(raw: string): string | null {
function compressJsonText(raw: string): string | null {
try {
const parsed = JSON.parse(raw);
return JSON.stringify(parsed);
return safeJsonFormat(raw);
} catch {
return null;
}