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,
|
description_markdown: slice.description_markeddown,
|
||||||
viz_type: slice.viz_type,
|
viz_type: slice.viz_type,
|
||||||
modified: slice.modified,
|
modified: slice.modified,
|
||||||
|
changed_on_humanized: slice.changed_on_humanized,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -170,7 +170,6 @@ class SliceAdder extends React.Component {
|
|||||||
chartId: cellData.slice_id,
|
chartId: cellData.slice_id,
|
||||||
sliceName: cellData.slice_name,
|
sliceName: cellData.slice_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DragDroppable
|
<DragDroppable
|
||||||
key={key}
|
key={key}
|
||||||
@ -202,7 +201,7 @@ class SliceAdder extends React.Component {
|
|||||||
innerRef={dragSourceRef}
|
innerRef={dragSourceRef}
|
||||||
style={style}
|
style={style}
|
||||||
sliceName={cellData.slice_name}
|
sliceName={cellData.slice_name}
|
||||||
lastModified={cellData.modified}
|
lastModified={cellData.changed_on_humanized}
|
||||||
visType={cellData.viz_type}
|
visType={cellData.viz_type}
|
||||||
datasourceLink={cellData.datasource_link}
|
datasourceLink={cellData.datasource_link}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
|
@ -243,6 +243,7 @@ class Slice(Model, AuditMixinNullable, ImportMixin):
|
|||||||
'slice_name': self.slice_name,
|
'slice_name': self.slice_name,
|
||||||
'slice_url': self.slice_url,
|
'slice_url': self.slice_url,
|
||||||
'modified': self.modified(),
|
'modified': self.modified(),
|
||||||
|
'changed_on_humanized': self.changed_on_humanized,
|
||||||
'changed_on': self.changed_on.isoformat(),
|
'changed_on': self.changed_on.isoformat(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,10 +288,13 @@ class AuditMixinNullable(AuditMixin):
|
|||||||
def changed_on_(self):
|
def changed_on_(self):
|
||||||
return Markup(f'<span class="no-wrap">{self.changed_on}</span>')
|
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')
|
@renders('changed_on')
|
||||||
def modified(self):
|
def modified(self):
|
||||||
time_str = humanize.naturaltime(datetime.now() - self.changed_on)
|
return Markup(f'<span class="no-wrap">{self.changed_on_humanized}</span>')
|
||||||
return Markup(f'<span class="no-wrap">{time_str}</span>')
|
|
||||||
|
|
||||||
|
|
||||||
class QueryResult(object):
|
class QueryResult(object):
|
||||||
|
@ -576,7 +576,8 @@ class SliceAsync(SliceModelView): # noqa
|
|||||||
route_base = '/sliceasync'
|
route_base = '/sliceasync'
|
||||||
list_columns = [
|
list_columns = [
|
||||||
'id', 'slice_link', 'viz_type', 'slice_name',
|
'id', 'slice_link', 'viz_type', 'slice_name',
|
||||||
'creator', 'modified', 'icons']
|
'creator', 'modified', 'icons', 'changed_on_humanized',
|
||||||
|
]
|
||||||
label_columns = {
|
label_columns = {
|
||||||
'icons': ' ',
|
'icons': ' ',
|
||||||
'slice_link': _('Chart'),
|
'slice_link': _('Chart'),
|
||||||
@ -592,7 +593,8 @@ class SliceAddView(SliceModelView): # noqa
|
|||||||
'id', 'slice_name', 'slice_url', 'edit_url', 'viz_type', 'params',
|
'id', 'slice_name', 'slice_url', 'edit_url', 'viz_type', 'params',
|
||||||
'description', 'description_markeddown', 'datasource_id', 'datasource_type',
|
'description', 'description_markeddown', 'datasource_id', 'datasource_type',
|
||||||
'datasource_name_text', 'datasource_link',
|
'datasource_name_text', 'datasource_link',
|
||||||
'owners', 'modified', 'changed_on']
|
'owners', 'modified', 'changed_on', 'changed_on_humanized',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
appbuilder.add_view_no_menu(SliceAddView)
|
appbuilder.add_view_no_menu(SliceAddView)
|
||||||
|
Loading…
Reference in New Issue
Block a user