mirror of https://github.com/apache/superset.git
add title description to model view (#3045)
* add title description to model view * add missing import
This commit is contained in:
parent
b301ba1f57
commit
7654eef110
|
@ -24,6 +24,12 @@ from . import models
|
|||
|
||||
class DruidColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
datamodel = SQLAInterface(models.DruidColumn)
|
||||
|
||||
list_title = _('List Druid Column')
|
||||
show_title = _('Show Druid Column')
|
||||
add_title = _('Add Druid Column')
|
||||
edit_title = _('Edit Druid Column')
|
||||
|
||||
edit_columns = [
|
||||
'column_name', 'description', 'dimension_spec_json', 'datasource',
|
||||
'groupby', 'filterable', 'count_distinct', 'sum', 'min', 'max']
|
||||
|
@ -70,6 +76,12 @@ appbuilder.add_view_no_menu(DruidColumnInlineView)
|
|||
|
||||
class DruidMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
datamodel = SQLAInterface(models.DruidMetric)
|
||||
|
||||
list_title = _('List Druid Metric')
|
||||
show_title = _('Show Druid Metric')
|
||||
add_title = _('Add Druid Metric')
|
||||
edit_title = _('Edit Druid Metric')
|
||||
|
||||
list_columns = ['metric_name', 'verbose_name', 'metric_type']
|
||||
edit_columns = [
|
||||
'metric_name', 'description', 'verbose_name', 'metric_type', 'json',
|
||||
|
@ -112,6 +124,12 @@ appbuilder.add_view_no_menu(DruidMetricInlineView)
|
|||
|
||||
class DruidClusterModelView(SupersetModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.DruidCluster)
|
||||
|
||||
list_title = _('List Druid Cluster')
|
||||
show_title = _('Show Druid Cluster')
|
||||
add_title = _('Add Druid Cluster')
|
||||
edit_title = _('Edit Druid Cluster')
|
||||
|
||||
add_columns = [
|
||||
'verbose_name', 'coordinator_host', 'coordinator_port',
|
||||
'coordinator_endpoint', 'broker_host', 'broker_port',
|
||||
|
@ -151,6 +169,12 @@ appbuilder.add_view(
|
|||
|
||||
class DruidDatasourceModelView(DatasourceModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.DruidDatasource)
|
||||
|
||||
list_title = _('List Druid Datasource')
|
||||
show_title = _('Show Druid Datasource')
|
||||
add_title = _('Add Druid Datasource')
|
||||
edit_title = _('Edit Druid Datasource')
|
||||
|
||||
list_widget = ListWidgetWithCheckboxes
|
||||
list_columns = [
|
||||
'datasource_link', 'cluster', 'changed_by_', 'modified']
|
||||
|
|
|
@ -24,6 +24,12 @@ from . import models
|
|||
|
||||
class TableColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
datamodel = SQLAInterface(models.TableColumn)
|
||||
|
||||
list_title = _('List Columns')
|
||||
show_title = _('Show Column')
|
||||
add_title = _('Add Column')
|
||||
edit_title = _('Edit Column')
|
||||
|
||||
can_delete = False
|
||||
list_widget = ListWidgetWithCheckboxes
|
||||
edit_columns = [
|
||||
|
@ -92,6 +98,12 @@ appbuilder.add_view_no_menu(TableColumnInlineView)
|
|||
|
||||
class SqlMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
datamodel = SQLAInterface(models.SqlMetric)
|
||||
|
||||
list_title = _('List Metrics')
|
||||
show_title = _('Show Metric')
|
||||
add_title = _('Add Metric')
|
||||
edit_title = _('Edit Metric')
|
||||
|
||||
list_columns = ['metric_name', 'verbose_name', 'metric_type']
|
||||
edit_columns = [
|
||||
'metric_name', 'description', 'verbose_name', 'metric_type',
|
||||
|
@ -136,6 +148,12 @@ appbuilder.add_view_no_menu(SqlMetricInlineView)
|
|||
|
||||
class TableModelView(DatasourceModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.SqlaTable)
|
||||
|
||||
list_title = _('List Tables')
|
||||
show_title = _('Show Table')
|
||||
add_title = _('Add Table')
|
||||
edit_title = _('Edit Table')
|
||||
|
||||
list_columns = [
|
||||
'link', 'database',
|
||||
'changed_by_', 'modified']
|
||||
|
|
|
@ -170,6 +170,12 @@ def generate_download_headers(extension):
|
|||
|
||||
class DatabaseView(SupersetModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.Database)
|
||||
|
||||
list_title = _('List Databases')
|
||||
show_title = _('Show Database')
|
||||
add_title = _('Add Database')
|
||||
edit_title = _('Edit Database')
|
||||
|
||||
list_columns = [
|
||||
'database_name', 'backend', 'allow_run_sync', 'allow_run_async',
|
||||
'allow_dml', 'creator', 'modified']
|
||||
|
@ -319,6 +325,12 @@ appbuilder.add_view(
|
|||
|
||||
class SliceModelView(SupersetModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.Slice)
|
||||
|
||||
list_title = _('List Slices')
|
||||
show_title = _('Show Slice')
|
||||
add_title = _('Add Slice')
|
||||
edit_title = _('Edit Slice')
|
||||
|
||||
can_add = False
|
||||
label_columns = {
|
||||
'datasource_link': 'Datasource',
|
||||
|
@ -415,6 +427,12 @@ appbuilder.add_view_no_menu(SliceAddView)
|
|||
|
||||
class DashboardModelView(SupersetModelView, DeleteMixin): # noqa
|
||||
datamodel = SQLAInterface(models.Dashboard)
|
||||
|
||||
list_title = _('List Dashboards')
|
||||
show_title = _('Show Dashboard')
|
||||
add_title = _('Add Dashboard')
|
||||
edit_title = _('Edit Dashboard')
|
||||
|
||||
list_columns = ['dashboard_link', 'creator', 'modified']
|
||||
edit_columns = [
|
||||
'dashboard_title', 'slug', 'slices', 'owners', 'position_json', 'css',
|
||||
|
|
|
@ -4,6 +4,7 @@ from flask_appbuilder import expose
|
|||
from flask_appbuilder.models.sqla.interface import SQLAInterface
|
||||
|
||||
from flask_babel import gettext as __
|
||||
from flask_babel import lazy_gettext as _
|
||||
|
||||
from superset import appbuilder
|
||||
from superset.models.sql_lab import Query, SavedQuery
|
||||
|
@ -25,6 +26,12 @@ appbuilder.add_view(
|
|||
|
||||
class SavedQueryView(SupersetModelView, DeleteMixin):
|
||||
datamodel = SQLAInterface(SavedQuery)
|
||||
|
||||
list_title = _('List Saved Query')
|
||||
show_title = _('Show Saved Query')
|
||||
add_title = _('Add Saved Query')
|
||||
edit_title = _('Edit Saved Query')
|
||||
|
||||
list_columns = [
|
||||
'label', 'user', 'database', 'schema', 'description',
|
||||
'modified', 'pop_tab_link']
|
||||
|
|
Loading…
Reference in New Issue