Skip to content

Commit

Permalink
fix: resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhranshuSanjeev committed Dec 4, 2024
1 parent 81a32c5 commit c5fddd0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
46 changes: 28 additions & 18 deletions crates/frontend/src/pages/context_override.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,30 +207,40 @@ pub fn context_override() -> impl IntoView {

let on_context_edit = Callback::new(move |data: (Context, Map<String, Value>)| {
let (context, overrides) = data;
let conditions =
Conditions::from_context_json(&context.condition.into()).unwrap();

selected_context_ws.set(Some(Data {
context: conditions,
overrides: overrides.into_iter().collect::<Vec<(String, Value)>>(),
}));
set_form_mode.set(Some(FormMode::Edit));

open_drawer("context_and_override_drawer");
match Conditions::from_context_json(&context.condition.into()) {
Ok(conditions) => {
selected_context_ws.set(Some(Data {
context: conditions,
overrides: overrides.into_iter().collect::<Vec<(String, Value)>>(),
}));
set_form_mode.set(Some(FormMode::Edit));
open_drawer("context_and_override_drawer");
}
Err(e) => {
logging::error!("Error parsing context: {}", e);
enqueue_alert(e.to_string(), AlertType::Error, 5000);
}
};
});

let on_context_clone = Callback::new(move |data: (Context, Map<String, Value>)| {
let (context, overrides) = data;
let conditions =
Conditions::from_context_json(&context.condition.into()).unwrap();

selected_context_ws.set(Some(Data {
context: conditions,
overrides: overrides.into_iter().collect::<Vec<(String, Value)>>(),
}));
set_form_mode.set(Some(FormMode::Create));
match Conditions::from_context_json(&context.condition.into()) {
Ok(conditions) => {
selected_context_ws.set(Some(Data {
context: conditions,
overrides: overrides.into_iter().collect::<Vec<(String, Value)>>(),
}));
set_form_mode.set(Some(FormMode::Create));

open_drawer("context_and_override_drawer");
open_drawer("context_and_override_drawer");
}
Err(e) => {
logging::error!("Error parsing context: {}", e);
enqueue_alert(e.to_string(), AlertType::Error, 5000);
}
};
});

let on_context_delete = Callback::new(move |id: String| {
Expand Down
6 changes: 1 addition & 5 deletions crates/superposition_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ use std::fmt::Display;
use std::future::{ready, Ready};

#[cfg(feature = "server")]
use actix_web::{dev::Payload, error, FromRequest, HttpMessage, HttpRequest};
use actix_web::{dev::Payload, FromRequest, HttpMessage, HttpRequest};
#[cfg(feature = "diesel_derives")]
use diesel_derive_enum as _;
#[cfg(feature = "server")]
use log::error;
use regex::Regex;
use serde::{Deserialize, Serialize};
#[cfg(feature = "server")]
use serde_json::json;
use webhook::WebhookConfig;

pub use crate::config::{Condition, Config, Context, Overrides};
Expand Down

0 comments on commit c5fddd0

Please sign in to comment.