workspace: button script handles tree bind, popup no binds

This commit is contained in:
p 2026-08-12 17:31:32 +08:00
parent fdecd9ee1f
commit 1856da5bca
2 changed files with 2 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# workspace_popup.dspy - 返回工作空间 PopupWindow
# workspace_popup.dspy - 返回工作空间 PopupWindowbinds 由按钮脚本处理)
uid = await get_user()
if not uid:
@ -28,7 +28,6 @@ async with DBPools().sqlorContext(dbname) as sor:
}]
}
else:
files_url = entire_url("/pipeline-sdlc/api/workspace_files.dspy")
resp = {
"widgettype": "PopupWindow",
"options": {
@ -62,20 +61,12 @@ async with DBPools().sqlorContext(dbname) as sor:
"widgettype": "VScrollPanel",
"id": "ws_files",
"options": {
"dataurl": files_url + "?id=__root__",
"css": "filler",
"padding": "8px",
"gap": "4px"
}
}
]
}],
"binds": [{
"wid": "ws_tree",
"event": "selected",
"actiontype": "script",
"target": "self",
"script": f"console.log('BIND FIRED');var tree=bricks.getWidgetById('ws_tree',bricks.app);if(!tree){{console.log('no tree');return;}}var nid=tree.selected_node.user_data.id;console.log('nid='+nid);var fp=bricks.getWidgetById('ws_files',bricks.app);if(fp){{fetch('{files_url}?id='+encodeURIComponent(nid)).then(function(r){{return r.json()}}).then(function(d){{console.log('loaded type='+d.widgettype);fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);console.log('ws_files innerHTML='+fp.dom_element.innerHTML.length);}});}}else{{console.log('no fp');}}"
}]
}

File diff suppressed because one or more lines are too long