@@ -7,20 +7,32 @@ use thaw::{Modal, ModalFooter};
77use crate :: store:: queries:: QueriesStore ;
88
99#[ component]
10- pub fn AddCustomQuery ( show : RwSignal < bool > , project_id : String , driver : Drivers ) -> impl IntoView {
10+ pub fn AddCustomQuery (
11+ show : RwSignal < bool > ,
12+ project_id : String ,
13+ driver : Drivers ,
14+ database : String ,
15+ ) -> impl IntoView {
1116 let project_id = Rc :: new ( project_id) ;
1217 let project_id_clone = project_id. clone ( ) ;
1318 let query_store = expect_context :: < QueriesStore > ( ) ;
1419 let ( title, set_title) = create_signal ( String :: new ( ) ) ;
1520 let insert_query = create_action (
16- move |( query_db, project_id, title, driver) : & ( QueriesStore , String , String , Drivers ) | {
21+ move |( query_db, project_id, title, driver, database) : & (
22+ QueriesStore ,
23+ String ,
24+ String ,
25+ Drivers ,
26+ String ,
27+ ) | {
1728 let query_db_clone = * query_db;
1829 let project_id = project_id. clone ( ) ;
1930 let title = title. clone ( ) ;
2031 let driver = * driver;
32+ let database = database. clone ( ) ;
2133 async move {
2234 query_db_clone
23- . insert_query ( & project_id, & title, & driver)
35+ . insert_query ( & project_id, & title, & driver, & database )
2436 . await ;
2537 }
2638 } ,
@@ -45,9 +57,16 @@ pub fn AddCustomQuery(show: RwSignal<bool>, project_id: String, driver: Drivers)
4557 class="px-4 py-2 border-1 border-neutral-200 hover:bg-neutral-200 rounded-md"
4658 on: click={
4759 let project_id = project_id. clone( ) ;
60+ let database = database. clone( ) ;
4861 move |_| {
4962 insert_query
50- . dispatch( ( query_store, project_id. to_string( ) , title( ) , driver) ) ;
63+ . dispatch( (
64+ query_store,
65+ project_id. to_string( ) ,
66+ title( ) ,
67+ driver,
68+ database. to_string( ) ,
69+ ) ) ;
5170 show. set( false ) ;
5271 }
5372 }
0 commit comments