Skip to content

Commit 7d1d9a9

Browse files
dashboard: allow optional fields in dashboard json (#1684)
* dashboard: allow optional fields in dashboard json currently we allow optional fields for each tile in the dashboard this change allows fields to be added from caller in the dashboard section also useful when client adds more feature to dashboard like - settings, variables etc * update dashboard fix
1 parent 653c303 commit 7d1d9a9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/handlers/http/users/dashboards.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,7 @@ pub async fn update_dashboard(
127127

128128
// Validate: either query params OR body, not both
129129
let has_query_params = !query_map.is_empty();
130-
let has_body_update = dashboard
131-
.as_ref()
132-
.is_some_and(|d| d.title != existing_dashboard.title || d.tiles.is_some());
130+
let has_body_update = dashboard.is_some();
133131

134132
if has_query_params && has_body_update {
135133
return Err(DashboardError::Metadata(

src/users/dashboards.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ pub struct Dashboard {
6868
dashboard_type: Option<DashboardType>,
6969
pub tiles: Option<Vec<Tile>>,
7070
pub tenant_id: Option<String>,
71+
/// all other fields are variable and can be added as needed
72+
#[serde(flatten)]
73+
pub other_fields: Option<serde_json::Map<String, Value>>,
7174
}
7275

7376
impl MetastoreObject for Dashboard {

0 commit comments

Comments
 (0)