From 6b981972f0090522deb2a575504316274ef90a17 Mon Sep 17 00:00:00 2001 From: Eric Radman Date: Sun, 15 Oct 2023 21:07:30 -0400 Subject: [PATCH] Allow Query.options to be None (#6519) * Allow Query.options to be None Query.options may not have a value on a database created by 10.1.0 * Ensure counter widget is not compressed in query preview tabs Also bump minimum counter font size to 14 --- redash/models/__init__.py | 2 +- viz-lib/src/visualizations/counter/Renderer.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/redash/models/__init__.py b/redash/models/__init__.py index 3e46f2928e..ead454bbd7 100644 --- a/redash/models/__init__.py +++ b/redash/models/__init__.py @@ -264,7 +264,7 @@ def update_group_permission(self, group, view_only): @property def uses_ssh_tunnel(self): - return "ssh_tunnel" in self.options + return self.options and "ssh_tunnel" in self.options @property def query_runner(self): diff --git a/viz-lib/src/visualizations/counter/Renderer.tsx b/viz-lib/src/visualizations/counter/Renderer.tsx index 6f22ac22e8..45697164e0 100644 --- a/viz-lib/src/visualizations/counter/Renderer.tsx +++ b/viz-lib/src/visualizations/counter/Renderer.tsx @@ -17,11 +17,11 @@ function getCounterStyles(scale: any) { function getCounterScale(container: any) { // size of font in base container // children use a relative font size (em) - if (container.closest('.visualization-preview')) { + if (container.closest('.visualization-preview') || container.closest('.ant-tabs-tabpane')) { return "60"; } const fontSize = container.clientHeight / 4.5; - return fontSize > 60 ? "60" : fontSize < 12 ? "12" : fontSize.toFixed(); + return fontSize > 60 ? "60" : fontSize < 14 ? "14" : fontSize.toFixed(); } export default function Renderer({ data, options, visualizationName }: any) {