Skip to content

Commit 6e9aad8

Browse files
guidooswaldDBclaude
andcommitted
Add permission/event action icons, secret scope navigation, and accordion auto-expand
- Add clickable permission icons (shield) on clusters, jobs, and warehouses lists - Add cluster events icon on clusters list with POST body prefill support - Add secret scopes → list secrets navigation via LIST_TO_GET - Auto-expand correct accordion section when navigating cross-category via action icons - Prefill request body template with actual values from action params Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 93f77b2 commit 6e9aad8

3 files changed

Lines changed: 40 additions & 8 deletions

File tree

api_catalog.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,17 @@ def _p(name: str, desc: str, required: bool = False, type_: str = STR, default:
595595
# extra_params — optional dict {target_param: source_item_field} for additional params
596596
# actions — optional list of (target_endpoint_id, icon_class, tooltip, {target_param: source_field})
597597
LIST_TO_GET: Dict[str, Any] = {
598-
"clusters-list": ("clusters-get", "clusters", "cluster_id", "cluster_id", "cluster_name"),
599-
"jobs-list": ("jobs-get", "jobs", "job_id", "job_id", "settings.name"),
598+
"clusters-list": ("clusters-get", "clusters", "cluster_id", "cluster_id", "cluster_name", None, [
599+
("permissions-clusters-get", "bi-shield-check", "Get Cluster Permissions", {"cluster_id": "cluster_id"}),
600+
("clusters-events", "bi-journal-text", "Get Cluster Events", {"cluster_id": "cluster_id"}),
601+
]),
602+
"jobs-list": ("jobs-get", "jobs", "job_id", "job_id", "settings.name", None, [
603+
("permissions-jobs-get", "bi-shield-check", "Get Job Permissions", {"job_id": "job_id"}),
604+
]),
600605
"jobs-runs-list": ("jobs-runs-get", "runs", "run_id", "run_id", None),
601-
"sql-warehouses-list": ("sql-warehouses-get", "warehouses", "id", "id", "name"),
606+
"sql-warehouses-list": ("sql-warehouses-get", "warehouses", "id", "id", "name", None, [
607+
("permissions-warehouses-get", "bi-shield-check", "Get Warehouse Permissions", {"warehouse_id": "id"}),
608+
]),
602609
"uc-catalogs-list": ("uc-schemas-list", "catalogs", "name", "catalog_name", None),
603610
"uc-schemas-list": ("uc-tables-list", "schemas", "name", "schema_name", None, {"catalog_name": "catalog_name"}, [
604611
("uc-volumes-list", "bi-archive", "List Volumes", {"catalog_name": "catalog_name", "schema_name": "name"}),
@@ -607,6 +614,7 @@ def _p(name: str, desc: str, required: bool = False, type_: str = STR, default:
607614
"mlflow-experiments-search": ("mlflow-experiments-get", "experiments", "experiment_id", "experiment_id", "name"),
608615
"serving-endpoints-list": ("serving-endpoints-get", "endpoints", "name", "name", None),
609616
"pipelines-list": ("pipelines-get", "statuses", "pipeline_id", "pipeline_id", "name"),
617+
"secrets-list-scopes": ("secrets-list", "scopes", "name", "scope", None),
610618
"dbfs-list": ("dbfs-get-status", "files", "path", "path", None),
611619
"workspace-list": ("workspace-get-status", "objects", "path", "path", None),
612620
}

app.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,23 @@ def build_param_form(endpoint: Dict, prefill: Optional[Dict] = None) -> html.Div
575575

576576
show_body = body_template is not None or method == "POST"
577577
if show_body:
578+
body_value = body_template or "{}"
579+
if prefill and body_value:
580+
try:
581+
body_obj = json.loads(body_value)
582+
for k, v in prefill.items():
583+
if k in body_obj:
584+
body_obj[k] = v
585+
body_value = json.dumps(body_obj, indent=2)
586+
except (json.JSONDecodeError, TypeError):
587+
pass
578588
rows.append(html.Hr(className="divider"))
579589
rows.append(html.Div([
580590
html.Div([
581591
html.Span("Request Body", className="param-name"),
582592
dbc.Badge("JSON", color="info", className="param-badge ms-2"),
583593
], className="param-label mb-1"),
584-
dbc.Textarea(id="body-textarea", value=body_template or "{}", className="body-textarea font-mono mt-1", rows=8),
594+
dbc.Textarea(id="body-textarea", value=body_value, className="body-textarea font-mono mt-1", rows=8),
585595
], className="param-row"))
586596
else:
587597
rows.append(dbc.Textarea(id="body-textarea", value="", style={"display": "none"}))
@@ -1335,16 +1345,24 @@ def select_endpoint(n_clicks_list, btn_ids):
13351345
return endpoint
13361346

13371347

1338-
# 8b. Sync sidebar button highlight whenever selected-endpoint changes
1348+
# 8b. Sync sidebar button highlight + accordion section whenever selected-endpoint changes
13391349
@app.callback(
13401350
Output({"type": "endpoint-btn", "id": ALL}, "className"),
1351+
Output("api-accordion", "active_item"),
13411352
Input("selected-endpoint", "data"),
13421353
State({"type": "endpoint-btn", "id": ALL}, "id"),
13431354
prevent_initial_call=True,
13441355
)
13451356
def sync_active_button(endpoint, btn_ids):
13461357
active_id = (endpoint or {}).get("id", "")
1347-
return ["endpoint-btn active" if b["id"] == active_id else "endpoint-btn" for b in btn_ids]
1358+
classes = ["endpoint-btn active" if b["id"] == active_id else "endpoint-btn" for b in btn_ids]
1359+
# Open the accordion section for the endpoint's category
1360+
cat_name = (endpoint or {}).get("category", "")
1361+
cat_keys = list(API_CATALOG.keys())
1362+
active_item = no_update
1363+
if cat_name in cat_keys:
1364+
active_item = f"item-{cat_keys.index(cat_name)}"
1365+
return classes, active_item
13481366

13491367

13501368
# 9. Render endpoint detail
@@ -1815,10 +1833,16 @@ def handle_iframe_link_click(link_data, conn_config, cache):
18151833
if not host:
18161834
return no_update, build_error_panel("No workspace host."), no_update
18171835

1836+
method = endpoint.get("method", "GET")
1837+
body = None
1838+
if method == "POST" and query_params:
1839+
body = query_params
1840+
query_params = {}
18181841
result = make_api_call(
1819-
method=endpoint.get("method", "GET"),
1842+
method=method,
18201843
path=path, token=token, host=host,
18211844
query_params=query_params or None,
1845+
body=body,
18221846
)
18231847
chips = extract_chips(get_id, result["data"]) if result["success"] else []
18241848
endpoint_with_prefill = {**endpoint, "_prefill": prefill}

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
301
1+
309

0 commit comments

Comments
 (0)