2026-05-09 11:35:07 +08:00
|
|
|
/*
|
|
|
|
|
Copyright (C) 2023-2026 QuantumNous
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
|
|
|
*/
|
2026-05-06 16:24:06 +08:00
|
|
|
import { SystemBehaviorSection } from '../general/system-behavior-section'
|
|
|
|
|
import { EmailSettingsSection } from '../integrations/email-settings-section'
|
|
|
|
|
import { MonitoringSettingsSection } from '../integrations/monitoring-settings-section'
|
|
|
|
|
import { WorkerSettingsSection } from '../integrations/worker-settings-section'
|
|
|
|
|
import { LogSettingsSection } from '../maintenance/log-settings-section'
|
|
|
|
|
import { PerformanceSection } from '../maintenance/performance-section'
|
|
|
|
|
import { UpdateCheckerSection } from '../maintenance/update-checker-section'
|
2026-05-07 03:20:35 +08:00
|
|
|
import type { OperationsSettings } from '../types'
|
|
|
|
|
import { createSectionRegistry } from '../utils/section-registry'
|
2026-05-06 16:24:06 +08:00
|
|
|
|
|
|
|
|
const OPERATIONS_SECTIONS = [
|
|
|
|
|
{
|
|
|
|
|
id: 'behavior',
|
|
|
|
|
titleKey: 'System Behavior',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<SystemBehaviorSection
|
|
|
|
|
defaultValues={{
|
|
|
|
|
RetryTimes: settings.RetryTimes,
|
|
|
|
|
DefaultCollapseSidebar: settings.DefaultCollapseSidebar,
|
|
|
|
|
DemoSiteEnabled: settings.DemoSiteEnabled,
|
|
|
|
|
SelfUseModeEnabled: settings.SelfUseModeEnabled,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'monitoring',
|
|
|
|
|
titleKey: 'Monitoring & Alerts',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<MonitoringSettingsSection
|
|
|
|
|
defaultValues={{
|
|
|
|
|
ChannelDisableThreshold: settings.ChannelDisableThreshold,
|
|
|
|
|
QuotaRemindThreshold: settings.QuotaRemindThreshold,
|
|
|
|
|
AutomaticDisableChannelEnabled:
|
|
|
|
|
settings.AutomaticDisableChannelEnabled,
|
|
|
|
|
AutomaticEnableChannelEnabled: settings.AutomaticEnableChannelEnabled,
|
|
|
|
|
AutomaticDisableKeywords: settings.AutomaticDisableKeywords,
|
|
|
|
|
AutomaticDisableStatusCodes: settings.AutomaticDisableStatusCodes,
|
|
|
|
|
AutomaticRetryStatusCodes: settings.AutomaticRetryStatusCodes,
|
|
|
|
|
'monitor_setting.auto_test_channel_enabled':
|
|
|
|
|
settings['monitor_setting.auto_test_channel_enabled'],
|
|
|
|
|
'monitor_setting.auto_test_channel_minutes':
|
|
|
|
|
settings['monitor_setting.auto_test_channel_minutes'],
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'email',
|
|
|
|
|
titleKey: 'SMTP Email',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<EmailSettingsSection
|
|
|
|
|
defaultValues={{
|
|
|
|
|
SMTPServer: settings.SMTPServer,
|
|
|
|
|
SMTPPort: settings.SMTPPort,
|
|
|
|
|
SMTPAccount: settings.SMTPAccount,
|
|
|
|
|
SMTPFrom: settings.SMTPFrom,
|
|
|
|
|
SMTPToken: settings.SMTPToken,
|
|
|
|
|
SMTPSSLEnabled: settings.SMTPSSLEnabled,
|
|
|
|
|
SMTPForceAuthLogin: settings.SMTPForceAuthLogin,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'worker',
|
|
|
|
|
titleKey: 'Worker Proxy',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<WorkerSettingsSection
|
|
|
|
|
defaultValues={{
|
|
|
|
|
WorkerUrl: settings.WorkerUrl,
|
|
|
|
|
WorkerValidKey: settings.WorkerValidKey,
|
|
|
|
|
WorkerAllowHttpImageRequestEnabled:
|
|
|
|
|
settings.WorkerAllowHttpImageRequestEnabled,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'logs',
|
|
|
|
|
titleKey: 'Log Maintenance',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<LogSettingsSection
|
|
|
|
|
defaultEnabled={Boolean(settings.LogConsumeEnabled)}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'performance',
|
|
|
|
|
titleKey: 'Performance',
|
|
|
|
|
build: (settings: OperationsSettings) => (
|
|
|
|
|
<PerformanceSection
|
|
|
|
|
defaultValues={{
|
|
|
|
|
'performance_setting.disk_cache_enabled':
|
|
|
|
|
settings['performance_setting.disk_cache_enabled'] ?? false,
|
|
|
|
|
'performance_setting.disk_cache_threshold_mb':
|
|
|
|
|
settings['performance_setting.disk_cache_threshold_mb'] ?? 10,
|
|
|
|
|
'performance_setting.disk_cache_max_size_mb':
|
|
|
|
|
settings['performance_setting.disk_cache_max_size_mb'] ?? 1024,
|
|
|
|
|
'performance_setting.disk_cache_path':
|
|
|
|
|
settings['performance_setting.disk_cache_path'] ?? '',
|
|
|
|
|
'performance_setting.monitor_enabled':
|
|
|
|
|
settings['performance_setting.monitor_enabled'] ?? false,
|
|
|
|
|
'performance_setting.monitor_cpu_threshold':
|
|
|
|
|
settings['performance_setting.monitor_cpu_threshold'] ?? 90,
|
|
|
|
|
'performance_setting.monitor_memory_threshold':
|
|
|
|
|
settings['performance_setting.monitor_memory_threshold'] ?? 90,
|
|
|
|
|
'performance_setting.monitor_disk_threshold':
|
|
|
|
|
settings['performance_setting.monitor_disk_threshold'] ?? 95,
|
|
|
|
|
'perf_metrics_setting.enabled':
|
|
|
|
|
settings['perf_metrics_setting.enabled'] ?? true,
|
|
|
|
|
'perf_metrics_setting.flush_interval':
|
|
|
|
|
settings['perf_metrics_setting.flush_interval'] ?? 5,
|
|
|
|
|
'perf_metrics_setting.bucket_time':
|
|
|
|
|
settings['perf_metrics_setting.bucket_time'] ?? 'hour',
|
|
|
|
|
'perf_metrics_setting.retention_days':
|
|
|
|
|
settings['perf_metrics_setting.retention_days'] ?? 0,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'update-checker',
|
|
|
|
|
titleKey: 'System maintenance',
|
|
|
|
|
build: (
|
|
|
|
|
_settings: OperationsSettings,
|
|
|
|
|
currentVersion?: string | null,
|
|
|
|
|
startTime?: number | null
|
|
|
|
|
) => (
|
|
|
|
|
<UpdateCheckerSection
|
|
|
|
|
currentVersion={currentVersion}
|
|
|
|
|
startTime={startTime}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
] as const
|
|
|
|
|
|
|
|
|
|
export type OperationsSectionId = (typeof OPERATIONS_SECTIONS)[number]['id']
|
|
|
|
|
|
|
|
|
|
const operationsRegistry = createSectionRegistry<
|
|
|
|
|
OperationsSectionId,
|
|
|
|
|
OperationsSettings,
|
|
|
|
|
[string | null | undefined, number | null | undefined]
|
|
|
|
|
>({
|
|
|
|
|
sections: OPERATIONS_SECTIONS,
|
|
|
|
|
defaultSection: 'behavior',
|
|
|
|
|
basePath: '/system-settings/operations',
|
|
|
|
|
urlStyle: 'path',
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const OPERATIONS_SECTION_IDS = operationsRegistry.sectionIds
|
|
|
|
|
export const OPERATIONS_DEFAULT_SECTION = operationsRegistry.defaultSection
|
|
|
|
|
export const getOperationsSectionNavItems =
|
|
|
|
|
operationsRegistry.getSectionNavItems
|
2026-05-07 03:20:35 +08:00
|
|
|
export const getOperationsSectionContent = operationsRegistry.getSectionContent
|
✨ refactor: system settings UI for consistent, compact layouts
Redesign the system settings interface to align with the rest of the console experience by using fixed header actions, removing redundant subtitles, respecting global content width, and standardizing responsive form layouts.
Introduce reusable settings layout primitives for forms, switch rows, grouped controls, nested control sections, title status indicators, and page action portals. Replace duplicated card-style switch markup with explicit compact components, improve nested switch readability, and reduce visual noise across authentication, billing, content, integrations, maintenance, models, and request-limit settings.
Also complete missing i18n translations, remove obsolete subtitle translation keys, refine i18n sync reporting, fix sidebar truncation for long labels, and verify the frontend with type checking and lint diagnostics.
2026-05-25 00:34:26 +08:00
|
|
|
export const getOperationsSectionMeta = operationsRegistry.getSectionMeta
|