feat: add Monitor page for S2A dashboard statistics, pool management, and health checks.
This commit is contained in:
@@ -258,6 +258,15 @@ export default function Monitor() {
|
||||
// 从后端加载监控设置
|
||||
const loadMonitorSettings = async () => {
|
||||
try {
|
||||
// 加载全局代理配置(始终执行)
|
||||
const configRes = await fetch('/api/config')
|
||||
if (configRes.ok) {
|
||||
const configJson = await configRes.json()
|
||||
if (configJson.code === 0 && configJson.data) {
|
||||
setGlobalProxy(configJson.data.default_proxy || '')
|
||||
}
|
||||
}
|
||||
|
||||
// 加载监控设置
|
||||
const res = await fetch('/api/monitor/settings')
|
||||
if (res.ok) {
|
||||
@@ -288,15 +297,6 @@ export default function Monitor() {
|
||||
return { target, autoAdd: autoAddVal, minInterval: minIntervalVal, checkInterval: checkIntervalVal, pollingEnabled: pollingEnabledVal, pollingInterval: interval, replenishUseProxy: replenishUseProxyVal, browserType: browserTypeVal }
|
||||
}
|
||||
}
|
||||
|
||||
// 加载全局代理配置
|
||||
const configRes = await fetch('/api/config')
|
||||
if (configRes.ok) {
|
||||
const configJson = await configRes.json()
|
||||
if (configJson.code === 0 && configJson.data) {
|
||||
setGlobalProxy(configJson.data.default_proxy || '')
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('加载监控设置失败:', e)
|
||||
}
|
||||
@@ -537,12 +537,12 @@ export default function Monitor() {
|
||||
disabled={!autoAdd || !globalProxy}
|
||||
label="补号时使用代理"
|
||||
description={
|
||||
globalProxy
|
||||
? `当前代理: ${globalProxy}`
|
||||
: '请先在系统配置中设置代理地址(支持 http://host:port、http://user:pass@host:port、host:port:user:pass)'
|
||||
globalProxy
|
||||
? `当前代理: ${globalProxy}`
|
||||
: '请先在系统配置中设置代理地址(支持 http://host:port、http://user:pass@host:port、host:port:user:pass)'
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
/>
|
||||
</div>
|
||||
{/* 浏览器选择器 */}
|
||||
<div className="space-y-2">
|
||||
<label className="block text-sm font-medium text-slate-700 dark:text-slate-300">
|
||||
@@ -554,8 +554,8 @@ export default function Monitor() {
|
||||
onClick={() => setBrowserType('chromedp')}
|
||||
disabled={!autoAdd}
|
||||
className={`flex-1 px-4 py-2.5 text-sm font-medium transition-all duration-200 ${browserType === 'chromedp'
|
||||
? 'bg-blue-600 text-white'
|
||||
: 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400 hover:bg-slate-200 dark:hover:bg-slate-700'
|
||||
? 'bg-blue-600 text-white'
|
||||
: 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400 hover:bg-slate-200 dark:hover:bg-slate-700'
|
||||
} ${!autoAdd ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
>
|
||||
Chromedp
|
||||
@@ -565,8 +565,8 @@ export default function Monitor() {
|
||||
onClick={() => setBrowserType('rod')}
|
||||
disabled={!autoAdd}
|
||||
className={`flex-1 px-4 py-2.5 text-sm font-medium transition-all duration-200 border-l border-slate-200 dark:border-slate-700 ${browserType === 'rod'
|
||||
? 'bg-blue-600 text-white'
|
||||
: 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400 hover:bg-slate-200 dark:hover:bg-slate-700'
|
||||
? 'bg-blue-600 text-white'
|
||||
: 'bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400 hover:bg-slate-200 dark:hover:bg-slate-700'
|
||||
} ${!autoAdd ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||
>
|
||||
Rod
|
||||
|
||||
Reference in New Issue
Block a user