mirror of https://github.com/apache/superset.git
[forms] Fix handling of NULLs
This commit is contained in:
parent
76d26f3740
commit
e83a07d3df
|
@ -163,7 +163,7 @@ class Slice(Model, AuditMixinNullable, ImportMixin):
|
||||||
'viz_type', 'params', 'cache_timeout')
|
'viz_type', 'params', 'cache_timeout')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.slice_name
|
return self.slice_name or str(self.id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def cls_model(self):
|
def cls_model(self):
|
||||||
|
@ -291,10 +291,14 @@ class Slice(Model, AuditMixinNullable, ImportMixin):
|
||||||
def edit_url(self):
|
def edit_url(self):
|
||||||
return '/chart/edit/{}'.format(self.id)
|
return '/chart/edit/{}'.format(self.id)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def chart(self):
|
||||||
|
return self.slice_name or '<empty>'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def slice_link(self):
|
def slice_link(self):
|
||||||
url = self.slice_url
|
url = self.slice_url
|
||||||
name = escape(self.slice_name)
|
name = escape(self.chart)
|
||||||
return Markup(f'<a href="{url}">{name}</a>')
|
return Markup(f'<a href="{url}">{name}</a>')
|
||||||
|
|
||||||
def get_viz(self, force=False):
|
def get_viz(self, force=False):
|
||||||
|
@ -407,7 +411,7 @@ class Dashboard(Model, AuditMixinNullable, ImportMixin):
|
||||||
'description', 'css', 'slug')
|
'description', 'css', 'slug')
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.dashboard_title
|
return self.dashboard_title or str(self.id)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def table_names(self):
|
def table_names(self):
|
||||||
|
@ -436,6 +440,10 @@ class Dashboard(Model, AuditMixinNullable, ImportMixin):
|
||||||
def datasources(self):
|
def datasources(self):
|
||||||
return {slc.datasource for slc in self.slices}
|
return {slc.datasource for slc in self.slices}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def charts(self):
|
||||||
|
return [slc.chart for slc in self.slices]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sqla_metadata(self):
|
def sqla_metadata(self):
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
|
@ -443,7 +451,7 @@ class Dashboard(Model, AuditMixinNullable, ImportMixin):
|
||||||
return metadata.reflect()
|
return metadata.reflect()
|
||||||
|
|
||||||
def dashboard_link(self):
|
def dashboard_link(self):
|
||||||
title = escape(self.dashboard_title)
|
title = escape(self.dashboard_title or '<empty>')
|
||||||
return Markup(f'<a href="{self.url}">{title}</a>')
|
return Markup(f'<a href="{self.url}">{title}</a>')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -572,7 +572,7 @@ class DashboardModelView(SupersetModelView, DeleteMixin): # noqa
|
||||||
edit_columns = [
|
edit_columns = [
|
||||||
'dashboard_title', 'slug', 'owners', 'position_json', 'css',
|
'dashboard_title', 'slug', 'owners', 'position_json', 'css',
|
||||||
'json_metadata']
|
'json_metadata']
|
||||||
show_columns = edit_columns + ['table_names', 'slices']
|
show_columns = edit_columns + ['table_names', 'charts']
|
||||||
search_columns = ('dashboard_title', 'slug', 'owners')
|
search_columns = ('dashboard_title', 'slug', 'owners')
|
||||||
add_columns = edit_columns
|
add_columns = edit_columns
|
||||||
base_order = ('changed_on', 'desc')
|
base_order = ('changed_on', 'desc')
|
||||||
|
@ -599,7 +599,7 @@ class DashboardModelView(SupersetModelView, DeleteMixin): # noqa
|
||||||
'dashboard_link': _('Dashboard'),
|
'dashboard_link': _('Dashboard'),
|
||||||
'dashboard_title': _('Title'),
|
'dashboard_title': _('Title'),
|
||||||
'slug': _('Slug'),
|
'slug': _('Slug'),
|
||||||
'slices': _('Charts'),
|
'charts': _('Charts'),
|
||||||
'owners': _('Owners'),
|
'owners': _('Owners'),
|
||||||
'creator': _('Creator'),
|
'creator': _('Creator'),
|
||||||
'modified': _('Modified'),
|
'modified': _('Modified'),
|
||||||
|
|
Loading…
Reference in New Issue