workspace: add debug logs to bind script

This commit is contained in:
p 2026-08-12 17:23:47 +08:00
parent ebf7757dd2
commit 888e1ff320

View File

@ -61,7 +61,7 @@ async with DBPools().sqlorContext(dbname) as sor:
"event": "selected",
"actiontype": "script",
"target": "self",
"script": f"var tree=bricks.getWidgetById('ws_tree',bricks.app);var nid=tree.selected_node.user_data.id;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){{fp.dom_element.innerHTML='';bricks.widgetBuild(d,fp);}});"
"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');}}"
}]
}]
},