mirror of
https://github.com/apache/superset.git
synced 2026-06-01 13:49:21 +00:00
Adding a basic ifram viz
This commit is contained in:
@@ -288,6 +288,8 @@ class FormFactory(object):
|
||||
'Bubble Size',
|
||||
default=default_metric,
|
||||
choices=datasource.metrics_combo),
|
||||
'url': TextField(
|
||||
'URL', default='www.airbnb.com',),
|
||||
'where': TextField(
|
||||
'Custom WHERE clause', default='',
|
||||
description=(
|
||||
|
||||
20
panoramix/static/widgets/viz_iframe.js
Normal file
20
panoramix/static/widgets/viz_iframe.js
Normal file
@@ -0,0 +1,20 @@
|
||||
px.registerViz('iframe', function(slice) {
|
||||
|
||||
function refresh() {
|
||||
$('#code').attr('rows', '15')
|
||||
$.getJSON(slice.jsonEndpoint(), function(payload) {
|
||||
slice.container.html(
|
||||
'<iframe style="width:100%; height:100%;"></iframe>');
|
||||
console.log(slice);
|
||||
slice.container.find('iframe').attr('src', payload.form_data.url);
|
||||
slice.done();
|
||||
})
|
||||
.fail(function(xhr) {
|
||||
slice.error(xhr.responseText);
|
||||
});
|
||||
};
|
||||
return {
|
||||
render: refresh,
|
||||
resize: refresh,
|
||||
};
|
||||
});
|
||||
@@ -1146,6 +1146,18 @@ class FilterBoxViz(BaseViz):
|
||||
return dumps(d)
|
||||
|
||||
|
||||
class IFrameViz(BaseViz):
|
||||
viz_type = "iframe"
|
||||
verbose_name = "iFrame"
|
||||
is_timeseries = False
|
||||
js_files = ['widgets/viz_iframe.js']
|
||||
fieldsets = (
|
||||
{
|
||||
'label': None,
|
||||
'fields': ('url',)
|
||||
},)
|
||||
|
||||
|
||||
viz_types_list = [
|
||||
TableViz,
|
||||
PivotTableViz,
|
||||
@@ -1164,6 +1176,7 @@ viz_types_list = [
|
||||
SankeyViz,
|
||||
WorldMapViz,
|
||||
FilterBoxViz,
|
||||
IFrameViz,
|
||||
]
|
||||
# This dict is used to
|
||||
|
||||
viz_types = OrderedDict([(v.viz_type, v) for v in viz_types_list])
|
||||
|
||||
Reference in New Issue
Block a user