feat: 添加定时健康检查前端配置 UI
在配置管理页面添加定时健康检查开关、间隔配置 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
1e7e391b0d
commit
79d2441c23
2 changed files with 51 additions and 0 deletions
|
|
@ -236,6 +236,21 @@ async function loadConfiguration() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定时健康检查配置
|
||||||
|
const scheduledHealthCheckEnabledEl = document.getElementById('scheduledHealthCheckEnabled');
|
||||||
|
const scheduledHealthCheckStartupRunEl = document.getElementById('scheduledHealthCheckStartupRun');
|
||||||
|
const scheduledHealthCheckIntervalEl = document.getElementById('scheduledHealthCheckInterval');
|
||||||
|
|
||||||
|
if (data.SCHEDULED_HEALTH_CHECK) {
|
||||||
|
if (scheduledHealthCheckEnabledEl) scheduledHealthCheckEnabledEl.checked = data.SCHEDULED_HEALTH_CHECK.enabled !== false;
|
||||||
|
if (scheduledHealthCheckStartupRunEl) scheduledHealthCheckStartupRunEl.checked = data.SCHEDULED_HEALTH_CHECK.startupRun !== false;
|
||||||
|
if (scheduledHealthCheckIntervalEl) scheduledHealthCheckIntervalEl.value = data.SCHEDULED_HEALTH_CHECK.interval || 600000;
|
||||||
|
} else {
|
||||||
|
if (scheduledHealthCheckEnabledEl) scheduledHealthCheckEnabledEl.checked = true;
|
||||||
|
if (scheduledHealthCheckStartupRunEl) scheduledHealthCheckStartupRunEl.checked = true;
|
||||||
|
if (scheduledHealthCheckIntervalEl) scheduledHealthCheckIntervalEl.value = 600000;
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to load configuration:', error);
|
console.error('Failed to load configuration:', error);
|
||||||
}
|
}
|
||||||
|
|
@ -347,6 +362,13 @@ async function saveConfiguration() {
|
||||||
config.TLS_SIDECAR_ENABLED_PROVIDERS = [];
|
config.TLS_SIDECAR_ENABLED_PROVIDERS = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定时健康检查配置
|
||||||
|
config.SCHEDULED_HEALTH_CHECK = {
|
||||||
|
enabled: document.getElementById('scheduledHealthCheckEnabled')?.checked !== false,
|
||||||
|
startupRun: document.getElementById('scheduledHealthCheckStartupRun')?.checked !== false,
|
||||||
|
interval: parseInt(document.getElementById('scheduledHealthCheckInterval')?.value || 600000)
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await window.apiClient.post('/config', config);
|
await window.apiClient.post('/config', config);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,35 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 定时健康检查 -->
|
||||||
|
<div class="config-group-section">
|
||||||
|
<h3 data-i18n="config.healthCheck.title"><i class="fas fa-heartbeat"></i> 定时健康检查</h3>
|
||||||
|
<div class="config-row">
|
||||||
|
<div class="form-group">
|
||||||
|
<label data-i18n="config.healthCheck.enabled">启用定时检查</label>
|
||||||
|
<label class="toggle-switch">
|
||||||
|
<input type="checkbox" id="scheduledHealthCheckEnabled">
|
||||||
|
<span class="toggle-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label data-i18n="config.healthCheck.startupRun">启动时运行</label>
|
||||||
|
<label class="toggle-switch">
|
||||||
|
<input type="checkbox" id="scheduledHealthCheckStartupRun">
|
||||||
|
<span class="toggle-slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="scheduledHealthCheckInterval" data-i18n="config.healthCheck.interval">检查间隔</label>
|
||||||
|
<select id="scheduledHealthCheckInterval" class="form-control">
|
||||||
|
<option value="300000">5 分钟</option>
|
||||||
|
<option value="600000" selected>10 分钟</option>
|
||||||
|
<option value="1800000">30 分钟</option>
|
||||||
|
</select>
|
||||||
|
<small class="form-text" data-i18n="config.healthCheck.intervalNote">设置定时健康检查的执行间隔</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 日志管理 -->
|
<!-- 日志管理 -->
|
||||||
<div class="config-group-section">
|
<div class="config-group-section">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue