fix(cluster): Repair-Button-Gating auf role statt pg_role — v1.2.87

pg_role bleibt nach cluster-setup-standby auf 'standalone' (nur 'promote' setzt 'primary'), daher erschien der Button auf dem Primary (role=primary, pg_role=standalone) nicht. Gating + Dispatch + Status nutzen jetzt isPrimaryNode = role=='primary' || pg_role=='primary' (wie keepalived); Resync-Ziel = Nicht-Primary-Peer. Backend (cluster_repair.go) + UI (Cluster/index.tsx).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Debian
2026-06-04 13:03:17 +02:00
parent f7dd7a3a4b
commit 66c71c5fa8
3 changed files with 50 additions and 19 deletions

View File

@@ -394,12 +394,15 @@ export default function ClusterPage() {
// Repair-Button: sichtbar bei Drift, für Admins, wenn ein Resync-Ziel
// existiert — auf dem Standby (lokal) oder auf dem Primary (delegiert
// an den Standby-Peer).
const localRole = data?.local_node?.pg_role
// an den Subscriber-Peer). Primary = role ODER pg_role 'primary'
// (pg_role bleibt nach setup-standby 'standalone', role ist verlässlich).
const isPrimaryNode = (n?: HANode | null) => !!n && (n.pg_role === 'primary' || n.role === 'primary')
const localIsPrimary = isPrimaryNode(data?.local_node)
const hasSubscriberPeer = data?.peers?.some(p => !isPrimaryNode(p)) ?? false
const hasPrimary = localIsPrimary || (data?.peers?.some(isPrimaryNode) ?? false)
const canRepair = !isViewer
&& !!data?.drift_found
&& (localRole === 'standby'
|| (localRole === 'primary' && (data?.peers?.some(p => p.pg_role === 'standby') ?? false)))
&& (localIsPrimary ? hasSubscriberPeer : hasPrimary)
const peerColumns: ColumnsType<HANode> = [
{
@@ -540,8 +543,7 @@ export default function ClusterPage() {
description={
<>
<Paragraph style={{ marginBottom: 8 }}>{t('cluster.driftBannerDesc')}</Paragraph>
{data.local_node?.pg_role === 'primary'
&& !(data.peers?.some(p => p.pg_role === 'standby'))
{localIsPrimary && !hasSubscriberPeer
&& <Text type="secondary">{t('cluster.repair.noStandbyHint')}</Text>}
</>
}