From ca0a9a3e54aeb047b18099c782f17f3908ff0374 Mon Sep 17 00:00:00 2001 From: Nut He <18328704+hetao92@users.noreply.github.com> Date: Fri, 16 Dec 2022 16:41:16 +0800 Subject: [PATCH] fix: fix issues mod: code review mod: code review --- app/config/locale/en-US.json | 5 ++- app/config/locale/zh-CN.json | 5 ++- app/config/service.ts | 2 +- app/global.d.ts | 5 +++ app/index.html | 9 ++++ app/pages/Import/FileUpload/FileList.tsx | 1 + app/pages/Import/FileUpload/index.tsx | 24 +++++++---- .../Plugins/SketchShapes/Path.tsx | 3 +- .../SketchModeling/SchemaConfig/index.tsx | 2 +- app/stores/global.ts | 1 + app/stores/schema.ts | 2 +- config/config.js | 9 ++++ config/webpack.base.js | 10 +++++ server/api/studio/internal/service/file.go | 3 ++ server/api/studio/pkg/middleware/file.go | 41 +++++++++++++++++++ server/api/studio/studio.go | 7 +--- 16 files changed, 109 insertions(+), 20 deletions(-) create mode 100644 config/config.js create mode 100644 server/api/studio/pkg/middleware/file.go diff --git a/app/config/locale/en-US.json b/app/config/locale/en-US.json index e90e5d67..f8b84aae 100644 --- a/app/config/locale/en-US.json +++ b/app/config/locale/en-US.json @@ -193,7 +193,8 @@ "fileNotExist": "{name} file does not exist!", "importYaml": "Import the YAML file", "templateMatchError": "The {type} in the configuration does not match the current login account/host", - "uploadSuccessfully": "Upload files successfully." + "uploadSuccessfully": "Upload files successfully.", + "fileSizeLimit": "The file is too large and exceeds the upload limit({size}), please modify the MaxBytes in the startup configuration file and restart the service" }, "schema": { "spaceList": "Graph Space List", @@ -315,7 +316,7 @@ "selectSpace": "Select Space", "noCurrentSketch": "No schema sketch selected", "noCurrentSketchTips": "Please select a schema sketch first", - "sketchInvalid": "The schema sketch is invalid, please check", + "sketchInvalid": "Please complete the current Schema information", "saveSuccess": "Save successfully", "saveReminder": "The current sketch has been modified but not saved, whether to continue to switch sketches?", "saveTip": "The current sketch has been modified but not saved, please save first.", diff --git a/app/config/locale/zh-CN.json b/app/config/locale/zh-CN.json index 55b1f6cb..2431a980 100644 --- a/app/config/locale/zh-CN.json +++ b/app/config/locale/zh-CN.json @@ -193,7 +193,8 @@ "fileNotExist": "文件 {name} 不存在", "importYaml": "导入 YAML 文件", "templateMatchError": "配置中的{type}与当前登录账号/地址不匹配", - "uploadSuccessfully": "上传文件成功" + "uploadSuccessfully": "上传文件成功", + "fileSizeLimit": "文件过大,超过上传限制({size}),请修改启动配置文件中的 MaxBytes 并重启服务" }, "schema": { "spaceList": "图空间列表", @@ -315,7 +316,7 @@ "selectSpace": "选择图空间", "noCurrentSketch": "当前没有选中草图", "noCurrentSketchTips": "请在左侧列表中选择草图", - "sketchInvalid": "当前草图数据格式错误,请检查", + "sketchInvalid": "请完善当前 Schema 信息。", "saveSuccess": "保存成功", "saveReminder": "当前草图有修改未保存,是否继续切换草图?", "saveTip": "当前草图有修改未保存, 请先保存。", diff --git a/app/config/service.ts b/app/config/service.ts index c3903f84..75dac4bd 100644 --- a/app/config/service.ts +++ b/app/config/service.ts @@ -48,7 +48,7 @@ const service = { return get('/api/files')(); }, uploadFiles: (params?, config?) => { - put('/api/files')(params, { ...config, headers: { 'Content-Type': 'multipart/form-data' } }); + return put('/api/files')(params, { ...config, headers: { 'Content-Type': 'multipart/form-data' } }); }, initSketch: (params, config?) => { return post(`/api/sketches/sketch`)(params, config); diff --git a/app/global.d.ts b/app/global.d.ts index e922feec..b7d80b16 100644 --- a/app/global.d.ts +++ b/app/global.d.ts @@ -7,3 +7,8 @@ declare module '*.bmp'; declare module '*.tiff'; declare module '*.less'; +interface Window { + gConfig: { + maxBytes: number + }; +} diff --git a/app/index.html b/app/index.html index f3c75434..4e9900d0 100644 --- a/app/index.html +++ b/app/index.html @@ -1,3 +1,5 @@ +<% var initProps=htmlWebpackPlugin.options.pageInitialProps %> + @@ -8,6 +10,13 @@