Skip to content

Commit

Permalink
Put back dashboard names (#3808)
Browse files Browse the repository at this point in the history
# Description

With the latest [lsql
release](https://github.com/databrickslabs/lsql/releases/tag/v0.16.0),
the dashboard names can have non-alphanumeric characters. This PR
creates dashboards with names like: `[UCX] assessment (Main)`.

Resolves #3797
Resolves #3790
Requires #3801
Partially reverts #3795:
4017a25 and
834ef14
  • Loading branch information
JCZuurmond authored Mar 3, 2025
1 parent ff60a59 commit 487fa2f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def _create_dashboard(self, folder: Path, *, parent_path: str) -> None:
catalog_to_replace="ucx_catalog",
)
)
metadata.display_name = self._name(f"{folder.parent.stem.title()}_{folder.stem.title()}")
metadata.display_name = self._name(f"{folder.parent.stem.title()} ({folder.stem.title()})")
reference = f"{folder.parent.stem}_{folder.stem}".lower()
dashboard_id = self._install_state.dashboards.get(reference)
if dashboard_id is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/databricks/labs/ucx/installer/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, config: WorkspaceConfig, installation: Installation, ws: Work

def _name(self, name: str) -> str:
prefix = os.path.basename(self._installation.install_folder()).removeprefix('.')
return f"{prefix.upper()}_{name}"
return f"[{prefix.upper()}] {name}"

@property
def _my_username(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/install/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_install_cluster_override_jobs(ws, mock_installation) -> None:

workflows_installation.create_jobs()

tasks = created_job_tasks(ws, 'MOCK_assessment')
tasks = created_job_tasks(ws, '[MOCK] assessment')
assert tasks['assess_jobs'].existing_cluster_id == 'one'
assert tasks['crawl_grants'].existing_cluster_id == 'two'
wheels.upload_to_wsfs.assert_called_once()
Expand All @@ -175,7 +175,7 @@ def test_writeable_dbfs(ws, tmp_path, mock_installation) -> None:

workflows_installation.create_jobs()

job = created_job(ws, 'MOCK_assessment')
job = created_job(ws, '[MOCK] assessment')
job_clusters = {_.job_cluster_key: _ for _ in job['job_clusters']}
assert 'main' in job_clusters
assert 'tacl' in job_clusters
Expand Down

0 comments on commit 487fa2f

Please sign in to comment.