From f68829c2a5bf49517279bc0d48d5e382e5b4f60b Mon Sep 17 00:00:00 2001 From: "ayush.jain@juspay.in" Date: Tue, 31 Dec 2024 18:56:09 +0530 Subject: [PATCH] fix: Formatting --- crates/frontend/src/api.rs | 2 +- .../components/default_config_form/utils.rs | 2 +- .../experiment_conclude_form/utils.rs | 2 +- .../src/components/function_form/utils.rs | 4 +- .../frontend/src/components/workspace_form.rs | 7 ++- crates/frontend/src/pages/context_override.rs | 54 +++++++++++-------- crates/frontend/src/pages/custom_types.rs | 3 +- crates/frontend/src/pages/function.rs | 3 +- .../src/pages/function/function_create.rs | 5 +- 9 files changed, 51 insertions(+), 31 deletions(-) diff --git a/crates/frontend/src/api.rs b/crates/frontend/src/api.rs index f68bada8..6fef73e9 100644 --- a/crates/frontend/src/api.rs +++ b/crates/frontend/src/api.rs @@ -23,7 +23,7 @@ use crate::{ pub async fn fetch_dimensions( filters: &PaginationParams, tenant: String, - org_id: String + org_id: String, ) -> Result, ServerFnError> { let client = reqwest::Client::new(); let host = use_host_server(); diff --git a/crates/frontend/src/components/default_config_form/utils.rs b/crates/frontend/src/components/default_config_form/utils.rs index 1795cab0..163fc44a 100644 --- a/crates/frontend/src/components/default_config_form/utils.rs +++ b/crates/frontend/src/components/default_config_form/utils.rs @@ -24,7 +24,7 @@ pub async fn update_default_config( key: String, tenant: String, payload: DefaultConfigUpdateReq, - org_id: String + org_id: String, ) -> Result { let host = get_host(); let url = format!("{host}/default-config/{key}"); diff --git a/crates/frontend/src/components/experiment_conclude_form/utils.rs b/crates/frontend/src/components/experiment_conclude_form/utils.rs index c4e8bdae..8414680d 100644 --- a/crates/frontend/src/components/experiment_conclude_form/utils.rs +++ b/crates/frontend/src/components/experiment_conclude_form/utils.rs @@ -7,7 +7,7 @@ pub async fn conclude_experiment( exp_id: String, variant_id: String, tenant: &String, - org_id: &String + org_id: &String, ) -> Result { let client = reqwest::Client::new(); let host = get_host(); diff --git a/crates/frontend/src/components/function_form/utils.rs b/crates/frontend/src/components/function_form/utils.rs index 870914db..8023121c 100644 --- a/crates/frontend/src/components/function_form/utils.rs +++ b/crates/frontend/src/components/function_form/utils.rs @@ -14,7 +14,7 @@ pub async fn create_function( runtime_version: String, description: String, tenant: String, - org_id: String + org_id: String, ) -> Result { let payload = FunctionCreateRequest { function_name, @@ -29,7 +29,7 @@ pub async fn create_function( url, reqwest::Method::POST, Some(payload), - construct_request_headers(&[("x-tenant", &tenant),("x-org-id", &org_id)])?, + construct_request_headers(&[("x-tenant", &tenant), ("x-org-id", &org_id)])?, ) .await?; diff --git a/crates/frontend/src/components/workspace_form.rs b/crates/frontend/src/components/workspace_form.rs index 6925379c..c6114461 100644 --- a/crates/frontend/src/components/workspace_form.rs +++ b/crates/frontend/src/components/workspace_form.rs @@ -61,7 +61,12 @@ where let handle_submit = handle_submit_clone; async move { let result = if is_edit { - update_workspace(workspace_name_rs.get(), org_id.get().to_string(), update_payload).await + update_workspace( + workspace_name_rs.get(), + org_id.get().to_string(), + update_payload, + ) + .await } else { create_workspace(org_id.get().to_string(), create_payload).await }; diff --git a/crates/frontend/src/pages/context_override.rs b/crates/frontend/src/pages/context_override.rs index 169e1464..de431992 100644 --- a/crates/frontend/src/pages/context_override.rs +++ b/crates/frontend/src/pages/context_override.rs @@ -152,27 +152,36 @@ pub fn context_override() -> impl IntoView { let (modal_visible, set_modal_visible) = create_signal(false); let (delete_id, set_delete_id) = create_signal::>(None); - let page_resource: Resource<(String, String), PageResource> = create_blocking_resource( - move || (tenant_rws.get().0, org_rws.get().0), - |(current_tenant, org_id)| async move { - let empty_list_filters = PaginationParams::all_entries(); - let (config_result, dimensions_result, default_config_result) = join!( - fetch_config(current_tenant.to_string(), None, org_id.clone()), - fetch_dimensions(&empty_list_filters, current_tenant.to_string(), org_id.clone()), - fetch_default_config(&empty_list_filters, current_tenant.to_string(), org_id.clone()) - ); - PageResource { - config: config_result.unwrap_or_default(), - dimensions: dimensions_result - .unwrap_or_default() - .data - .into_iter() - .filter(|d| d.dimension != "variantIds") - .collect(), - default_config: default_config_result.unwrap_or_default().data, - } - }, - ); + let page_resource: Resource<(String, String), PageResource> = + create_blocking_resource( + move || (tenant_rws.get().0, org_rws.get().0), + |(current_tenant, org_id)| async move { + let empty_list_filters = PaginationParams::all_entries(); + let (config_result, dimensions_result, default_config_result) = join!( + fetch_config(current_tenant.to_string(), None, org_id.clone()), + fetch_dimensions( + &empty_list_filters, + current_tenant.to_string(), + org_id.clone() + ), + fetch_default_config( + &empty_list_filters, + current_tenant.to_string(), + org_id.clone() + ) + ); + PageResource { + config: config_result.unwrap_or_default(), + dimensions: dimensions_result + .unwrap_or_default() + .data + .into_iter() + .filter(|d| d.dimension != "variantIds") + .collect(), + default_config: default_config_result.unwrap_or_default().data, + } + }, + ); let handle_context_create = Callback::new(move |_| { set_form_mode.set(Some(FormMode::Create)); @@ -241,7 +250,8 @@ pub fn context_override() -> impl IntoView { let confirm_delete = Callback::new(move |_| { if let Some(id) = delete_id.get().clone() { spawn_local(async move { - let result = delete_context(tenant_rws.get().0, id, org_rws.get().0).await; + let result = + delete_context(tenant_rws.get().0, id, org_rws.get().0).await; match result { Ok(_) => { diff --git a/crates/frontend/src/pages/custom_types.rs b/crates/frontend/src/pages/custom_types.rs index 757633f6..e4d8e3cb 100644 --- a/crates/frontend/src/pages/custom_types.rs +++ b/crates/frontend/src/pages/custom_types.rs @@ -74,7 +74,8 @@ pub fn types_page() -> impl IntoView { let tenant = tenant_rws.get().0; let org = org_rws.get().0; let _ = - delete_type(tenant, row_data.clone().type_name, org).await; + delete_type(tenant, row_data.clone().type_name, org) + .await; types_resource.refetch(); } }); diff --git a/crates/frontend/src/pages/function.rs b/crates/frontend/src/pages/function.rs index b615adef..d093c16f 100644 --- a/crates/frontend/src/pages/function.rs +++ b/crates/frontend/src/pages/function.rs @@ -59,7 +59,8 @@ pub fn function_page() -> impl IntoView { let combined_resource: Resource<(String, String, String), CombinedResource> = create_blocking_resource(source, |(function_name, tenant, org_id)| async move { let function_result = - fetch_function(function_name.to_string(), tenant.to_string(), org_id).await; + fetch_function(function_name.to_string(), tenant.to_string(), org_id) + .await; CombinedResource { function: function_result.ok(), diff --git a/crates/frontend/src/pages/function/function_create.rs b/crates/frontend/src/pages/function/function_create.rs index f29c434f..969a122e 100644 --- a/crates/frontend/src/pages/function/function_create.rs +++ b/crates/frontend/src/pages/function/function_create.rs @@ -3,7 +3,10 @@ use leptos_router::use_navigate; use serde::{Deserialize, Serialize}; use superposition_types::database::models::cac::Function; -use crate::{components::function_form::FunctionEditor, types::{OrganisationId, Tenant}}; +use crate::{ + components::function_form::FunctionEditor, + types::{OrganisationId, Tenant}, +}; #[derive(Serialize, Deserialize, Clone, Debug)] struct CombinedResource {