diff --git a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx index 56dbba6e..6df2e13c 100644 --- a/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx +++ b/frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx @@ -112,6 +112,10 @@ const TimeRangeSelector = (props: TimeRangeSelectorProps) => { return current && current.valueOf() > dayjs().startOf('day').valueOf() } + useEffect(() => { + setTimeButton(initialTimeButton || '') + }, [initialTimeButton]) + return (
{!hideTitle && } diff --git a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx index 60b991ba..80995086 100644 --- a/frontend/packages/dashboard/src/component/MonitorApiPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorApiPage.tsx @@ -62,6 +62,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) { getProjectList() }, []) + /** + * 重置时间范围 + */ + let resetTimeRange = () => {} + /** + * 绑定时间范围组件 + * @param instance + */ + const bindRef = (instance: any) => { + resetTimeRange = instance.reset + } const getApiList = (projectIds?: string[]) => { return fetchData<{ apis: EntityItem[] }>('simple/service/apis', { method: 'POST', @@ -146,6 +157,7 @@ export default function MonitorApiPage(props: MonitorApiPageProps) { } const clearSearch = () => { + resetTimeRange() setTimeButton('hour') setDatePickerValue(null) setQueryData(undefined) @@ -186,11 +198,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) { setDrawerOpen(true) } + useEffect(() => { + setQueryBtnLoading(true) + getApiTableList() + }, [queryData]) + return (
{/* setQueryData({ ...queryData, path: '' })} /> */} - debounce((e) => { - setQueryData((prevData) => ({ ...(prevData || {}), path: e.target.value })) - }, 100)(e) - } + value={queryData?.path || ''} + onChange={(e) => setQueryData((prevData) => ({ ...(prevData || {}), path: e.target.value }))} allowClear placeholder={$t('请输入请求路径进行搜索')} prefix={} @@ -249,17 +263,6 @@ export default function MonitorApiPage(props: MonitorApiPageProps) { - diff --git a/frontend/packages/dashboard/src/component/MonitorAppPage.tsx b/frontend/packages/dashboard/src/component/MonitorAppPage.tsx index 55667089..7df1c67e 100644 --- a/frontend/packages/dashboard/src/component/MonitorAppPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorAppPage.tsx @@ -58,7 +58,17 @@ export default function MonitorAppPage(props: MonitorAppPageProps) { getMonitorData() getAppList() }, []) - + /** + * 重置时间范围 + */ + let resetTimeRange = () => {} + /** + * 绑定时间范围组件 + * @param instance + */ + const bindRef = (instance: any) => { + resetTimeRange = instance.reset + } const getMonitorData = () => { let query = queryData if (!queryData || queryData.start === undefined) { @@ -86,6 +96,7 @@ export default function MonitorAppPage(props: MonitorAppPageProps) { } const clearSearch = () => { + resetTimeRange() setTimeButton('hour') setDatePickerValue(null) setQueryData({ type: 'subscriber' }) @@ -163,10 +174,16 @@ export default function MonitorAppPage(props: MonitorAppPageProps) { setDrawerOpen(true) } + useEffect(() => { + setQueryBtnLoading(true) + getAppTableList() + }, [queryData]) + return (
{$t('重置')} - diff --git a/frontend/packages/dashboard/src/component/MonitorDetailPage.tsx b/frontend/packages/dashboard/src/component/MonitorDetailPage.tsx index 4b0e2c73..55756ca8 100644 --- a/frontend/packages/dashboard/src/component/MonitorDetailPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorDetailPage.tsx @@ -78,7 +78,17 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) { const monitorTableRef = useRef(null) const [modalTitle, setModalTitle] = useState($t('调用趋势')) const [queryBtnLoading, setQueryBtnLoading] = useState(false) - + /** + * 重置时间范围 + */ + let resetTimeRange = () => {} + /** + * 绑定时间范围组件 + * @param instance + */ + const bindRef = (instance: any) => { + resetTimeRange = instance.reset + } useEffect(() => { // 初始化数据 getMonitorData() @@ -144,6 +154,7 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) { } const clearSearch = () => { + resetTimeRange() setTimeButton('hour') setDatePickerValue(null) setQueryData(null) @@ -178,11 +189,17 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) { setQueryData((pre) => ({ ...pre, ...timeRange }) as SearchBody) } + useEffect(() => { + setQueryBtnLoading(true) + getMonitorData() + }, [queryData]) + return (
{$t('重置')} -
diff --git a/frontend/packages/dashboard/src/component/MonitorSubPage.tsx b/frontend/packages/dashboard/src/component/MonitorSubPage.tsx index c400b52d..82a7f137 100644 --- a/frontend/packages/dashboard/src/component/MonitorSubPage.tsx +++ b/frontend/packages/dashboard/src/component/MonitorSubPage.tsx @@ -63,7 +63,17 @@ export default function MonitorSubPage(props: MonitorSubPageProps) { getMonitorData() getProjectList() }, []) - + /** + * 重置时间范围 + */ + let resetTimeRange = () => {} + /** + * 绑定时间范围组件 + * @param instance + */ + const bindRef = (instance: any) => { + resetTimeRange = instance.reset + } const getMonitorData = () => { let query = queryData if (!queryData || queryData.start === undefined) { @@ -91,6 +101,7 @@ export default function MonitorSubPage(props: MonitorSubPageProps) { } const clearSearch = () => { + resetTimeRange() setTimeButton('hour') setDatePickerValue(null) setQueryData({ type: 'provider' }) @@ -168,10 +179,16 @@ export default function MonitorSubPage(props: MonitorSubPageProps) { setDrawerOpen(true) } + useEffect(() => { + setQueryBtnLoading(true) + getAppTableList() + }, [queryData]) + return (
{$t('重置')} -