Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance/bundle/generate/dashboard-inplace/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Deployment complete!
"lifecycle_state": "ACTIVE",
"parent_path": "/Users/[USERNAME]/.bundle/dashboard update inplace/default/resources",
"path": "/Users/[USERNAME]/.bundle/dashboard update inplace/default/resources/test dashboard.lvdash.json",
"serialized_dashboard": "{\"a\":\"b\"}\n",
"serialized_dashboard": "{\"a\":\"b\"}",
"update_time": "[TIMESTAMP]",
"warehouse_id": ""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"parent_path": "/Workspace/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/resources",
"path": "/Users/[USERNAME]/.bundle/[UNIQUE_NAME]/resources/test-dashboard-[UNIQUE_NAME].lvdash.json",
"published": true,
"serialized_dashboard": "{}\n",
"serialized_dashboard": "{}",
"update_time": "[TIMESTAMP]",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
},
Expand All @@ -41,7 +41,7 @@
"reason": "etag_based",
"old": "{\n \"pages\": [\n {\n \"displayName\": \"New Page\",\n \"layout\": [\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 0\n },\n \"widget\": {\n \"name\": \"82eb9107\",\n \"textbox_spec\": \"# I'm a title\"\n }\n },\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 2\n },\n \"widget\": {\n \"name\": \"ffa6de4f\",\n \"textbox_spec\": \"Text\"\n }\n }\n ],\n \"name\": \"fdd21a3c\"\n }\n ]\n}\n",
"new": "{\n \"pages\": [\n {\n \"displayName\": \"New Page\",\n \"layout\": [\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 0\n },\n \"widget\": {\n \"name\": \"82eb9107\",\n \"textbox_spec\": \"# I'm a title\"\n }\n },\n {\n \"position\": {\n \"height\": 2,\n \"width\": 6,\n \"x\": 0,\n \"y\": 2\n },\n \"widget\": {\n \"name\": \"ffa6de4f\",\n \"textbox_spec\": \"Text\"\n }\n }\n ],\n \"name\": \"fdd21a3c\"\n }\n ]\n}\n",
"remote": "{}\n"
"remote": "{}"
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Cloud = true
Local = false
Local = true
RecordRequests = false
RunsOnDbr = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"parent_path": "/Workspace/Users/[USERNAME]",
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
"published": true,
"serialized_dashboard": "{}\n",
"serialized_dashboard": "{ }\n",
"update_time": "[TIMESTAMP]",
"warehouse_id": "[TEST_DEFAULT_WAREHOUSE_ID]"
},
Expand All @@ -26,13 +26,6 @@
"reason": "custom",
"old": "[ETAG]",
"remote": "[ETAG]"
},
"serialized_dashboard": {
"action": "skip",
"reason": "etag_based",
"old": "{ }\n",
"new": "{ }\n",
"remote": "{}\n"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion acceptance/bundle/resources/dashboards/simple/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Deployment complete!
"lifecycle_state": "ACTIVE",
"parent_path": "/Users/[USERNAME]",
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
"serialized_dashboard": "{}\n"
"serialized_dashboard": "{ }\n"
}

>>> [CLI] bundle plan -o json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Deployment complete!
"lifecycle_state": "ACTIVE",
"parent_path": "/Users/[USERNAME]",
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
"serialized_dashboard": "{}\n"
"serialized_dashboard": "{ }\n"
}

>>> [CLI] bundle destroy --auto-approve
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Deployment complete!
"lifecycle_state": "ACTIVE",
"parent_path": "/Users/[USERNAME]",
"path": "/Users/[USERNAME]/test bundle-deploy-dashboard [UUID].lvdash.json",
"serialized_dashboard": "{}\n"
"serialized_dashboard": "{ }\n"
}

>>> [CLI] bundle destroy --auto-approve
Expand Down
13 changes: 13 additions & 0 deletions libs/testserver/dashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ func transformSerializedDashboard(serializedDashboard, datasetCatalog, datasetSc
return serializedDashboard
}

// The real backend stores and returns the serialized dashboard verbatim,
// modulo the mutations applied below. Track whether any mutation actually
// happens so we can preserve the caller's original formatting (whitespace
// and key order) when it doesn't, matching cloud behavior.
mutated := false

// Add pageType to each page in the pages array (as of June 2025, this is an undocumented Lakeview API behaviour)
if pages, ok := dashboardContent["pages"].([]any); ok {
for _, page := range pages {
if pageMap, ok := page.(map[string]any); ok {
pageMap["pageType"] = "PAGE_TYPE_CANVAS"
mutated = true
}
}
}
Expand All @@ -47,14 +54,20 @@ func transformSerializedDashboard(serializedDashboard, datasetCatalog, datasetSc
if datasetMap, ok := dataset.(map[string]any); ok {
if datasetCatalog != "" {
datasetMap["catalog"] = datasetCatalog
mutated = true
}
if datasetSchema != "" {
datasetMap["schema"] = datasetSchema
mutated = true
}
}
}
}

if !mutated {
return serializedDashboard
}

updatedContent, err := json.Marshal(dashboardContent)
if err != nil {
return serializedDashboard
Expand Down
Loading