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
23 changes: 23 additions & 0 deletions acceptance/workspace/lakeview/publish/out.requests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"method": "POST",
"path": "/api/2.0/workspace/mkdirs",
"body": {
"path": "/Users/[USERNAME]"
}
}
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards",
"body": {
"display_name": "Test Dashboard",
"parent_path": "/Users/[USERNAME]",
"warehouse_id": "test-warehouse"
}
}
{
"method": "POST",
"path": "/api/2.0/lakeview/dashboards/[DASHBOARD_ID]/published",
"body": {
"embed_credentials": false
}
}
5 changes: 5 additions & 0 deletions acceptance/workspace/lakeview/publish/out.test.toml

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

7 changes: 7 additions & 0 deletions acceptance/workspace/lakeview/publish/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

>>> [CLI] lakeview publish [DASHBOARD_ID]
{
"display_name":"Test Dashboard",
"embed_credentials":false,
"warehouse_id":"test-warehouse"
}
5 changes: 5 additions & 0 deletions acceptance/workspace/lakeview/publish/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$CLI workspace mkdirs /Users/tester@databricks.com

dashboard_id=$($CLI lakeview create --json '{"display_name": "Test Dashboard", "parent_path": "/Users/tester@databricks.com", "warehouse_id": "test-warehouse"}' -o json | grep -o '"dashboard_id":"[^"]*"' | cut -d'"' -f4)

trace $CLI lakeview publish $dashboard_id
8 changes: 8 additions & 0 deletions acceptance/workspace/lakeview/publish/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
RecordRequests = true

[Env]
MSYS_NO_PATHCONV = "1"

[[Repls]]
Old = "[a-f0-9]{32}"
New = "[DASHBOARD_ID]"
19 changes: 19 additions & 0 deletions cmd/workspace/lakeview/overrides.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package lakeview

import (
"github.com/databricks/databricks-sdk-go/service/dashboards"
"github.com/spf13/cobra"
)

func publishOverride(cmd *cobra.Command, req *dashboards.PublishRequest) {
originalRunE := cmd.RunE
cmd.RunE = func(cmd *cobra.Command, args []string) error {
// Force send embed_credentials even when false, otherwise the API defaults to true.
req.ForceSendFields = append(req.ForceSendFields, "EmbedCredentials")
return originalRunE(cmd, args)
}
}

func init() {
publishOverrides = append(publishOverrides, publishOverride)
}