From a06c13623d9efe66da55c4bcdd5cd49614690448 Mon Sep 17 00:00:00 2001 From: Pravesh Sharma Date: Tue, 16 Jul 2024 10:25:48 +0530 Subject: [PATCH] Fixed an issue where theme preview under theme options was broken in pgAdmin server mode. #7626 --- web/pgadmin/misc/__init__.py | 6 ++---- .../static/js/components/PreferencesComponent.jsx | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/web/pgadmin/misc/__init__.py b/web/pgadmin/misc/__init__.py index a9466bafa..153f3191a 100644 --- a/web/pgadmin/misc/__init__.py +++ b/web/pgadmin/misc/__init__.py @@ -70,10 +70,8 @@ class MiscModule(PgAdminModule): .replace('-', ' ') .title(), 'value': theme, - 'preview_src': url_for( - 'static', filename='js/generated/img/' + - theme_data['preview_img'] - ) if 'preview_img' in theme_data else None + 'preview_src': 'js/generated/img/' + theme_data['preview_img'] + if 'preview_img' in theme_data else None }) self.preference.register( diff --git a/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx b/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx index 085eb32a0..05baaf0af 100644 --- a/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx +++ b/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx @@ -295,6 +295,7 @@ export default function PreferencesComponent({ ...props }) { } else { opt.selected = false; } + opt.preview_src = opt.preview_src && url_for('static', { filename: opt.preview_src }); }); } }