105
105
:preferences =" dataQuery.preferences"
106
106
:columns =" columns"
107
107
:with-variables-editor =" queryType === 'api'"
108
+ :with-iframe =" queryType === 'api'"
108
109
style =" height : 100% "
109
110
@close =" toggleSettings"
110
111
/>
184
185
fix
185
186
/>
186
187
<div
187
- v-else-if =" !data.length && !errors.length && !dataHTML"
188
+ v-else-if =" !data.length && !errors.length && !dataHTML && !isIframe "
188
189
class =" d-flex justify-content-center align-items-center h-100"
189
190
>
190
191
{{ i18n['no_data'] }}
203
204
:preferences =" dataQuery.preferences"
204
205
@settings =" toggleSettings"
205
206
/>
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 >
206
216
<div
207
217
v-else-if =" dataHTML"
208
218
class =" h-100 overflow-auto"
@@ -304,7 +314,7 @@ import QueryForm from '../components/form'
304
314
import Settings from ' ../components/settings'
305
315
import throttle from ' view3/src/utils/throttle'
306
316
import VariablesForm from ' ../components/variables_form'
307
- import { titleize } from ' utils/scripts/string'
317
+ import { interpolateForQueryParams , titleize } from ' utils/scripts/string'
308
318
import singularize from ' inflected/src/singularize'
309
319
import { widthLessThan } from ' utils/scripts/dimensions'
310
320
import { modelNameMap } from ' data_resources/scripts/schema'
@@ -359,7 +369,8 @@ export default {
359
369
errors: [],
360
370
columns: [],
361
371
data: [],
362
- dataHTML: ' '
372
+ dataHTML: ' ' ,
373
+ iframeSrc: ' '
363
374
}
364
375
},
365
376
computed: {
@@ -377,6 +388,9 @@ export default {
377
388
showApiUi () {
378
389
return this .queryType === ' api' || (! this .isNewPage && this .dataQuery .preferences .api_path )
379
390
},
391
+ isIframe () {
392
+ return this .dataQuery .preferences .visualization === ' iframe'
393
+ },
380
394
queryTypes () {
381
395
return [
382
396
{ label: this .i18n .sql , value: ' sql' },
@@ -696,7 +710,13 @@ export default {
696
710
loadQueryData () {
697
711
this .maybeUpdateVariablesQueryParams ()
698
712
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' ) {
700
720
return this .runApiQuery ()
701
721
} else {
702
722
if (this .dataQuery .sql_body && (this .isEdited || ! this .query .id )) {
0 commit comments