Hi,

In the charts there’s an explicit embedding functionality generating Iframe 
code:

<iframe
  width="600"
  height="400"
  seamless
  frameBorder="0"
  scrolling="no"
  
src="http://www.my.url.com/superset/explore/?form_data=%7B%22datasource%22%3A%222__table%22%2C%22viz_type%22%3A%22big_number%22%2C%22
 
<http://superset.internal.us-east-1.production.spearad.video/superset/explore/?form_data={%22datasource%22:%222__table%22,%22viz_type%22:%22big_number%22,%22slice_id%22:306,%22url_params%22:{},%22time_range_endpoints%22:[%22unknown%22,%22inclusive%22],%22granularity_sqla%22:%22delivery_date%22,%22time_grain_sqla%22:%22P1Y%22,%22time_range%22:%22No+filter%22,%22metric%22:{%22aggregate%22:null,%22column%22:null,%22expressionType%22:%22SQL%22,%22fromFormData%22:true,%22hasCustomLabel%22:true,%22label%22:%22Revenue%22,%22optionName%22:%22metric_p07aort2umb_gyzmhz31uns%22,%22sqlExpression%22:%22SUM(revenue)/1000000%22},%22adhoc_filters%22:[],%22y_axis_format%22:%22$,.2f%22,%22show_trend_line%22:false,%22start_y_axis_at_zero%22:false,%22color_picker%22:{%22a%22:1,%22b%22:212,%22g%22:184,%22r%22:186},%22header_font_size%22:0.5,%22subheader_font_size%22:0.125,%22rolling_type%22:%22None%22}&standalone=true&height=400>slice_id
 
<http://superset.internal.us-east-1.production.spearad.video/superset/explore/?form_data={%22datasource%22:%222__table%22,%22viz_type%22:%22big_number%22,%22slice_id%22:306,%22url_params%22:{},%22time_range_endpoints%22:[%22unknown%22,%22inclusive%22],%22granularity_sqla%22:%22delivery_date%22,%22time_grain_sqla%22:%22P1Y%22,%22time_range%22:%22No+filter%22,%22metric%22:{%22aggregate%22:null,%22column%22:null,%22expressionType%22:%22SQL%22,%22fromFormData%22:true,%22hasCustomLabel%22:true,%22label%22:%22Revenue%22,%22optionName%22:%22metric_p07aort2umb_gyzmhz31uns%22,%22sqlExpression%22:%22SUM(revenue)/1000000%22},%22adhoc_filters%22:[],%22y_axis_format%22:%22$,.2f%22,%22show_trend_line%22:false,%22start_y_axis_at_zero%22:false,%22color_picker%22:{%22a%22:1,%22b%22:212,%22g%22:184,%22r%22:186},%22header_font_size%22:0.5,%22subheader_font_size%22:0.125,%22rolling_type%22:%22None%22}&standalone=true&height=400>%22%3A
 
<http://superset.internal.us-east-1.production.spearad.video/superset/explore/?form_data={%22datasource%22:%222__table%22,%22viz_type%22:%22big_number%22,%22slice_id%22:306,%22url_params%22:{},%22time_range_endpoints%22:[%22unknown%22,%22inclusive%22],%22granularity_sqla%22:%22delivery_date%22,%22time_grain_sqla%22:%22P1Y%22,%22time_range%22:%22No+filter%22,%22metric%22:{%22aggregate%22:null,%22column%22:null,%22expressionType%22:%22SQL%22,%22fromFormData%22:true,%22hasCustomLabel%22:true,%22label%22:%22Revenue%22,%22optionName%22:%22metric_p07aort2umb_gyzmhz31uns%22,%22sqlExpression%22:%22SUM(revenue)/1000000%22},%22adhoc_filters%22:[],%22y_axis_format%22:%22$,.2f%22,%22show_trend_line%22:false,%22start_y_axis_at_zero%22:false,%22color_picker%22:{%22a%22:1,%22b%22:212,%22g%22:184,%22r%22:186},%22header_font_size%22:0.5,%22subheader_font_size%22:0.125,%22rolling_type%22:%22None%22}&standalone=true&height=400>306
 
