fix(cluster): a disconnected server keeps its pill

The pills listed live SESSIONS, so disconnecting one made it vanish —
along with the only way back. They now list every enabled server, and a
server with no session shows as disconnected: the state you click to
undo. The address, known only while a session exists, drops out of the
tooltip rather than reading ':0'.
This commit is contained in:
2026-08-31 19:05:56 +02:00
parent 88f35e2c20
commit bcd7e409ba
2 changed files with 16 additions and 5 deletions
+14 -3
View File
@@ -8124,12 +8124,23 @@ export default function App() {
>
Disconnect all
</Button>
{clusterServerStatuses.length === 0 && (
{clusterServers.filter((x) => x.enabled).length === 0 && (
<span className="text-xs text-muted-foreground italic">
No active sessions configure clusters in Settings DX Cluster.
</span>
)}
{clusterServerStatuses.map((s) => {
{clusterServers
.filter((x) => x.enabled)
.sort((a, b) => a.sort_order - b.sort_order)
.map((srv) => {
// A disconnected server has no session to report, so it has no
// entry in the status list at all — the pill stands in for it
// as "disconnected", which is exactly the state you click to
// undo.
const live = clusterServerStatuses.find((x) => x.server_id === srv.id);
const s: ServerStatus = live ?? {
server_id: srv.id, name: srv.name, host: '', port: 0, state: 'disconnected',
};
const isMaster = clusterServers
.filter((x) => x.enabled)
.sort((a, b) => a.sort_order - b.sort_order)[0]?.id === s.server_id;
@@ -8159,7 +8170,7 @@ export default function App() {
s.state === 'error' ? 'bg-danger-muted text-danger-muted-foreground border-danger-border' :
'bg-muted text-muted-foreground border-border',
)}
title={`${s.name}${s.state.toUpperCase()}${s.retries ? ` #${s.retries}` : ''} · ${s.host}:${s.port}${s.error ? ' — ' + s.error : ''}\n${up || busy ? t('clu.pillDisconnect') : t('clu.pillConnect')}`}
title={`${s.name}${s.state.toUpperCase()}${s.retries ? ` #${s.retries}` : ''}${s.host ? ` · ${s.host}:${s.port}` : ''}${s.error ? ' — ' + s.error : ''}\n${up || busy ? t('clu.pillDisconnect') : t('clu.pillConnect')}`}
>
{isMaster && <span className="text-warning" title="Master (commands go here)"></span>}
{s.name}