mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-24 02:11:25 +01:00
Environment dropdown and actions
This commit is contained in:
@@ -425,10 +425,14 @@ async fn update_environment(
|
||||
) -> Result<models::Environment, String> {
|
||||
let pool = &*db_instance.lock().await;
|
||||
|
||||
let updated_environment =
|
||||
models::update_environment(environment.id.as_str(), environment.data.0, pool)
|
||||
.await
|
||||
.expect("Failed to update request");
|
||||
let updated_environment = models::update_environment(
|
||||
environment.id.as_str(),
|
||||
environment.name.as_str(),
|
||||
environment.data.0,
|
||||
pool,
|
||||
)
|
||||
.await
|
||||
.expect("Failed to update request");
|
||||
|
||||
emit_and_return(&window, "updated_model", updated_environment)
|
||||
}
|
||||
|
||||
@@ -254,6 +254,7 @@ pub async fn create_environment(
|
||||
|
||||
pub async fn update_environment(
|
||||
id: &str,
|
||||
name: &str,
|
||||
data: HashMap<String, JsonValue>,
|
||||
pool: &Pool<Sqlite>,
|
||||
) -> Result<Environment, sqlx::Error> {
|
||||
@@ -262,9 +263,10 @@ pub async fn update_environment(
|
||||
sqlx::query!(
|
||||
r#"
|
||||
UPDATE environments
|
||||
SET (data, updated_at) = (?, CURRENT_TIMESTAMP)
|
||||
SET (name, data, updated_at) = (?, ?, CURRENT_TIMESTAMP)
|
||||
WHERE id = ?;
|
||||
"#,
|
||||
name,
|
||||
json_data,
|
||||
id,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user