feat: remove Home control plane configuration and related validation logic

This commit is contained in:
LTbinglingfeng
2026-05-19 00:25:45 +08:00
Unverified
parent d6f5c45aa5
commit f0d669f98a
7 changed files with 1 additions and 261 deletions
+1 -98
View File
@@ -191,7 +191,6 @@ export function VisualConfigEditor({
values.streaming.nonstreamKeepaliveInterval === '0';
const portError = getValidationMessage(t, validationErrors?.port);
const homePortError = getValidationMessage(t, validationErrors?.homePort);
const logsMaxSizeError = getValidationMessage(t, validationErrors?.logsMaxTotalSizeMb);
const errorLogsMaxFilesError = getValidationMessage(t, validationErrors?.errorLogsMaxFiles);
const redisUsageQueueRetentionError = getValidationMessage(
@@ -269,7 +268,7 @@ export function VisualConfigEditor({
id: 'server',
title: t('config_management.visual.sections.server.title'),
icon: IconSettings,
errorCount: countErrors(['port', 'homePort']),
errorCount: countErrors(['port']),
},
{
id: 'auth',
@@ -539,102 +538,6 @@ export function VisualConfigEditor({
</SectionStack>
</SectionSubsection>
<SectionSubsection
title={t('config_management.visual.sections.home.title')}
description={t('config_management.visual.sections.home.description')}
>
<SectionStack>
<SectionGrid>
<ToggleRow
title={t('config_management.visual.sections.home.enabled')}
description={t('config_management.visual.sections.home.enabled_desc')}
checked={values.homeEnabled}
disabled={disabled}
onChange={(homeEnabled) => onChange({ homeEnabled })}
/>
<ToggleRow
title={t('config_management.visual.sections.home.disable_cluster_discovery')}
description={t(
'config_management.visual.sections.home.disable_cluster_discovery_desc'
)}
checked={values.homeDisableClusterDiscovery}
disabled={disabled}
onChange={(homeDisableClusterDiscovery) =>
onChange({ homeDisableClusterDiscovery })
}
/>
</SectionGrid>
<SectionGrid>
<Input
label={t('config_management.visual.sections.home.host')}
placeholder="127.0.0.1"
value={values.homeHost}
onChange={(e) => onChange({ homeHost: e.target.value })}
disabled={disabled}
/>
<Input
label={t('config_management.visual.sections.home.port')}
type="number"
placeholder="6379"
value={values.homePort}
onChange={(e) => onChange({ homePort: e.target.value })}
disabled={disabled}
error={homePortError}
/>
<Input
label={t('config_management.visual.sections.home.password')}
type="password"
placeholder={t('config_management.visual.sections.home.password_placeholder')}
value={values.homePassword}
onChange={(e) => onChange({ homePassword: e.target.value })}
disabled={disabled}
/>
</SectionGrid>
<Divider />
<div className={styles.subsectionHeader}>
<h3 className={styles.subsectionTitle}>
{t('config_management.visual.sections.home.tls_title')}
</h3>
<p className={styles.subsectionDescription}>
{t('config_management.visual.sections.home.tls_description')}
</p>
</div>
<SectionGrid>
<ToggleRow
title={t('config_management.visual.sections.home.tls_enable')}
checked={values.homeTlsEnable}
disabled={disabled}
onChange={(homeTlsEnable) => onChange({ homeTlsEnable })}
/>
<ToggleRow
title={t('config_management.visual.sections.home.tls_insecure')}
description={t('config_management.visual.sections.home.tls_insecure_desc')}
checked={values.homeTlsInsecureSkipVerify}
disabled={disabled}
onChange={(homeTlsInsecureSkipVerify) =>
onChange({ homeTlsInsecureSkipVerify })
}
/>
</SectionGrid>
<SectionGrid>
<Input
label={t('config_management.visual.sections.home.tls_server_name')}
placeholder="home.example.com"
value={values.homeTlsServerName}
onChange={(e) => onChange({ homeTlsServerName: e.target.value })}
disabled={disabled}
/>
<Input
label={t('config_management.visual.sections.home.tls_ca_cert')}
placeholder="/path/to/ca.pem"
value={values.homeTlsCaCert}
onChange={(e) => onChange({ homeTlsCaCert: e.target.value })}
disabled={disabled}
/>
</SectionGrid>
</SectionStack>
</SectionSubsection>
<SectionSubsection
title={t('config_management.visual.sections.remote.title')}
description={t('config_management.visual.sections.remote.description')}
-68
View File
@@ -176,7 +176,6 @@ export function getVisualConfigValidationErrors(
values: VisualConfigValues
): VisualConfigValidationErrors {
return {
homePort: getPortError(values.homePort),
port: getPortError(values.port),
errorLogsMaxFiles: getNonNegativeIntegerError(values.errorLogsMaxFiles),
logsMaxTotalSizeMb: getNonNegativeIntegerError(values.logsMaxTotalSizeMb),
@@ -726,15 +725,6 @@ function getNextDirtyFields(
(
[
'homeEnabled',
'homeHost',
'homePort',
'homePassword',
'homeDisableClusterDiscovery',
'homeTlsEnable',
'homeTlsServerName',
'homeTlsCaCert',
'homeTlsInsecureSkipVerify',
'rmDisableAutoUpdatePanel',
'errorLogsMaxFiles',
'usageStatisticsEnabled',
@@ -1001,8 +991,6 @@ export function useVisualConfig() {
const parsedRaw: unknown = parseYaml(yamlContent) || {};
const parsed = asRecord(parsedRaw) ?? {};
const tls = asRecord(parsed.tls);
const home = asRecord(parsed.home);
const homeTls = asRecord(home?.tls);
const remoteManagement = asRecord(parsed['remote-management']);
const quotaExceeded = asRecord(parsed['quota-exceeded']);
const routing = asRecord(parsed.routing);
@@ -1019,17 +1007,6 @@ export function useVisualConfig() {
tlsCert: typeof tls?.cert === 'string' ? tls.cert : '',
tlsKey: typeof tls?.key === 'string' ? tls.key : '',
homeEnabled: Boolean(home?.enabled),
homeHost: typeof home?.host === 'string' ? home.host : '',
homePort: String(home?.port ?? ''),
homePassword: typeof home?.password === 'string' ? home.password : '',
homeDisableClusterDiscovery: Boolean(home?.['disable-cluster-discovery']),
homeTlsEnable: Boolean(homeTls?.enable),
homeTlsServerName:
typeof homeTls?.['server-name'] === 'string' ? homeTls['server-name'] : '',
homeTlsCaCert: typeof homeTls?.['ca-cert'] === 'string' ? homeTls['ca-cert'] : '',
homeTlsInsecureSkipVerify: Boolean(homeTls?.['insecure-skip-verify']),
rmAllowRemote: Boolean(remoteManagement?.['allow-remote']),
rmSecretKey:
typeof remoteManagement?.['secret-key'] === 'string'
@@ -1167,51 +1144,6 @@ export function useVisualConfig() {
deleteIfMapEmpty(doc, ['tls']);
}
if (
docHas(doc, ['home']) ||
values.homeEnabled ||
values.homeHost.trim() ||
values.homePort.trim() ||
values.homePassword.trim() ||
values.homeDisableClusterDiscovery ||
values.homeTlsEnable ||
values.homeTlsServerName.trim() ||
values.homeTlsCaCert.trim() ||
values.homeTlsInsecureSkipVerify
) {
ensureMapInDoc(doc, ['home']);
setBooleanInDoc(doc, ['home', 'enabled'], values.homeEnabled);
setStringInDoc(doc, ['home', 'host'], values.homeHost);
setIntFromStringInDoc(doc, ['home', 'port'], values.homePort);
setStringInDoc(doc, ['home', 'password'], values.homePassword);
setBooleanInDoc(
doc,
['home', 'disable-cluster-discovery'],
values.homeDisableClusterDiscovery
);
if (
docHas(doc, ['home', 'tls']) ||
values.homeTlsEnable ||
values.homeTlsServerName.trim() ||
values.homeTlsCaCert.trim() ||
values.homeTlsInsecureSkipVerify
) {
ensureMapInDoc(doc, ['home', 'tls']);
setBooleanInDoc(doc, ['home', 'tls', 'enable'], values.homeTlsEnable);
setStringInDoc(doc, ['home', 'tls', 'server-name'], values.homeTlsServerName);
setStringInDoc(doc, ['home', 'tls', 'ca-cert'], values.homeTlsCaCert);
setBooleanInDoc(
doc,
['home', 'tls', 'insecure-skip-verify'],
values.homeTlsInsecureSkipVerify
);
deleteIfMapEmpty(doc, ['home', 'tls']);
}
deleteIfMapEmpty(doc, ['home']);
}
if (
docHas(doc, ['remote-management']) ||
values.rmAllowRemote ||
-19
View File
@@ -1085,25 +1085,6 @@
"cert": "Certificate File Path",
"key": "Private Key File Path"
},
"home": {
"title": "Home Control Plane",
"description": "Optional Home control plane connection over Redis protocol",
"enabled": "Enable Home",
"enabled_desc": "Enable the outbound connection to the Home control plane",
"host": "Home Host",
"port": "Home Port",
"password": "Home Password",
"password_placeholder": "Leave empty for no password",
"disable_cluster_discovery": "Disable Cluster Discovery",
"disable_cluster_discovery_desc": "Keep using the configured Home address instead of CLUSTER NODES entries",
"tls_title": "Home TLS",
"tls_description": "TLS, SNI, and certificate settings for the Home Redis connection",
"tls_enable": "Enable Home TLS",
"tls_server_name": "TLS Server Name",
"tls_ca_cert": "CA Certificate Path",
"tls_insecure": "Skip Certificate Verification",
"tls_insecure_desc": "Only use this for testing self-signed endpoints"
},
"remote": {
"title": "Remote Management",
"description": "Remote access and control panel settings",
-19
View File
@@ -1082,25 +1082,6 @@
"cert": "Путь к сертификату",
"key": "Путь к закрытому ключу"
},
"home": {
"title": "Панель управления Home",
"description": "Необязательное подключение к Home по протоколу Redis",
"enabled": "Включить Home",
"enabled_desc": "Включить исходящее подключение к панели управления Home",
"host": "Хост Home",
"port": "Порт Home",
"password": "Пароль Home",
"password_placeholder": "Оставьте пустым, если пароль не нужен",
"disable_cluster_discovery": "Отключить обнаружение кластера",
"disable_cluster_discovery_desc": "Использовать заданный адрес Home вместо записей CLUSTER NODES",
"tls_title": "TLS для Home",
"tls_description": "Настройки TLS, SNI и сертификатов для Redis-подключения Home",
"tls_enable": "Включить TLS для Home",
"tls_server_name": "TLS Server Name",
"tls_ca_cert": "Путь к CA-сертификату",
"tls_insecure": "Пропустить проверку сертификата",
"tls_insecure_desc": "Используйте только для тестирования самоподписанных endpoints"
},
"remote": {
"title": "Удалённое управление",
"description": "Настройки удалённого доступа и панели управления",
-19
View File
@@ -1085,25 +1085,6 @@
"cert": "证书文件路径",
"key": "私钥文件路径"
},
"home": {
"title": "Home 控制平面",
"description": "通过 Redis 协议连接 Home 控制平面的可选设置",
"enabled": "启用 Home",
"enabled_desc": "启用到 Home 控制平面的出站连接",
"host": "Home 主机",
"port": "Home 端口",
"password": "Home 密码",
"password_placeholder": "留空表示不设置密码",
"disable_cluster_discovery": "禁用集群发现",
"disable_cluster_discovery_desc": "固定使用配置中的 Home 地址,不切换到 CLUSTER NODES 返回的地址",
"tls_title": "Home TLS",
"tls_description": "Home Redis 连接的 TLS/SNI 与证书设置",
"tls_enable": "启用 Home TLS",
"tls_server_name": "TLS Server Name",
"tls_ca_cert": "CA 证书路径",
"tls_insecure": "跳过证书校验",
"tls_insecure_desc": "仅用于测试自签名端点"
},
"remote": {
"title": "远程管理",
"description": "远程访问和控制面板设置",
-19
View File
@@ -1111,25 +1111,6 @@
"cert": "憑證檔案路徑",
"key": "私鑰檔案路徑"
},
"home": {
"title": "Home 控制平面",
"description": "透過 Redis 協議連接 Home 控制平面的選填設定",
"enabled": "啟用 Home",
"enabled_desc": "啟用到 Home 控制平面的出站連線",
"host": "Home 主機",
"port": "Home 連接埠",
"password": "Home 密碼",
"password_placeholder": "留空表示不設定密碼",
"disable_cluster_discovery": "停用叢集探索",
"disable_cluster_discovery_desc": "固定使用設定中的 Home 位址,不切換到 CLUSTER NODES 返回的位址",
"tls_title": "Home TLS",
"tls_description": "Home Redis 連線的 TLS/SNI 與憑證設定",
"tls_enable": "啟用 Home TLS",
"tls_server_name": "TLS Server Name",
"tls_ca_cert": "CA 憑證路徑",
"tls_insecure": "跳過憑證校驗",
"tls_insecure_desc": "僅用於測試自簽端點"
},
"remote": {
"title": "遠端管理",
"description": "遠端存取和控制面板設定",
-19
View File
@@ -6,7 +6,6 @@ export type PayloadParamValidationErrorCode =
| 'payload_invalid_json';
export type VisualConfigFieldPath =
| 'homePort'
| 'port'
| 'errorLogsMaxFiles'
| 'logsMaxTotalSizeMb'
@@ -74,15 +73,6 @@ export type VisualConfigValues = {
tlsEnable: boolean;
tlsCert: string;
tlsKey: string;
homeEnabled: boolean;
homeHost: string;
homePort: string;
homePassword: string;
homeDisableClusterDiscovery: boolean;
homeTlsEnable: boolean;
homeTlsServerName: string;
homeTlsCaCert: string;
homeTlsInsecureSkipVerify: boolean;
rmAllowRemote: boolean;
rmSecretKey: string;
rmDisableControlPanel: boolean;
@@ -144,15 +134,6 @@ export const DEFAULT_VISUAL_VALUES: VisualConfigValues = {
tlsEnable: false,
tlsCert: '',
tlsKey: '',
homeEnabled: false,
homeHost: '',
homePort: '',
homePassword: '',
homeDisableClusterDiscovery: false,
homeTlsEnable: false,
homeTlsServerName: '',
homeTlsCaCert: '',
homeTlsInsecureSkipVerify: false,
rmAllowRemote: false,
rmSecretKey: '',
rmDisableControlPanel: false,