Skip to content

Commit

Permalink
Fixed dataset/widget name uniqueness requirement that was preventing …
Browse files Browse the repository at this point in the history
…dashboards being deployed (#241)
  • Loading branch information
nfx authored Jul 30, 2024
1 parent b536c7e commit 22e1daf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/databricks/labs/lsql/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def validate(self) -> None:

def get_layouts(self) -> Iterable[Layout]:
"""Get the layout(s) reflecting this tile in the dashboard."""
widget = Widget(name=self.metadata.id, textbox_spec=self.content)
widget = Widget(name=f"{self.metadata.id}_widget", textbox_spec=self.content)
layout = Layout(widget=widget, position=self.position)
yield layout

Expand Down Expand Up @@ -914,7 +914,8 @@ def save_to_folder(self, dashboard: Dashboard, local_path: Path) -> Dashboard:
yaml.safe_dump(page.as_dict(), f)
for layout in page.layout:
if layout.widget.textbox_spec is not None:
(local_path / f"{layout.widget.name}.md").write_text(layout.widget.textbox_spec)
name = layout.widget.name.removesuffix("_widget")
(local_path / f"{name}.md").write_text(layout.widget.textbox_spec)
return dashboard

def create_dashboard(
Expand Down

0 comments on commit 22e1daf

Please sign in to comment.