update dashboard name

This commit is contained in:
dal 2025-03-21 14:08:59 -06:00
parent 2ecc49eaaf
commit 01f2c76ac3
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
1 changed files with 7 additions and 0 deletions

View File

@ -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)