<http://superset.internal.us-east-1.production.spearad.video/superset/explore/?form_data={%22datasource%22:%222__table%22,%22viz_type%22:%22big_number%22,%22slice_id%22:306,%22url_params%22:{},%22time_range_endpoints%22:[%22unknown%22,%22inclusive%22],%22granularity_sqla%22:%22delivery_date%22,%22time_grain_sqla%22:%22P1Y%22,%22time_range%22:%22No+filter%22,%22metric%22:{%22aggregate%22:null,%22column%22:null,%22expressionType%22:%22SQL%22,%22fromFormData%22:true,%22hasCustomLabel%22:true,%22label%22:%22Revenue%22,%22optionName%22:%22metric_p07aort2umb_gyzmhz31uns%22,%22sqlExpression%22:%22SUM(revenue)/1000000%22},%22adhoc_filters%22:[],%22y_axis_format%22:%22$,.2f%22,%22show_trend_line%22:false,%22start_y_axis_at_zero%22:false,%22color_picker%22:{%22a%22:1,%22b%22:212,%22g%22:184,%22r%22:186},%22header_font_size%22:0.5,%22subheader_font_size%22:0.125,%22rolling_type%22:%22None%22}&standalone=true&height=400>%2C%22url_params%22%3A%7B%7D%2C%22time_range_endpoints%22%3A%5B%22unknown%22%2C%22inclusive%22%5D%2C%22granularity_sqla%22%3A%22delivery_date%22%2C%22time_grain_sqla%22%3A%22P1Y%22%2C%22time_range%22%3A%22No+filter%22%2C%22metric%22%3A%7B%22aggregate%22%3Anull%2C%22column%22%3Anull%2C%22expressionType%22%3A%22SQL%22%2C%22fromFormData%22%3Atrue%2C%22hasCustomLabel%22%3Atrue%2C%22label%22%3A%22Revenue%22%2C%22optionName%22%3A%22metric_p07aort2umb_gyzmhz31uns%22%2C%22sqlExpression%22%3A%22SUM%28revenue%29%2F1000000%22%7D%2C%22adhoc_filters%22%3A%5B%5D%2C%22y_axis_format%22%3A%22%24%2C.2f%22%2C%22show_trend_line%22%3Afalse%2C%22start_y_axis_at_zero%22%3Afalse%2C%22color_picker%22%3A%7B%22a%22%3A1%2C%22b%22%3A212%2C%22g%22%3A184%2C%22r%22%3A186%7D%2C%22header_font_size%22%3A0.5%2C%22subheader_font_size%22%3A0.125%2C%22rolling_type%22%3A%22None%22%7D&standalone=true&height=400
 
<http://superset.internal.us-east-1.production.spearad.video/superset/explore/?form_data={%22datasource%22:%222__table%22,%22viz_type%22:%22big_number%22,%22slice_id%22:306,%22url_params%22:{},%22time_range_endpoints%22:[%22unknown%22,%22inclusive%22],%22granularity_sqla%22:%22delivery_date%22,%22time_grain_sqla%22:%22P1Y%22,%22time_range%22:%22No+filter%22,%22metric%22:{%22aggregate%22:null,%22column%22:null,%22expressionType%22:%22SQL%22,%22fromFormData%22:true,%22hasCustomLabel%22:true,%22label%22:%22Revenue%22,%22optionName%22:%22metric_p07aort2umb_gyzmhz31uns%22,%22sqlExpression%22:%22SUM(revenue)/1000000%22},%22adhoc_filters%22:[],%22y_axis_format%22:%22$,.2f%22,%22show_trend_line%22:false,%22start_y_axis_at_zero%22:false,%22color_picker%22:{%22a%22:1,%22b%22:212,%22g%22:184,%22r%22:186},%22header_font_size%22:0.5,%22subheader_font_size%22:0.125,%22rolling_type%22:%22None%22}&standalone=true&height=400>"
>
</iframe>

It seems like there’s an ID hardcoded (marked red above) - which is very 
unfortunate when exporting and importing again and the embedding is in another 
application. In this case ids are different after import.

I found a ticket about adding Slug to a chart, but it didn’t get too much 
attention. 
https://github.com/apache/incubator-superset/issues/6537 
<https://github.com/apache/incubator-superset/issues/6537>

Is there currently a way to address this better if I wanted to use embedding 
code in dev, staging and prod environments?  
Cloning the complete Superset database seems overkill for this. Also it won’t 
really work if you let production add charts by users and create some major 
charts in dev you want to move to prod after some thorough testing.

I’m glad for any suggestion.

Thanks,
Dennis


Reply via email to