From a39316e004baff96487423ac40093b9dabeda3df Mon Sep 17 00:00:00 2001 From: IanShaw027 <131567472+IanShaw027@users.noreply.github.com> Date: Sun, 11 Jan 2026 19:51:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(ops):=20=E9=9B=86=E6=88=90=E8=BF=90?= =?UTF-8?q?=E7=BB=B4=E7=9B=91=E6=8E=A7=E8=AE=BE=E7=BD=AE=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86=E5=88=B0=E4=BB=AA=E8=A1=A8=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在OpsDashboardHeader添加设置和警报规则按钮 - 在OpsDashboard集成OpsSettingsDialog组件 - 添加警报规则弹窗展示 - 添加高级设置API类型定义 - 支持从Header快速访问设置和规则管理 相关文件: - frontend/src/api/admin/ops.ts - frontend/src/views/admin/ops/types.ts - frontend/src/views/admin/ops/OpsDashboard.vue - frontend/src/views/admin/ops/components/OpsDashboardHeader.vue --- frontend/src/api/admin/ops.ts | 32 +++++++++++++++++- frontend/src/views/admin/ops/OpsDashboard.vue | 16 +++++++++ .../ops/components/OpsDashboardHeader.vue | 33 +++++++++++++++++-- frontend/src/views/admin/ops/types.ts | 5 ++- 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/admin/ops.ts b/frontend/src/api/admin/ops.ts index 3c39a32b..c0df4605 100644 --- a/frontend/src/api/admin/ops.ts +++ b/frontend/src/api/admin/ops.ts @@ -676,6 +676,23 @@ export interface OpsAlertRuntimeSettings { } } +export interface OpsAdvancedSettings { + data_retention: OpsDataRetentionSettings + aggregation: OpsAggregationSettings +} + +export interface OpsDataRetentionSettings { + cleanup_enabled: boolean + cleanup_schedule: string + error_log_retention_days: number + minute_metrics_retention_days: number + hourly_metrics_retention_days: number +} + +export interface OpsAggregationSettings { + aggregation_enabled: boolean +} + export interface OpsErrorLog { id: number created_at: string @@ -894,6 +911,17 @@ export async function updateAlertRuntimeSettings(config: OpsAlertRuntimeSettings return data } +// Advanced settings (DB-backed) +export async function getAdvancedSettings(): Promise { + const { data } = await apiClient.get('/admin/ops/advanced-settings') + return data +} + +export async function updateAdvancedSettings(config: OpsAdvancedSettings): Promise { + const { data } = await apiClient.put('/admin/ops/advanced-settings', config) + return data +} + export const opsAPI = { getDashboardOverview, getThroughputTrend, @@ -915,7 +943,9 @@ export const opsAPI = { getEmailNotificationConfig, updateEmailNotificationConfig, getAlertRuntimeSettings, - updateAlertRuntimeSettings + updateAlertRuntimeSettings, + getAdvancedSettings, + updateAdvancedSettings } export default opsAPI diff --git a/frontend/src/views/admin/ops/OpsDashboard.vue b/frontend/src/views/admin/ops/OpsDashboard.vue index 212717fb..e8fedc5a 100644 --- a/frontend/src/views/admin/ops/OpsDashboard.vue +++ b/frontend/src/views/admin/ops/OpsDashboard.vue @@ -31,6 +31,8 @@ @refresh="fetchData" @open-request-details="handleOpenRequestDetails" @open-error-details="openErrorDetails" + @open-settings="showSettingsDialog = true" + @open-alert-rules="showAlertRulesCard = true" /> @@ -72,6 +74,14 @@ + + + + + + + + ({ sort: 'created_at_desc' }) +const showSettingsDialog = ref(false) +const showAlertRulesCard = ref(false) + function handleThroughputSelectPlatform(nextPlatform: string) { platform.value = nextPlatform || '' groupId.value = null diff --git a/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue b/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue index 312642c3..23609a06 100644 --- a/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue +++ b/frontend/src/views/admin/ops/components/OpsDashboardHeader.vue @@ -34,6 +34,8 @@ interface Emits { (e: 'refresh'): void (e: 'openRequestDetails', preset?: OpsRequestDetailsPreset): void (e: 'openErrorDetails', kind: 'request' | 'upstream'): void + (e: 'openSettings'): void + (e: 'openAlertRules'): void } const props = defineProps() @@ -723,6 +725,33 @@ function openJobsDetails() { /> + + + + + + @@ -955,11 +984,11 @@ function openJobsDetails() {
- 请求数: + {{ t('admin.ops.requests') }}: {{ totalRequestsLabel }}
- Token: + {{ t('admin.ops.tokens') }}: {{ totalTokensLabel }}
diff --git a/frontend/src/views/admin/ops/types.ts b/frontend/src/views/admin/ops/types.ts index 08830542..45ba031f 100644 --- a/frontend/src/views/admin/ops/types.ts +++ b/frontend/src/views/admin/ops/types.ts @@ -13,5 +13,8 @@ export type { Operator, EmailNotificationConfig, OpsDistributedLockSettings, - OpsAlertRuntimeSettings + OpsAlertRuntimeSettings, + OpsAdvancedSettings, + OpsDataRetentionSettings, + OpsAggregationSettings } from '@/api/admin/ops'