Skip to content

Commit

Permalink
Allow Query.options to be None (#6519)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
eradman authored Oct 16, 2023
1 parent eafe30d commit 6b98197
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion redash/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions viz-lib/src/visualizations/counter/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6b98197

Please sign in to comment.