From 9f783d9ba1da400158d2102aab64fac6fed0e31e Mon Sep 17 00:00:00 2001 From: "Ankit.Mahato" Date: Thu, 23 Jan 2025 11:05:25 +0530 Subject: [PATCH] fix: Add success alerts and remove divider --- .../src/components/default_config_form.rs | 10 ++------- .../frontend/src/components/dimension_form.rs | 20 ++++++++++++----- crates/frontend/src/components/experiment.rs | 1 - .../src/components/experiment_form.rs | 22 ++++++++++++------- .../frontend/src/components/function_form.rs | 16 ++++++++++++-- .../src/components/type_template_form.rs | 22 ++++++++++++------- .../frontend/src/components/workspace_form.rs | 8 ------- crates/frontend/src/pages/context_override.rs | 16 +++++++++----- 8 files changed, 69 insertions(+), 46 deletions(-) diff --git a/crates/frontend/src/components/default_config_form.rs b/crates/frontend/src/components/default_config_form.rs index 4257921d9..c438f4d91 100644 --- a/crates/frontend/src/components/default_config_form.rs +++ b/crates/frontend/src/components/default_config_form.rs @@ -175,7 +175,6 @@ where view! {
-
-
-
-
-
} }} -
+ {move || { let input_format = match ( @@ -337,7 +331,7 @@ where {input_format} -
+ } }} diff --git a/crates/frontend/src/components/dimension_form.rs b/crates/frontend/src/components/dimension_form.rs index ba55d6c03..da7e1d4aa 100644 --- a/crates/frontend/src/components/dimension_form.rs +++ b/crates/frontend/src/components/dimension_form.rs @@ -12,9 +12,11 @@ use utils::{create_dimension, update_dimension}; use web_sys::MouseEvent; use crate::components::{ + alert::AlertType, dropdown::{Dropdown, DropdownBtnType, DropdownDirection}, input::{Input, InputType}, }; +use crate::providers::alert_provider::enqueue_alert; use crate::providers::editor_provider::EditorProvider; use crate::schema::{JsonSchemaType, SchemaType}; use crate::types::FunctionsName; @@ -126,9 +128,20 @@ where match result { Ok(_) => { handle_submit(); + let success_message = if edit { + "Dimension updated successfully!" + } else { + "New Dimension created successfully!" + }; + enqueue_alert( + String::from(success_message), + AlertType::Success, + 5000, + ); } Err(e) => { - set_error_message.set(e); + set_error_message.set(e.clone()); + enqueue_alert(e, AlertType::Error, 5000); // Handle error // Consider logging or displaying the error } @@ -157,8 +170,6 @@ where -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{move || { let loading = req_inprogess_rs.get(); diff --git a/crates/frontend/src/pages/context_override.rs b/crates/frontend/src/pages/context_override.rs index 53d7702c0..f44f8acba 100644 --- a/crates/frontend/src/pages/context_override.rs +++ b/crates/frontend/src/pages/context_override.rs @@ -97,9 +97,20 @@ fn form( Ok(_) => { logging::log!("Context and overrides submitted successfully"); handle_submit.call(()); + let success_message = if edit { + "Context and overrides updated successfully!" + } else { + "Context and overrides created successfully!" + }; + enqueue_alert( + String::from(success_message), + AlertType::Success, + 5000, + ); } Err(e) => { logging::log!("Error submitting context and overrides: {:?}", e); + enqueue_alert(e, AlertType::Error, 5000); } } req_inprogress_ws.set(false); @@ -118,7 +129,6 @@ fn form( disabled=edit /> -
-
-
-
-