Skip to content

Commit 9a33992

Browse files
committed
Merge remote-tracking branch 'github-pro/main' into feature/liujian-1.8
# Conflicts: # .gitlab-ci.yml
2 parents 07ae37e + c36726f commit 9a33992

File tree

7 files changed

+80
-53
lines changed

7 files changed

+80
-53
lines changed

frontend/packages/common/src/components/aoplatform/TimeRangeSelector.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ const TimeRangeSelector = (props: TimeRangeSelectorProps) => {
112112
return current && current.valueOf() > dayjs().startOf('day').valueOf()
113113
}
114114

115+
useEffect(() => {
116+
setTimeButton(initialTimeButton || '')
117+
}, [initialTimeButton])
118+
115119
return (
116120
<div className={`flex flex-nowrap items-center ${customClassNames} mr-btnybase`}>
117121
{!hideTitle && <label className={`whitespace-nowrap `}>{$t('时间')}</label>}

frontend/packages/common/src/locales/scan/zh-CN.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@
883883
"Kaf9e8011": "总览",
884884
"Ke1e649cb": "服务尚未发布",
885885
"K2e683a7d": "跳转至详情页",
886-
"Ke04bc00d": "订阅数量",
886+
"Ke04bc00d": "订阅方数量",
887887
"K1b97ae0a": "已开启",
888888
"K19ec733b": "开启 MCP",
889889
"Kbee2340": "API 使用排名",

frontend/packages/core/src/pages/keySettings/components/ApiKeyContent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const ApiKeyContent: React.FC<ApiKeyContentProps> = forwardRef(({ provider, enti
3939

4040
const handleOk = async () => {
4141
try {
42+
// 表单校验
4243
const values = await form.validateFields()
4344
const { expire_time, ...restValues } = values
4445
const expireTime = neverExpire ? 0 : Math.trunc(expire_time.valueOf() / 1000)

frontend/packages/dashboard/src/component/MonitorApiPage.tsx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
6262
getProjectList()
6363
}, [])
6464

65+
/**
66+
* 重置时间范围
67+
*/
68+
let resetTimeRange = () => {}
69+
/**
70+
* 绑定时间范围组件
71+
* @param instance
72+
*/
73+
const bindRef = (instance: any) => {
74+
resetTimeRange = instance.reset
75+
}
6576
const getApiList = (projectIds?: string[]) => {
6677
return fetchData<{ apis: EntityItem[] }>('simple/service/apis', {
6778
method: 'POST',
@@ -146,6 +157,7 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
146157
}
147158

148159
const clearSearch = () => {
160+
resetTimeRange()
149161
setTimeButton('hour')
150162
setDatePickerValue(null)
151163
setQueryData(undefined)
@@ -186,11 +198,17 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
186198
setDrawerOpen(true)
187199
}
188200

201+
useEffect(() => {
202+
setQueryBtnLoading(true)
203+
getApiTableList()
204+
}, [queryData])
205+
189206
return (
190207
<div className="overflow-hidden h-full pr-PAGE_INSIDE_X">
191208
<ScrollableSection>
192209
<div className="pl-btnbase pr-btnrbase pb-btnbase content-before">
193210
<TimeRangeSelector
211+
bindRef={bindRef}
194212
labelSize="small"
195213
initialTimeButton={timeButton}
196214
onTimeButtonChange={setTimeButton}
@@ -235,12 +253,8 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
235253
<div className="w-[346px] inline-block">
236254
{/* <SearchInputGroup eoSingle={false} eoInputVal={queryData.path} eoClick={() => setQueryData({ ...queryData, path: '' })} /> */}
237255
<Input
238-
value={queryData?.path}
239-
onChange={(e) =>
240-
debounce((e) => {
241-
setQueryData((prevData) => ({ ...(prevData || {}), path: e.target.value }))
242-
}, 100)(e)
243-
}
256+
value={queryData?.path || ''}
257+
onChange={(e) => setQueryData((prevData) => ({ ...(prevData || {}), path: e.target.value }))}
244258
allowClear
245259
placeholder={$t('请输入请求路径进行搜索')}
246260
prefix={<SearchOutlined className="cursor-pointer" />}
@@ -249,17 +263,6 @@ export default function MonitorApiPage(props: MonitorApiPageProps) {
249263
<Button className="ml-btnybase" onClick={clearSearch}>
250264
{$t('重置')}
251265
</Button>
252-
<Button
253-
type="primary"
254-
loading={queryBtnLoading}
255-
className="ml-btnybase"
256-
onClick={() => {
257-
setQueryBtnLoading(true)
258-
getApiTableList()
259-
}}
260-
>
261-
{$t('查询')}
262-
</Button>
263266
<Button className="ml-btnybase" loading={exportLoading} onClick={exportData}>
264267
{$t('导出')}
265268
</Button>

frontend/packages/dashboard/src/component/MonitorAppPage.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,17 @@ export default function MonitorAppPage(props: MonitorAppPageProps) {
5858
getMonitorData()
5959
getAppList()
6060
}, [])
61-
61+
/**
62+
* 重置时间范围
63+
*/
64+
let resetTimeRange = () => {}
65+
/**
66+
* 绑定时间范围组件
67+
* @param instance
68+
*/
69+
const bindRef = (instance: any) => {
70+
resetTimeRange = instance.reset
71+
}
6272
const getMonitorData = () => {
6373
let query = queryData
6474
if (!queryData || queryData.start === undefined) {
@@ -86,6 +96,7 @@ export default function MonitorAppPage(props: MonitorAppPageProps) {
8696
}
8797

8898
const clearSearch = () => {
99+
resetTimeRange()
89100
setTimeButton('hour')
90101
setDatePickerValue(null)
91102
setQueryData({ type: 'subscriber' })
@@ -163,10 +174,16 @@ export default function MonitorAppPage(props: MonitorAppPageProps) {
163174
setDrawerOpen(true)
164175
}
165176

177+
useEffect(() => {
178+
setQueryBtnLoading(true)
179+
getAppTableList()
180+
}, [queryData])
181+
166182
return (
167183
<div className="h-full overflow-hidden pr-PAGE_INSIDE_X">
168184
<div className="pl-btnbase pr-btnrbase pb-btnybase">
169185
<TimeRangeSelector
186+
bindRef={bindRef}
170187
initialTimeButton={timeButton}
171188
onTimeButtonChange={setTimeButton}
172189
initialDatePickerValue={datePickerValue}
@@ -194,17 +211,6 @@ export default function MonitorAppPage(props: MonitorAppPageProps) {
194211
<Button className="ml-btnybase" onClick={clearSearch}>
195212
{$t('重置')}
196213
</Button>
197-
<Button
198-
type="primary"
199-
loading={queryBtnLoading}
200-
className="ml-btnybase"
201-
onClick={() => {
202-
setQueryBtnLoading(true)
203-
getAppTableList()
204-
}}
205-
>
206-
{$t('查询')}
207-
</Button>
208214
<Button className="ml-btnybase" loading={exportLoading} onClick={exportData}>
209215
{$t('导出')}
210216
</Button>

frontend/packages/dashboard/src/component/MonitorDetailPage.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) {
7878
const monitorTableRef = useRef<MonitorTableHandler>(null)
7979
const [modalTitle, setModalTitle] = useState<string>($t('调用趋势'))
8080
const [queryBtnLoading, setQueryBtnLoading] = useState<boolean>(false)
81-
81+
/**
82+
* 重置时间范围
83+
*/
84+
let resetTimeRange = () => {}
85+
/**
86+
* 绑定时间范围组件
87+
* @param instance
88+
*/
89+
const bindRef = (instance: any) => {
90+
resetTimeRange = instance.reset
91+
}
8292
useEffect(() => {
8393
// 初始化数据
8494
getMonitorData()
@@ -144,6 +154,7 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) {
144154
}
145155

146156
const clearSearch = () => {
157+
resetTimeRange()
147158
setTimeButton('hour')
148159
setDatePickerValue(null)
149160
setQueryData(null)
@@ -178,11 +189,17 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) {
178189
setQueryData((pre) => ({ ...pre, ...timeRange }) as SearchBody)
179190
}
180191

192+
useEffect(() => {
193+
setQueryBtnLoading(true)
194+
getMonitorData()
195+
}, [queryData])
196+
181197
return (
182198
<div className="pb-[20px] h-full box-border flex flex-col">
183199
<div className="pl-btnbase pr-btnrbase pb-btnybase sticky top-[0] bg-[#fff] z-[10] shadow-SCROLL_TOP ">
184200
<div className="flex flex-nowrap items-center mr-btnybase">
185201
<TimeRangeSelector
202+
bindRef={bindRef}
186203
initialTimeButton={timeButton}
187204
initialDatePickerValue={datePickerValue}
188205
onTimeButtonChange={setTimeButton}
@@ -192,16 +209,6 @@ export default function MonitorDetailPage(props: MonitorDetailPageProps) {
192209
<Button className="ml-btnybase mt-btnybase" onClick={clearSearch}>
193210
{$t('重置')}
194211
</Button>
195-
<Button
196-
className="ant-btn-primary ml-btnybase mt-btnybase"
197-
loading={queryBtnLoading}
198-
onClick={() => {
199-
setQueryBtnLoading(true)
200-
getMonitorData()
201-
}}
202-
>
203-
{$t('查询')}
204-
</Button>
205212
</div>
206213
</div>
207214
<div className={`flex overflow-y-hidden flex-col flex-1`}>

frontend/packages/dashboard/src/component/MonitorSubPage.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,17 @@ export default function MonitorSubPage(props: MonitorSubPageProps) {
6363
getMonitorData()
6464
getProjectList()
6565
}, [])
66-
66+
/**
67+
* 重置时间范围
68+
*/
69+
let resetTimeRange = () => {}
70+
/**
71+
* 绑定时间范围组件
72+
* @param instance
73+
*/
74+
const bindRef = (instance: any) => {
75+
resetTimeRange = instance.reset
76+
}
6777
const getMonitorData = () => {
6878
let query = queryData
6979
if (!queryData || queryData.start === undefined) {
@@ -91,6 +101,7 @@ export default function MonitorSubPage(props: MonitorSubPageProps) {
91101
}
92102

93103
const clearSearch = () => {
104+
resetTimeRange()
94105
setTimeButton('hour')
95106
setDatePickerValue(null)
96107
setQueryData({ type: 'provider' })
@@ -168,10 +179,16 @@ export default function MonitorSubPage(props: MonitorSubPageProps) {
168179
setDrawerOpen(true)
169180
}
170181

182+
useEffect(() => {
183+
setQueryBtnLoading(true)
184+
getAppTableList()
185+
}, [queryData])
186+
171187
return (
172188
<div className="overflow-hidden h-full pr-PAGE_INSIDE_X">
173189
<div className="pl-btnbase pr-btnrbase pb-btnybase">
174190
<TimeRangeSelector
191+
bindRef={bindRef}
175192
initialTimeButton={timeButton}
176193
onTimeButtonChange={setTimeButton}
177194
initialDatePickerValue={datePickerValue}
@@ -198,17 +215,6 @@ export default function MonitorSubPage(props: MonitorSubPageProps) {
198215
<Button className="ml-btnybase" onClick={clearSearch}>
199216
{$t('重置')}
200217
</Button>
201-
<Button
202-
type="primary"
203-
loading={queryBtnLoading}
204-
className="ml-btnybase"
205-
onClick={() => {
206-
setQueryBtnLoading(true)
207-
getAppTableList()
208-
}}
209-
>
210-
{$t('查询')}
211-
</Button>
212218
<Button className="ml-btnybase" loading={exportLoading} onClick={exportData}>
213219
{$t('导出')}
214220
</Button>

0 commit comments

Comments
 (0)