main #2
@ -140,6 +140,68 @@ def get_local_app(name):
|
||||
return app_data
|
||||
|
||||
|
||||
@dashboard_whitelist()
|
||||
def get_my_local_app_list(filters=None, order_by=None, limit_start=None, limit_page_length=None):
|
||||
"""获取当前团队的应用列表"""
|
||||
|
||||
team = get_current_team()
|
||||
if not team:
|
||||
return {"success": False, "message": "未找到当前团队信息"}
|
||||
|
||||
# 构建查询条件
|
||||
query_filters = {"team": team}
|
||||
|
||||
if filters:
|
||||
if isinstance(filters, str):
|
||||
import json
|
||||
filters = json.loads(filters)
|
||||
query_filters.update(filters)
|
||||
|
||||
# 默认排序
|
||||
if not order_by:
|
||||
order_by = "app_name asc"
|
||||
|
||||
# 获取应用列表
|
||||
apps = jingrow.get_all(
|
||||
"Local App",
|
||||
filters=query_filters,
|
||||
fields=[
|
||||
"name", "app_name", "title", "subtitle", "category",
|
||||
"enabled", "public", "team", "status", "repository_url",
|
||||
"file_url", "app_image", "creation", "modified"
|
||||
],
|
||||
order_by=order_by,
|
||||
limit_start=limit_start,
|
||||
limit_page_length=limit_page_length
|
||||
)
|
||||
|
||||
# 批量获取团队用户名称
|
||||
team_user_names = _get_team_user_names(apps)
|
||||
|
||||
# 格式化返回数据
|
||||
result = []
|
||||
for app in apps:
|
||||
app_data = {
|
||||
"name": app.name,
|
||||
"app_name": app.app_name,
|
||||
"title": app.title,
|
||||
"subtitle": app.subtitle,
|
||||
"category": app.category,
|
||||
"enabled": app.enabled,
|
||||
"public": app.public,
|
||||
"team": team_user_names.get(app.team),
|
||||
"status": app.status,
|
||||
"repository_url": app.repository_url,
|
||||
"file_url": app.file_url,
|
||||
"app_image": app.app_image,
|
||||
"creation": app.creation,
|
||||
"modified": app.modified
|
||||
}
|
||||
result.append(app_data)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@dashboard_whitelist()
|
||||
def create_local_app(app_data):
|
||||
"""创建本地应用"""
|
||||
@ -217,87 +279,62 @@ def delete_local_app(name):
|
||||
return {"success": True, "message": "应用删除成功"}
|
||||
|
||||
|
||||
@jingrow.whitelist(allow_guest=True)
|
||||
def get_local_app_meta():
|
||||
"""获取 Local App 元数据信息"""
|
||||
@dashboard_whitelist()
|
||||
def get_my_local_node_list(filters=None, order_by=None, limit_start=None, limit_page_length=None):
|
||||
"""获取当前团队的节点列表"""
|
||||
|
||||
meta = jingrow.get_meta("Local App")
|
||||
return meta.as_dict()
|
||||
|
||||
|
||||
@jingrow.whitelist(allow_guest=True)
|
||||
def get_local_app_categories():
|
||||
"""获取本地应用分类列表"""
|
||||
team = get_current_team()
|
||||
if not team:
|
||||
return {"success": False, "message": "未找到当前团队信息"}
|
||||
|
||||
categories = jingrow.get_all(
|
||||
"Marketplace App Category",
|
||||
fields=["name", "description", "slug"],
|
||||
order_by="name asc"
|
||||
)
|
||||
|
||||
result = []
|
||||
for category in categories:
|
||||
category_data = {
|
||||
"name": category.name,
|
||||
"description": category.description,
|
||||
"slug": category.slug
|
||||
}
|
||||
result.append(category_data)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@jingrow.whitelist(allow_guest=True)
|
||||
def search_local_apps(query, filters=None, limit=20):
|
||||
"""搜索本地应用"""
|
||||
|
||||
# 构建搜索条件
|
||||
search_filters = {
|
||||
"enabled": 1,
|
||||
"app_name": ["like", f"%{query}%"]
|
||||
}
|
||||
# 构建查询条件
|
||||
query_filters = {"team": team}
|
||||
|
||||
if filters:
|
||||
if isinstance(filters, str):
|
||||
import json
|
||||
filters = json.loads(filters)
|
||||
search_filters.update(filters)
|
||||
query_filters.update(filters)
|
||||
|
||||
# 搜索应用
|
||||
apps = jingrow.get_all(
|
||||
"Local App",
|
||||
filters=search_filters,
|
||||
# 默认排序
|
||||
if not order_by:
|
||||
order_by = "node_type asc"
|
||||
|
||||
# 获取节点列表
|
||||
nodes = jingrow.get_all(
|
||||
"Local Node",
|
||||
filters=query_filters,
|
||||
fields=[
|
||||
"name", "app_name", "title", "subtitle", "category",
|
||||
"name", "node_type", "title", "subtitle",
|
||||
"enabled", "public", "team", "status", "repository_url",
|
||||
"file_url", "app_image", "creation", "modified"
|
||||
"file_url", "node_image", "creation", "modified"
|
||||
],
|
||||
order_by="app_name asc",
|
||||
limit=limit
|
||||
order_by=order_by,
|
||||
limit_start=limit_start,
|
||||
limit_page_length=limit_page_length
|
||||
)
|
||||
|
||||
# 批量获取团队用户名称
|
||||
team_user_names = _get_team_user_names(apps)
|
||||
team_user_names = _get_team_user_names(nodes)
|
||||
|
||||
# 格式化返回数据
|
||||
result = []
|
||||
for app in apps:
|
||||
app_data = {
|
||||
"name": app.name,
|
||||
"app_name": app.app_name,
|
||||
"title": app.title,
|
||||
"subtitle": app.subtitle,
|
||||
"category": app.category,
|
||||
"enabled": app.enabled,
|
||||
"public": app.public,
|
||||
"team": team_user_names.get(app.team),
|
||||
"status": app.status,
|
||||
"repository_url": app.repository_url,
|
||||
"file_url": app.file_url,
|
||||
"app_image": app.app_image,
|
||||
"creation": app.creation,
|
||||
"modified": app.modified
|
||||
for node in nodes:
|
||||
node_data = {
|
||||
"name": node.name,
|
||||
"node_type": node.node_type,
|
||||
"title": node.title,
|
||||
"subtitle": node.subtitle,
|
||||
"enabled": node.enabled,
|
||||
"public": node.public,
|
||||
"team": team_user_names.get(node.team),
|
||||
"status": node.status,
|
||||
"repository_url": node.repository_url,
|
||||
"file_url": node.file_url,
|
||||
"node_image": node.node_image,
|
||||
"creation": node.creation,
|
||||
"modified": node.modified
|
||||
}
|
||||
result.append(app_data)
|
||||
result.append(node_data)
|
||||
|
||||
return result
|
||||
return result
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
{
|
||||
"fieldname": "team",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Team",
|
||||
"options": "Team",
|
||||
"read_only": 1
|
||||
@ -96,7 +98,7 @@
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "Published\nUnpublished\nDraft"
|
||||
"options": "Pending Review\nPublished\nUnpublished\nDraft"
|
||||
},
|
||||
{
|
||||
"fieldname": "subtitle",
|
||||
@ -105,7 +107,7 @@
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2025-10-22 22:35:00.480783",
|
||||
"modified": "2025-11-02 22:55:33.457151",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Jcloud",
|
||||
"name": "Local App",
|
||||
|
||||
@ -21,7 +21,7 @@ class LocalApp(Page):
|
||||
file_url: DF.Data | None
|
||||
public: DF.Check
|
||||
repository_url: DF.Data | None
|
||||
status: DF.Literal["Published", "Unpublished", "Draft"]
|
||||
status: DF.Literal["Pending Review", "Published", "Unpublished", "Draft"]
|
||||
subtitle: DF.SmallText | None
|
||||
team: DF.Link | None
|
||||
title: DF.Data
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
{
|
||||
"fieldname": "team",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Team",
|
||||
"options": "Team",
|
||||
"read_only": 1
|
||||
@ -73,7 +75,7 @@
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"label": "Status",
|
||||
"options": "Published\nUnpublished\nDraft"
|
||||
"options": "Pending Review\nPublished\nUnpublished\nDraft"
|
||||
},
|
||||
{
|
||||
"fieldname": "subtitle",
|
||||
@ -96,7 +98,7 @@
|
||||
}
|
||||
],
|
||||
"links": [],
|
||||
"modified": "2025-11-02 04:50:27.312179",
|
||||
"modified": "2025-11-02 23:06:55.789746",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Jcloud",
|
||||
"name": "Local Node",
|
||||
|
||||
@ -20,7 +20,7 @@ class LocalNode(Page):
|
||||
node_type: DF.Data
|
||||
public: DF.Check
|
||||
repository_url: DF.Data | None
|
||||
status: DF.Literal["Published", "Unpublished", "Draft"]
|
||||
status: DF.Literal["Pending Review", "Published", "Unpublished", "Draft"]
|
||||
subtitle: DF.SmallText | None
|
||||
team: DF.Link | None
|
||||
title: DF.Data
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user