From 73f53a913c3d8b932e72138de51a0d0b70fb28bf Mon Sep 17 00:00:00 2001 From: ningyv <1793599591@qq.com> Date: Fri, 6 Dec 2024 14:22:59 +0800 Subject: [PATCH 1/2] fix: resolve subscriber permissions --- .../core/src/pages/aiService/AiServiceInsideSubscriber.tsx | 2 +- .../packages/core/src/pages/system/SystemInsideSubscriber.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/packages/core/src/pages/aiService/AiServiceInsideSubscriber.tsx b/frontend/packages/core/src/pages/aiService/AiServiceInsideSubscriber.tsx index ca317f95..456b009d 100644 --- a/frontend/packages/core/src/pages/aiService/AiServiceInsideSubscriber.tsx +++ b/frontend/packages/core/src/pages/aiService/AiServiceInsideSubscriber.tsx @@ -239,7 +239,7 @@ export const AiServiceSubscriberConfig = forwardRef + return (
+ return ( Date: Fri, 6 Dec 2024 15:24:06 +0800 Subject: [PATCH 2/2] fix: refine time range calculation with second-level precision --- .../aoplatform/TimeRangeSelector.tsx | 19 +++++++++---------- .../dataMasking/DataMaskingLogModal.tsx | 7 +++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx index b742586b..2ee576ef 100644 --- a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx +++ b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx @@ -38,33 +38,32 @@ const TimeRangeSelector = (props: TimeRangeSelectorProps) => { }, [bindRef]) // 根据选择的时间范围计算开始和结束时间 const calculateTimeRange = (curBtn: 'hour' | 'day' | 'threeDays' | 'sevenDays') => { - const currentSecond = new Date().getTime() // 当前毫秒数时间戳 - const currentMin = currentSecond - (currentSecond % (60 * 1000)) // 当前分钟数时间戳 - let startMin = currentMin - 60 * 60 * 1000 + const currentSecond = Math.floor(Date.now() / 1000); // 当前秒级时间戳 + let startMin = currentSecond - 60 * 60 switch (curBtn) { case 'hour': { - startMin = currentMin - 60 * 60 * 1000 + startMin = currentSecond - 60 * 60 break } case 'day': { - startMin = currentMin - 24 * 60 * 60 * 1000 + startMin = currentSecond - 24 * 60 * 60 break } case 'threeDays': { startMin = - new Date(new Date().setHours(0, 0, 0, 0)).getTime() - - 2 * 24 * 60 * 60 * 1000 + Math.floor(new Date().setHours(0, 0, 0, 0) / 1000) - + 2 * 24 * 60 * 60 break } case 'sevenDays': { startMin = - new Date(new Date().setHours(0, 0, 0, 0)).getTime() - - 6 * 24 * 60 * 60 * 1000 + Math.floor(new Date().setHours(0, 0, 0, 0) / 1000) - + 6 * 24 * 60 * 60 break } } if (onTimeRangeChange) { - onTimeRangeChange({ start: startMin / 1000, end: currentMin / 1000 }); + onTimeRangeChange({ start: startMin, end: currentSecond }); } }; diff --git a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingLogModal.tsx b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingLogModal.tsx index d7c0da3f..fdab84a4 100644 --- a/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingLogModal.tsx +++ b/frontend/packages/core/src/pages/policy/dataMasking/DataMaskingLogModal.tsx @@ -14,16 +14,15 @@ import { useFetch } from '@common/hooks/http'; import TimeRangeSelector, { TimeRange } from '@common/components/aoplatform/TimeRangeSelector'; import { SearchBody } from '@dashboard/const/type'; import TableBtnWithPermission from '@common/components/aoplatform/TableBtnWithPermission'; -import { getTime } from '@dashboard/utils/dashboard'; const DataMaskingLogModal = (props: any) => { const { strategy } = props; const { state, accessData } = useGlobalContext() const { serviceId, teamId } = useParams() const [datePickerValue, setDatePickerValue] = useState(); - const defaultTime = getTime('hour', datePickerValue) + const currentSecond = Math.floor(Date.now() / 1000); // 当前秒级时间戳 const [queryData, setQueryData] = useState({ - start: defaultTime.startTime, - end: defaultTime.endTime + start: currentSecond - 60 * 60, + end: currentSecond }) /** * 请求数据