From 01f2c76ac3c70326bd0fcfaf0592904ea4f9aca5 Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 21 Mar 2025 14:08:59 -0600 Subject: [PATCH] update dashboard name --- .../handlers/src/dashboards/update_dashboard_handler.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/libs/handlers/src/dashboards/update_dashboard_handler.rs b/api/libs/handlers/src/dashboards/update_dashboard_handler.rs index 2e5c6da42..75355fea7 100644 --- a/api/libs/handlers/src/dashboards/update_dashboard_handler.rs +++ b/api/libs/handlers/src/dashboards/update_dashboard_handler.rs @@ -173,11 +173,18 @@ pub async fn update_dashboard_handler( // Update name if provided if let Some(name) = request.name { + // First update the dashboard_yml.name to keep them in sync + dashboard_yml.name = name.clone(); + // Update version history with the updated dashboard_yml + current_version_history.add_version(next_version, dashboard_yml.clone()); + content_updated = true; + diesel::update(dashboard_files::table) .filter(dashboard_files::id.eq(dashboard_id)) .filter(dashboard_files::deleted_at.is_null()) .set(( dashboard_files::name.eq(name), + dashboard_files::content.eq(dashboard_yml.to_value()?), dashboard_files::version_history.eq(current_version_history.clone()), )) .execute(&mut conn)