From 2b228d05fd67caaf7eea20be1b0185eab44e8fae Mon Sep 17 00:00:00 2001 From: heheer <71265218+newfish-cmyk@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:30:19 +0800 Subject: [PATCH] fix(web): function return shows when not undefined & update current function after edit name (#1713) * feat(web): add history modal tip * fix(web): fix function return show when not undefined * fix(web): fix change function name update --- web/public/locales/en/translation.json | 4 +++- web/public/locales/zh-CN/translation.json | 4 +++- web/public/locales/zh/translation.json | 4 +++- .../pages/app/functions/mods/DebugPanel/index.tsx | 2 +- .../mods/FunctionPanel/CreateModal/index.tsx | 4 +++- .../{FetchButton => FetchModal}/index.tsx | 12 +++++++++--- .../functions/mods/VersionHistoryPanel/index.tsx | 6 +++--- .../SysSetting/AppMonitor/AreaCard/index.tsx | 15 +++++++-------- 8 files changed, 32 insertions(+), 19 deletions(-) rename web/src/pages/app/functions/mods/VersionHistoryPanel/{FetchButton => FetchModal}/index.tsx (82%) diff --git a/web/public/locales/en/translation.json b/web/public/locales/en/translation.json index 023793d1ce..0f72a05a44 100644 --- a/web/public/locales/en/translation.json +++ b/web/public/locales/en/translation.json @@ -133,7 +133,9 @@ "Restore": "Restore", "Invite": "Invite", "HistoryTips": "No historical versions available", - "NoDesc": "No Description" + "NoDesc": "No Description", + "CurrentVersion": "Current Version", + "HistoryVersion": "History version" }, "HomePanel": { "APP": "Android or iOS app", diff --git a/web/public/locales/zh-CN/translation.json b/web/public/locales/zh-CN/translation.json index af7fbfbc28..dcbdf05ecc 100644 --- a/web/public/locales/zh-CN/translation.json +++ b/web/public/locales/zh-CN/translation.json @@ -133,7 +133,9 @@ "Restore": "恢复", "Invite": "邀请", "HistoryTips": "暂无历史版本", - "NoDesc": "暂无描述" + "NoDesc": "暂无描述", + "CurrentVersion": "当前版本", + "HistoryVersion": "历史版本" }, "HomePanel": { "APP": "Android or iOS 应用", diff --git a/web/public/locales/zh/translation.json b/web/public/locales/zh/translation.json index af698f993b..f6886d98a0 100644 --- a/web/public/locales/zh/translation.json +++ b/web/public/locales/zh/translation.json @@ -133,7 +133,9 @@ "Restore": "恢复", "Invite": "邀请", "HistoryTips": "暂无历史版本", - "NoDesc": "暂无描述" + "NoDesc": "暂无描述", + "CurrentVersion": "当前版本", + "HistoryVersion": "历史版本" }, "HomePanel": { "APP": "Android or iOS 应用", diff --git a/web/src/pages/app/functions/mods/DebugPanel/index.tsx b/web/src/pages/app/functions/mods/DebugPanel/index.tsx index c72e24824d..62ebc64a6d 100644 --- a/web/src/pages/app/functions/mods/DebugPanel/index.tsx +++ b/web/src/pages/app/functions/mods/DebugPanel/index.tsx @@ -344,7 +344,7 @@ export default function DebugPanel(props: { containerRef: any }) { ) : null} - {runningResData ? ( + {runningResData !== undefined ? ( Code Diff + + {t("FunctionPanel.HistoryVersion")} + {t("FunctionPanel.CurrentVersion")} + diff --git a/web/src/pages/app/functions/mods/VersionHistoryPanel/index.tsx b/web/src/pages/app/functions/mods/VersionHistoryPanel/index.tsx index a198e75435..58946095ce 100644 --- a/web/src/pages/app/functions/mods/VersionHistoryPanel/index.tsx +++ b/web/src/pages/app/functions/mods/VersionHistoryPanel/index.tsx @@ -8,7 +8,7 @@ import { formatDate } from "@/utils/format"; import { useFunctionHistoryQuery } from "../../service"; import useFunctionStore from "../../store"; -import FetchButton from "./FetchButton"; +import FetchModal from "./FetchModal"; export default function VersionHistoryPanel() { const { currentFunction } = useFunctionStore((state) => state); @@ -29,7 +29,7 @@ export default function VersionHistoryPanel() { ) : history.data?.data.length !== 0 ? ( history.data?.data.map((item: any, index: number) => { return ( - +
-
+ ); }) ) : ( diff --git a/web/src/pages/app/setting/SysSetting/AppMonitor/AreaCard/index.tsx b/web/src/pages/app/setting/SysSetting/AppMonitor/AreaCard/index.tsx index 5f319d634d..45de67f2ba 100644 --- a/web/src/pages/app/setting/SysSetting/AppMonitor/AreaCard/index.tsx +++ b/web/src/pages/app/setting/SysSetting/AppMonitor/AreaCard/index.tsx @@ -61,19 +61,18 @@ function mergeArrays(arrays: any) { const newArrays = arrays.map((arr: any) => { let frontPadding = 0; let endPadding = 0; + const lastTime = new Date(arr[arr.length - 1].xData); + lastTime.setSeconds(0); + lastTime.setMilliseconds(0); + const firstTime = new Date(arr[0].xData); + firstTime.setSeconds(0); + firstTime.setMilliseconds(0); for (let i = 0; i < longestArray.length; i++) { - const lastTime = new Date(arr[arr.length - 1].xData); - lastTime.setSeconds(0); - lastTime.setMilliseconds(0); - const firstTime = new Date(arr[0].xData); - firstTime.setSeconds(0); - firstTime.setMilliseconds(0); - if (longestArray[i].xData === firstTime.getTime()) { frontPadding = i; } if (longestArray[i].xData === lastTime.getTime()) { - endPadding = longestArray.length - i - 1; + endPadding = longestArray.length - 1 - i; } } return [