mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
Add translatable columns in label_columns of the view (#3032)
* add translatable columns in label_columns of the view
* display the verbose_name of columns in list view, just like in the metrics list
* Revert "display the verbose_name of columns in list view, just like in the metrics list"
This reverts commit f815d3b3ed
.
This commit is contained in:
parent
0c5db55d55
commit
0d4137d21e
@ -91,7 +91,8 @@ class TableColumnInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
'expression': _("Expression"),
|
||||
'is_dttm': _("Is temporal"),
|
||||
'python_date_format': _("Datetime Format"),
|
||||
'database_expression': _("Database Expression")
|
||||
'database_expression': _("Database Expression"),
|
||||
'type': _('Type'),
|
||||
}
|
||||
appbuilder.add_view_no_menu(TableColumnInlineView)
|
||||
|
||||
@ -133,6 +134,8 @@ class SqlMetricInlineView(CompactCRUDMixin, SupersetModelView): # noqa
|
||||
'metric_type': _("Type"),
|
||||
'expression': _("SQL Expression"),
|
||||
'table': _("Table"),
|
||||
'd3format': _("D3 Format"),
|
||||
'is_restricted': _('Is Restricted')
|
||||
}
|
||||
|
||||
def post_add(self, metric):
|
||||
@ -216,11 +219,14 @@ class TableModelView(DatasourceModelView, DeleteMixin): # noqa
|
||||
'changed_on_': _("Last Changed"),
|
||||
'filter_select_enabled': _("Enable Filter Select"),
|
||||
'schema': _("Schema"),
|
||||
'default_endpoint': _(
|
||||
"Redirects to this endpoint when clicking on the datasource "
|
||||
"from the datasource list"),
|
||||
'default_endpoint': _('Default Endpoint'),
|
||||
'offset': _("Offset"),
|
||||
'cache_timeout': _("Cache Timeout"),
|
||||
'table_name': _("Table Name"),
|
||||
'fetch_values_predicate': _('Fetch Values Predicate'),
|
||||
'owner': _("Owner"),
|
||||
'main_dttm_col': _("Main Datetime Column"),
|
||||
'description': _('Description'),
|
||||
}
|
||||
|
||||
def pre_add(self, table):
|
||||
|
@ -247,6 +247,8 @@ class DatabaseView(SupersetModelView, DeleteMixin): # noqa
|
||||
'sqlalchemy_uri': _("SQLAlchemy URI"),
|
||||
'cache_timeout': _("Cache Timeout"),
|
||||
'extra': _("Extra"),
|
||||
'allow_run_sync': _("Allow Run Sync"),
|
||||
'allow_run_async': _("Allow Run Async"),
|
||||
}
|
||||
|
||||
def pre_add(self, db):
|
||||
@ -333,7 +335,7 @@ class SliceModelView(SupersetModelView, DeleteMixin): # noqa
|
||||
|
||||
can_add = False
|
||||
label_columns = {
|
||||
'datasource_link': 'Datasource',
|
||||
'datasource_link': _('Datasource'),
|
||||
}
|
||||
search_columns = (
|
||||
'slice_name', 'description', 'viz_type', 'owners',
|
||||
@ -2307,6 +2309,9 @@ class CssTemplateModelView(SupersetModelView, DeleteMixin):
|
||||
list_columns = ['template_name']
|
||||
edit_columns = ['template_name', 'css']
|
||||
add_columns = edit_columns
|
||||
label_columns = {
|
||||
'template_name': _('Template Name'),
|
||||
}
|
||||
|
||||
|
||||
class CssTemplateAsyncModelView(CssTemplateModelView):
|
||||
|
@ -14,6 +14,13 @@ from .base import SupersetModelView, BaseSupersetView, DeleteMixin
|
||||
class QueryView(SupersetModelView):
|
||||
datamodel = SQLAInterface(Query)
|
||||
list_columns = ['user', 'database', 'status', 'start_time', 'end_time']
|
||||
label_columns = {
|
||||
'user': _('User'),
|
||||
'database': _('Database'),
|
||||
'status': _('Status'),
|
||||
'start_time': _('Start Time'),
|
||||
'end_time': _('End Time'),
|
||||
}
|
||||
|
||||
appbuilder.add_view(
|
||||
QueryView,
|
||||
@ -42,6 +49,16 @@ class SavedQueryView(SupersetModelView, DeleteMixin):
|
||||
add_columns = ['label', 'database', 'description', 'sql']
|
||||
edit_columns = add_columns
|
||||
base_order = ('changed_on', 'desc')
|
||||
label_columns = {
|
||||
'label': _('Label'),
|
||||
'user': _('User'),
|
||||
'database': _('Database'),
|
||||
'description': _('Description'),
|
||||
'modified': _('Modified'),
|
||||
'end_time': _('End Time'),
|
||||
'pop_tab_link': _('Pop Tab Link'),
|
||||
'changed_on': _('Changed on'),
|
||||
}
|
||||
|
||||
def pre_add(self, obj):
|
||||
obj.user = g.user
|
||||
|
Loading…
Reference in New Issue
Block a user