Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
harana-bot committed Mar 3, 2024
1 parent 3fc7887 commit 2b674a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src-tauri/src/handler_application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use tauri;
use crate::globals::APPLICATION_MANAGER;

#[tauri::command]
pub async fn search_applications(query: String) -> Vec<Application> {
pub async fn search_application(query: String) -> Option<Application> {
if query.len() >= 3 {
APPLICATION_MANAGER.get().unwrap().search(query.as_str()).await
} else {
vec!()
None
}
}
2 changes: 1 addition & 1 deletion src-tauri/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn invoke_handler(invoke: tauri::Invoke<Wry>) {
crate::handler_account::logout,
crate::handler_ai_models::list_ai_models,
crate::handler_ai_models::update_ai_model,
crate::handler_application::search_applications,
crate::handler_application::search_application,
crate::handler_auth::show_signup,
crate::handler_auth::hide_signup,
crate::handler_billing::list_invoices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class SearchHandler extends ActionHandler(zoomTo(_.searchState)) {
}}
) +
Effect(
Tauri.invoke("search_applications", Map("query" -> term.get)).map { (results: js.Array[RawApplication]) => {
UpdateSearchApplication(results.headOption.map(Application.apply))
Tauri.invoke("search_application", Map("query" -> term.get)).map { (result: js.UndefOr[RawApplication]) => {
UpdateSearchApplication(result.toOption.map(Application.apply))
}}
) +
action(
ActionBatch(
UpdateSelectedIntegration(None),
UpdateSelectedDocument(None),
UpdateSearchApplication(None),
//UpdateSearchApplication(None),
UpdateSearchTerm(term)
)
)
Expand Down Expand Up @@ -238,7 +238,7 @@ class SearchHandler extends ActionHandler(zoomTo(_.searchState)) {
}

case UpdateSearchApplication(application) =>
//println("Updating search application to: " + application)
println("Updating search application to: " + application)
updated(value.copy(searchApplication = application))

case UpdateSearchResults(results) =>
Expand Down

0 comments on commit 2b674a6

Please sign in to comment.