- Add data_filter with 4 searchable fields (name LIKE, model LIKE, providerid, upappid) - Add filter_labels for search form display - Create llm_list.dspy with DBFilter support and LIKE wildcard handling - Create llm_create.dspy, llm_update.dspy, llm_delete.dspy - Create get_organizations.dspy and get_upapps.dspy for dropdown options - Add browserfields alters for providerid and upappid dropdowns - Add editable URLs for DataViewer CRUD operations
21 lines
753 B
Python
21 lines
753 B
Python
#!/usr/bin/env python3
|
|
import json
|
|
|
|
result = {'success': False, 'data': {'organizations': []}}
|
|
|
|
try:
|
|
async with get_sor_context(request._run_ns, 'rbac') as sor:
|
|
user_orgid = await get_userorgid()
|
|
orgs = await sor.R('organization', {'id': user_orgid})
|
|
# Get current org and its children
|
|
all_orgs = await sor.sqlExe(
|
|
"select id, orgname from organization where id = ${id}$ or parentid = ${id}$ order by orgname",
|
|
{'id': user_orgid}
|
|
)
|
|
result['data']['organizations'] = [{'id': r['id'], 'text': r['orgname']} for r in (all_orgs or [])]
|
|
result['success'] = True
|
|
except Exception as e:
|
|
result['error'] = str(e)
|
|
|
|
return json.dumps(result, ensure_ascii=False, default=str)
|