From a842931f6c03bd6db3ca67b9e53d27c6d9a70849 Mon Sep 17 00:00:00 2001 From: Kundan Sable Date: Wed, 22 Jul 2026 15:00:00 +0530 Subject: [PATCH] fix: render disconnect tree label via className, not embedded HTML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Server/database disconnect handlers built the tree node label as an HTML string ([Disconnecting...] ...), but FileTreeX's setLabel() writes the label via label.textContent, which escapes markup — so the literal tag text was shown instead of a styled "[Disconnecting...]" label. Pass plain text plus a className instead, and have setLabel apply that className to the label span (resetting to the default file-name class otherwise), so styling comes from CSS rather than injected HTML. Fixes #10106 --- .../server_groups/servers/databases/static/js/database.js | 3 +-- .../browser/server_groups/servers/static/js/server.js | 3 +-- web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index 30a1ade15f6..cd8f6bcbcdd 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -523,8 +523,7 @@ define('pgadmin.node.database', [ i = item, label = data.label; let disconnect = function() { - d.label = `[Disconnecting...] ${label}`; - t.setLabel(i,{label:d.label}); + t.setLabel(i, {label: `[Disconnecting...] ${label}`, className: 'text-muted'}); t.close(i); let data = d; getApiInstance().delete( diff --git a/web/pgadmin/browser/server_groups/servers/static/js/server.js b/web/pgadmin/browser/server_groups/servers/static/js/server.js index 38549f4fef8..281d48093f3 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/server.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/server.js @@ -822,8 +822,7 @@ define('pgadmin.node.server', [ label = data.label; let disconnect = function() { - d.label = `[Disconnecting...] ${label}`; - t.setLabel(i,{label:d.label}); + t.setLabel(i, {label: `[Disconnecting...] ${label}`, className: 'text-muted'}); t.close(i); getApiInstance().delete( obj.generate_url(i, 'connect', d, true), diff --git a/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx b/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx index aebb0f4bee9..a57fc61e338 100644 --- a/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx +++ b/web/pgadmin/static/js/components/PgTree/FileTreeX/index.tsx @@ -455,10 +455,15 @@ export class FileTreeX extends React.Component { const label$ = ref.querySelector('span.file-name') as HTMLDivElement; if (label$) { + let className = ''; if (typeof(label) == 'object' && label.label) { + className = label.className ?? ''; label = label.label; } + // Render the label as plain text (never as an HTML string) and apply + // any requested styling via a CSS class instead of embedding markup. label$.textContent = label; + label$.className = 'file-name' + (className ? ' ' + className : ''); } }