mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
Fix raw HTML in SliceAdder (#7338)
This commit is contained in:
parent
f58e7b204e
commit
fef5b5efb0
@ -77,6 +77,7 @@ export function fetchAllSlices(userId) {
|
||||
description_markdown: slice.description_markeddown,
|
||||
viz_type: slice.viz_type,
|
||||
modified: slice.modified,
|
||||
changed_on_humanized: slice.changed_on_humanized,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
@ -170,7 +170,6 @@ class SliceAdder extends React.Component {
|
||||
chartId: cellData.slice_id,
|
||||
sliceName: cellData.slice_name,
|
||||
};
|
||||
|
||||
return (
|
||||
<DragDroppable
|
||||
key={key}
|
||||
@ -202,7 +201,7 @@ class SliceAdder extends React.Component {
|
||||
innerRef={dragSourceRef}
|
||||
style={style}
|
||||
sliceName={cellData.slice_name}
|
||||
lastModified={cellData.modified}
|
||||
lastModified={cellData.changed_on_humanized}
|
||||
visType={cellData.viz_type}
|
||||
datasourceLink={cellData.datasource_link}
|
||||
isSelected={isSelected}
|
||||
|
@ -243,6 +243,7 @@ class Slice(Model, AuditMixinNullable, ImportMixin):
|
||||
'slice_name': self.slice_name,
|
||||
'slice_url': self.slice_url,
|
||||
'modified': self.modified(),
|
||||
'changed_on_humanized': self.changed_on_humanized,
|
||||
'changed_on': self.changed_on.isoformat(),
|
||||
}
|
||||
|
||||
|
@ -288,10 +288,13 @@ class AuditMixinNullable(AuditMixin):
|
||||
def changed_on_(self):
|
||||
return Markup(f'<span class="no-wrap">{self.changed_on}</span>')
|
||||
|
||||
@property
|
||||
def changed_on_humanized(self):
|
||||
return humanize.naturaltime(datetime.now() - self.changed_on)
|
||||
|
||||
@renders('changed_on')
|
||||
def modified(self):
|
||||
time_str = humanize.naturaltime(datetime.now() - self.changed_on)
|
||||
return Markup(f'<span class="no-wrap">{time_str}</span>')
|
||||
return Markup(f'<span class="no-wrap">{self.changed_on_humanized}</span>')
|
||||
|
||||
|
||||
class QueryResult(object):
|
||||
|
@ -576,7 +576,8 @@ class SliceAsync(SliceModelView): # noqa
|
||||
route_base = '/sliceasync'
|
||||
list_columns = [
|
||||
'id', 'slice_link', 'viz_type', 'slice_name',
|
||||
'creator', 'modified', 'icons']
|
||||
'creator', 'modified', 'icons', 'changed_on_humanized',
|
||||
]
|
||||
label_columns = {
|
||||
'icons': ' ',
|
||||
'slice_link': _('Chart'),
|
||||
@ -592,7 +593,8 @@ class SliceAddView(SliceModelView): # noqa
|
||||
'id', 'slice_name', 'slice_url', 'edit_url', 'viz_type', 'params',
|
||||
'description', 'description_markeddown', 'datasource_id', 'datasource_type',
|
||||
'datasource_name_text', 'datasource_link',
|
||||
'owners', 'modified', 'changed_on']
|
||||
'owners', 'modified', 'changed_on', 'changed_on_humanized',
|
||||
]
|
||||
|
||||
|
||||
appbuilder.add_view_no_menu(SliceAddView)
|
||||
|
Loading…
Reference in New Issue
Block a user