105105 :preferences =" dataQuery.preferences"
106106 :columns =" columns"
107107 :with-variables-editor =" queryType === 'api'"
108+ :with-iframe =" queryType === 'api'"
108109 style =" height : 100% "
109110 @close =" toggleSettings"
110111 />
184185 fix
185186 />
186187 <div
187- v-else-if =" !data.length && !errors.length && !dataHTML"
188+ v-else-if =" !data.length && !errors.length && !dataHTML && !isIframe "
188189 class =" d-flex justify-content-center align-items-center h-100"
189190 >
190191 {{ i18n['no_data'] }}
203204 :preferences =" dataQuery.preferences"
204205 @settings =" toggleSettings"
205206 />
207+ <div
208+ v-else-if =" isIframe"
209+ style =" overflow : hidden ; height : 100% "
210+ >
211+ <iframe
212+ :src =" iframeSrc"
213+ :style =" { height: withFooter ? '100%' : '100%', border: 0, width: '100%' }"
214+ />
215+ </div >
206216 <div
207217 v-else-if =" dataHTML"
208218 class =" h-100 overflow-auto"
@@ -304,7 +314,7 @@ import QueryForm from '../components/form'
304314import Settings from ' ../components/settings'
305315import throttle from ' view3/src/utils/throttle'
306316import VariablesForm from ' ../components/variables_form'
307- import { titleize } from ' utils/scripts/string'
317+ import { interpolateForQueryParams , titleize } from ' utils/scripts/string'
308318import singularize from ' inflected/src/singularize'
309319import { widthLessThan } from ' utils/scripts/dimensions'
310320import { modelNameMap } from ' data_resources/scripts/schema'
@@ -359,7 +369,8 @@ export default {
359369 errors: [],
360370 columns: [],
361371 data: [],
362- dataHTML: ' '
372+ dataHTML: ' ' ,
373+ iframeSrc: ' '
363374 }
364375 },
365376 computed: {
@@ -377,6 +388,9 @@ export default {
377388 showApiUi () {
378389 return this .queryType === ' api' || (! this .isNewPage && this .dataQuery .preferences .api_path )
379390 },
391+ isIframe () {
392+ return this .dataQuery .preferences .visualization === ' iframe'
393+ },
380394 queryTypes () {
381395 return [
382396 { label: this .i18n .sql , value: ' sql' },
@@ -696,7 +710,13 @@ export default {
696710 loadQueryData () {
697711 this .maybeUpdateVariablesQueryParams ()
698712
699- if (this .queryType === ' api' ) {
713+ if (this .queryType === ' api' && this .isIframe ) {
714+ const [apiPath , queryParams ] = interpolateForQueryParams (this .dataQuery .preferences .api_path , this .variablesData )
715+
716+ this .iframeSrc = ` ${ apiPath} ?${ new URLSearchParams (queryParams).toString ()} `
717+
718+ return Promise .resolve ({ src: this .iframeSrc })
719+ } else if (this .queryType === ' api' ) {
700720 return this .runApiQuery ()
701721 } else {
702722 if (this .dataQuery .sql_body && (this .isEdited || ! this .query .id )) {
0 commit comments