@@ -455,18 +455,19 @@ export class MetabaseController extends AppController<MetabaseAppState> {
455455 labelDone : "Edited query" ,
456456 labelTask : "Edited SQL query" ,
457457 description : "Edits the SQL query in the Metabase SQL editor with support for template tags and parameters." ,
458- renderBody : ( { explanation, sql_edits, template_tags= { } , parameters= [ ] } : { explanation : string , sql_edits : SQLEdits , template_tags ?: object , parameters ?: any [ ] } , appState : MetabaseAppStateSQLEditor | MetabaseAppStateSQLEditorV2 ) => {
458+ renderBody : ( { explanation, sql_edits, template_tags= { } , parameters= [ ] , parameterValues = [ ] } : { explanation : string , sql_edits : SQLEdits , template_tags ?: object , parameters ?: any [ ] , parameterValues ?: Array < { id : string , value : string [ ] } > } , appState : MetabaseAppStateSQLEditor | MetabaseAppStateSQLEditorV2 ) => {
459459 const currentQuery = appState ?. currentCard ?. dataset_query ?. native ?. query || appState ?. sqlQuery || "" ;
460460 const currentTemplateTags = appState ?. currentCard ?. dataset_query ?. native ?. [ 'template-tags' ] || { } ;
461461 const currentParameters = appState ?. currentCard ?. parameters || [ ] ;
462462 const newQuery = applySQLEdits ( currentQuery , sql_edits ) ;
463- return { text : explanation , code : newQuery , oldCode : currentQuery , language : "sql" , extraArgs : { old : { template_tags : currentTemplateTags , parameters : currentParameters } , new : { template_tags, parameters} } }
463+ const paramValuesInfo = parameterValues && parameterValues . length > 0 ? ` with ${ parameterValues . length } parameter values` : '' ;
464+ return { text : `${ explanation } ${ paramValuesInfo } ` , code : newQuery , oldCode : currentQuery , language : "sql" , extraArgs : { old : { template_tags : currentTemplateTags , parameters : currentParameters } , new : { template_tags, parameters, parameterValues} } }
464465 }
465466 } )
466- async EditAndExecuteQuery ( { sql_edits, _ctes = [ ] , explanation = "" , template_tags= { } , parameters= [ ] } : { sql_edits : SQLEdits , _ctes ?: CTE [ ] , explanation ?: string , template_tags ?: object , parameters ?: any [ ] } ) {
467+ async EditAndExecuteQuery ( { sql_edits, _ctes = [ ] , explanation = "" , template_tags= { } , parameters= [ ] , parameterValues = [ ] } : { sql_edits : SQLEdits , _ctes ?: CTE [ ] , explanation ?: string , template_tags ?: object , parameters ?: any [ ] , parameterValues ?: Array < { id : string , value : string [ ] } > } ) {
467468 let sql = await getCurrentQuery ( ) || ""
468469 sql = applySQLEdits ( sql , sql_edits ) ;
469- return await this . ExecuteQuery ( { sql, _ctes, explanation, template_tags, parameters } ) ;
470+ return await this . ExecuteQuery ( { sql, _ctes, explanation, template_tags, parameters, parameterValues } ) ;
470471 }
471472
472473 @Action ( {
0 commit comments