From 1a6dbc9485ad968b5c8bac8a1860491d935c3eb6 Mon Sep 17 00:00:00 2001 From: hardy <2545433047@qq.com> Date: Mon, 19 Oct 2026 10:32:09 +0800 Subject: [PATCH] fix(js-processor): keep JSON braces out of Mongo filter i18n message vue-i18n compiles messages at runtime and throws on `{"status": ...}` in production builds, so the filter query dialog rendered only its mask. Move the hint into an info tooltip beside the dialog title and keep the $find JSON example as a code constant. Remove the unused mock_json_placeholder message, which had the same problem. Co-Authored-By: Claude Opus 5.5 --- .../components/form/js-processor/index.tsx | 55 +++++++++++++++---- packages/form/src/locale/lang/en.js | 6 +- packages/form/src/locale/lang/zh-CN.js | 6 +- packages/form/src/locale/lang/zh-TW.js | 6 +- 4 files changed, 49 insertions(+), 24 deletions(-) diff --git a/packages/dag/src/components/form/js-processor/index.tsx b/packages/dag/src/components/form/js-processor/index.tsx index 06c0a5b4c..6f2861efe 100644 --- a/packages/dag/src/components/form/js-processor/index.tsx +++ b/packages/dag/src/components/form/js-processor/index.tsx @@ -35,6 +35,15 @@ import AiCodeDialog from './AiCodeDialog.vue' import { useVirtualLogScroller } from './useVirtualLogScroller' import './style.scss' +// Kept out of i18n messages: vue-i18n treats `{}` as interpolation and throws in production +const MONGO_FILTER_EXAMPLE = `{ + "$find": { + "filter": {"age": {"$gt": 10}}, + "sort": {"age": -1}, + "limit": 10 + } +}` + export const JsProcessor = observer( defineComponent({ props: ['value', 'disabled', 'isStandard'], @@ -1201,25 +1210,47 @@ export const JsProcessor = observer( {/* SQL / Mongo filter Query Dialog */} {{ - default: () => ( - <> + header: ({ titleId, titleClass }: any) => ( +
+ + {t( + isMongoQuerySource.value + ? 'packages_form_js_processor_mock_filter_dialog_title' + : 'packages_form_js_processor_mock_sql_dialog_title', + )} + {isMongoQuerySource.value && ( -
-                            {t(
-                              'packages_form_js_processor_mock_filter_placeholder',
-                            )}
-                          
+ + {{ + default: () => ( + + info + + ), + content: () => ( +
+
+ {t( + 'packages_form_js_processor_mock_filter_tip', + )} +
+
+                                    {MONGO_FILTER_EXAMPLE}
+                                  
+
+ ), + }} +
)} +
+ ), + default: () => ( + <>