From c18fc9bd700cdbfd801bc9ee4a9026e3383404dc Mon Sep 17 00:00:00 2001 From: logan Date: Sat, 30 May 2026 01:51:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Redis=20cluster=20UI=20-=20SchemaSideba?= =?UTF-8?q?r=20=E9=9B=86=E7=BE=A4db0=E9=94=81=E5=AE=9A=20+=20InstanceItem?= =?UTF-8?q?=20cluster=5Fmode=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/SchemaSidebar.tsx | 10 +++++++++- frontend/src/pages/QueriesPage.tsx | 3 ++- frontend/src/pages/TicketCreatePage.tsx | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/SchemaSidebar.tsx b/frontend/src/components/SchemaSidebar.tsx index b6fc431..9f9e41c 100644 --- a/frontend/src/components/SchemaSidebar.tsx +++ b/frontend/src/components/SchemaSidebar.tsx @@ -14,6 +14,8 @@ interface Props { instanceId: string; database: string; dbType: string; + /** Redis 集群模式为 true */ + clusterMode?: boolean; onInsert: (text: string) => void; onDatabaseChange?: (db: string) => void; /** 为 true 时只显示当前选中的库,不允许切换(数据变更场景防误操作) */ @@ -193,7 +195,7 @@ function formatTTL(ttl: number): string { /* COMPONENT */ /* ================================================================== */ -export default function SchemaSidebar({ instanceId, database, dbType, onInsert, onDatabaseChange, singleDb }: Props) { +export default function SchemaSidebar({ instanceId, database, dbType, clusterMode, onInsert, onDatabaseChange, singleDb }: Props) { const isMySQL = dbType === 'mysql' || dbType === 'postgres' || dbType === 'postgresql'; const isRedis = dbType === 'redis'; @@ -617,6 +619,11 @@ export default function SchemaSidebar({ instanceId, database, dbType, onInsert,
{/* DB + Search */}
+ {clusterMode ? ( +
+ 集群模式 · DB0 +
+ ) : ( + )}
([]); const [loadingDbs, setLoadingDbs] = useState(false); - const [instances, setInstances] = useState>([]); + const [instances, setInstances] = useState>([]); const [editorSchema, setEditorSchema] = useState>>({}); const [executing, setExecuting] = useState(false); const [error, setError] = useState(''); @@ -432,6 +432,7 @@ export default function QueriesPage() { {showSidebar && instanceId && (
{ const sep = dbType === 'redis' ? (sql.trim() ? '\n' : '') : (sql.trim() ? ' ' : ''); setSql(prev => prev + sep + text + (dbType === 'redis' ? '' : ' ')); diff --git a/frontend/src/pages/TicketCreatePage.tsx b/frontend/src/pages/TicketCreatePage.tsx index ebb620b..836de7f 100644 --- a/frontend/src/pages/TicketCreatePage.tsx +++ b/frontend/src/pages/TicketCreatePage.tsx @@ -19,6 +19,7 @@ interface InstanceItem { host: string; port: number; db_type: string; + cluster_mode?: boolean; } interface AuditFinding { @@ -350,6 +351,7 @@ export default function TicketCreatePage() { {showBrowser && instanceId && (
)}