From a137cd07d77762397600ab22f3f260dc8f40d6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Sun, 24 Apr 2022 12:50:46 +0000 Subject: [PATCH 01/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20webhook=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=8E=A5=E5=8F=A3=E4=B8=8E=E9=A1=B5=E9=9D=A2=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/__init__.py | 6 +- api/v1/pages/developer_manage/webhook.py | 159 +++++++++++++++++++++++ api/v1/views/__init__.py | 3 +- api/v1/views/webhook.py | 69 ++++++++++ 4 files changed, 234 insertions(+), 3 deletions(-) create mode 100644 api/v1/views/webhook.py diff --git a/api/v1/pages/__init__.py b/api/v1/pages/__init__.py index 80484590b..596e298f6 100644 --- a/api/v1/pages/__init__.py +++ b/api/v1/pages/__init__.py @@ -5,7 +5,8 @@ approve_manage, auth_manage, charts_manage, - data_source_manage + data_source_manage, + developer_manage, ) from arkid.core import routers @@ -18,6 +19,7 @@ approve_manage.router, auth_manage.router, charts_manage.router, - data_source_manage.router + data_source_manage.router, + developer_manage.router ] ) diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index e69de29bb..f0703583b 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -0,0 +1,159 @@ +# Webhook +from arkid.core import routers, pages +from arkid.core.translation import gettext_default as _ + +webhook_tag = 'webhook' +webhook_name = 'Webhook' + + +page = pages.TablePage( + tag=webhook_tag, + name=webhook_name, + init_action=pages.FrontAction( + path='/api/v1/tenant/{tenant_id}/webhooks/', + method=pages.FrontActionMethod.GET, + action_type=pages.FrontActionType.DIRECT_ACTION + ) +) + +edit_page = pages.FormPage( + name=_("编辑Webhook"), + init_action=pages.FrontAction( + path='/api/v1/tenant/{tenant_id}/webhooks/{id}/', + method=pages.FrontActionMethod.GET, + action_type=pages.FrontActionType.DIRECT_ACTION + ) +) + +edit_page.add_global_action( + [ + pages.FrontAction( + method=pages.FrontActionMethod.POST, + name=_("确认"), + path="/api/v1/tenant/{tenant_id}/webhooks/{id}/", + icon="icon-confirm" + ), + pages.FrontAction( + name=_("取消"), + action_type=pages.FrontActionType.CANCEL_ACTION, + icon="icon-cancel" + ), + pages.FrontAction( + name=_("重置"), + action_type=pages.FrontActionType.RESET_ACTION, + icon="icon-reset" + ), + ] +) + +create_page = pages.FormPage( + name=_("创建一个新的Webhook"), + init_action=pages.FrontAction( + path='/api/v1/tenant/{tenant_id}/webhooks/', + method=pages.FrontActionMethod.POST, + action_type=pages.FrontActionType.DIRECT_ACTION + ) +) + +create_page.add_global_action( + [ + pages.FrontAction( + method=pages.FrontActionMethod.POST, + name=_("确认"), + path="/api/v1/tenant/{tenant_id}/webhooks/", + action_type=pages.FrontActionType.DIRECT_ACTION, + icon="icon-confirm" + ), + pages.FrontAction( + name=_("取消"), + action_type=pages.FrontActionType.CANCEL_ACTION, + icon="icon-cancel" + ), + pages.FrontAction( + name=_("重置"), + action_type=pages.FrontActionType.RESET_ACTION, + icon="icon-reset" + ), + ] +) + +history_page = pages.TablePage( + name=_("webhook历史记录"), + tag="webhook_history", + init_action=pages.FrontAction( + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/', + method=pages.FrontActionMethod.GET, + action_type=pages.FrontActionType.DIRECT_ACTION + ) +) + +history_page.add_local_action( + [ + pages.FrontAction( + name=_("查阅"), + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/', + method=pages.FrontActionMethod.GET, + action_type=pages.FrontActionType.DIRECT_ACTION + ), + pages.FrontAction( + name=_("重试"), + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/retry/', + method=pages.FrontActionMethod.GET, + action_type=pages.FrontActionType.DIRECT_ACTION + ), + pages.FrontAction( + name=_("删除"), + method=pages.FrontActionMethod.DELETE, + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/', + icon="icon-delete", + action_type=pages.FrontActionType.DIRECT_ACTION + ) + ] +) + +page.add_local_action( + [ + pages.FrontAction( + name=_("历史记录"), + page=history_page, + icon="icon-edit", + action_type=pages.FrontActionType.OPEN_ACTION + ), + pages.FrontAction( + name=_("编辑"), + page=edit_page, + icon="icon-edit", + action_type=pages.FrontActionType.OPEN_ACTION + ), + pages.FrontAction( + name=_("删除"), + method=pages.FrontActionMethod.DELETE, + path="/api/v1/tenant/{tenant_id}/webhooks/{id}/", + icon="icon-delete", + action_type=pages.FrontActionType.DIRECT_ACTION + ) + ] +) + +page.add_global_action( + [ + pages.FrontAction( + name="创建", + page=create_page, + icon="icon-create", + action_type=pages.FrontActionType.OPEN_ACTION + ) + ] +) + + +router = routers.FrontRouter( + path=webhook_tag, + name=webhook_name, + page=page, +) + +pages.register_front_pages(history_page) +pages.register_front_pages(page) +pages.register_front_pages(create_page) +pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/views/__init__.py b/api/v1/views/__init__.py index 72cec6e9c..806247017 100644 --- a/api/v1/views/__init__.py +++ b/api/v1/views/__init__.py @@ -14,5 +14,6 @@ auto_auth, third_auth, permission_sync, - scim_sync + scim_sync, + webhook, ) diff --git a/api/v1/views/webhook.py b/api/v1/views/webhook.py new file mode 100644 index 000000000..27364083b --- /dev/null +++ b/api/v1/views/webhook.py @@ -0,0 +1,69 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/webhooks/", tags=[_("Webhook")]) +def get_webhooks(request, tenant_id: str): + """ Webhook列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +def get_webhook(request, tenant_id: str, id: str): + """ 获取Webhook,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/webhooks/", tags=[_("Webhook")]) +def create_webhook(request, tenant_id: str): + """ 创建Webhook,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +def update_webhook(request, tenant_id: str, id: str): + """ 编辑Webhook,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +def delete_webhook(request, tenant_id: str, id: str): + """ 删除Webhook,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=[_("Webhook")]) +def get_webhook_histories(request, tenant_id: str, webhook_id: str): + """ 获取Webhook历史记录列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +def get_webhook_history(request, tenant_id: str, webhook_id: str, id:str): + """ 获取Webhook历史记录,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=[_("Webhook")]) +def create_webhook_history(request, tenant_id: str, webhook_id: str): + """ 创建Webhook历史记录,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +def update_webhook_history(request, tenant_id: str, webhook_id: str, id: str): + """ 编辑Webhook历史记录,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +def delete_webhook_history(request, tenant_id: str, webhook_id: str, id: str): + """ 删除Webhook历史记录,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/retry/", tags=[_("Webhook")]) +def retry_webhook_history(request, tenant_id: str, webhook_id: str, id:str): + """ 重试webhook历史记录,TODO + """ + return {} From 49dbcd03a0d86dd2c8578577e7254e2343990af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 06:08:16 +0000 Subject: [PATCH 02/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=A2=B3=E7=90=86=E9=A1=B5=E9=9D=A2=E7=BB=93=E6=9E=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 202 ++++++------- api/v1/pages/app_manage/app_list.py | 37 +-- api/v1/pages/approve_manage/approve_action.py | 37 +-- api/v1/pages/auth_manage/auth_factor.py | 16 +- api/v1/pages/auth_manage/auth_rules.py | 37 +-- api/v1/pages/auth_manage/auto_auth.py | 37 +-- api/v1/pages/auth_manage/third_auth.py | 37 +-- .../data_source_manage/permission_sync.py | 37 +-- api/v1/pages/data_source_manage/scim_sync.py | 37 +-- api/v1/pages/developer_manage/webhook.py | 37 +-- api/v1/pages/user_manage/user_list.py | 37 +-- api/v1/views/app_group.py | 18 +- arkid/common/utils.py | 18 ++ arkid/core/actions.py | 190 +++++++++++++ arkid/core/operation.py | 4 + arkid/core/pages.py | 265 ++++++------------ 16 files changed, 483 insertions(+), 563 deletions(-) create mode 100644 arkid/core/actions.py create mode 100644 arkid/core/operation.py diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index 2faa8d077..f70501bd6 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -1,136 +1,118 @@ -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -app_group_tag = 'app_group' -app_group_name = '应用分组' +tag = 'app_group' +name = '应用分组' -page = pages.TreePage( - tag=app_group_tag, - name=app_group_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/app_groups/', - method=pages.FrontActionMethod.GET - ) +page = pages.TreePage(tag=tag,name=name) +group_apps_page = pages.TablePage(name=_("组内应用")) +edit_apps_page = pages.TablePage(name=_("更新组内应用")) +create_page = pages.FormPage(name=_("创建应用分组")) +edit_page = pages.FormPage(name=_("编辑应用分组")) + + +pages.register_front_pages(page) +pages.register_front_pages(group_apps_page) +pages.register_front_pages(edit_apps_page) +pages.register_front_pages(create_page) +pages.register_front_pages(edit_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -group_apps_page = pages.TablePage( - name='组内应用', - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', - method=pages.FrontActionMethod.GET +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/', + method=actions.FrontActionMethod.GET, + next_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', + method=actions.FrontActionMethod.GET, + result_page=group_apps_page + ) ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/app_groups/{id}/", + ) + ], + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', + method=actions.FrontActionMethod.GET, + result_page=group_apps_page + ) + ] ) -group_apps_page.add_local_action( - [ - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, +group_apps_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.OpenAction( + name=_("添加应用"), + page=edit_apps_page, + ) + ], + local_actions=[ + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/", icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.set_next(group_apps_page) - -edit_page = pages.FormPage( - name=_("编辑应用分组"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/app_groups/{id}/', - method=pages.FrontActionMethod.GET - ) -) -edit_page.add_global_action( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/app_groups/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" +edit_apps_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/', + method=actions.FrontActionMethod.GET, + ), + select=True, + global_actions=[ + actions.ConfirmAction( + path="/tenant/{tenant_id}/app_groups/{app_group_id}/apps/" ), + actions.CancelAction() ] ) -create_page = pages.FormPage( - name=_("创建一个新的应用分组"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/app_groups/', - method=pages.FrontActionMethod.POST - ) -) -create_page.add_global_action( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/app_groups/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/app_groups/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), - page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_groups/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/app_groups/", ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, - path="/api/v1/tenant/{tenant_id}/app_groups/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION - ) + actions.CancelAction(), + actions.ResetAction(), ] ) - -page.add_global_action( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) - ] -) - - -router = routers.FrontRouter( - path=app_group_tag, - name='应用分组', - page=page, -) -pages.register_front_pages(group_apps_page) -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/app_manage/app_list.py b/api/v1/pages/app_manage/app_list.py index 10fd80b4b..964d7a8db 100644 --- a/api/v1/pages/app_manage/app_list.py +++ b/api/v1/pages/app_manage/app_list.py @@ -22,24 +22,11 @@ ) ) -app_edit_page.add_global_action( +app_edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/apps/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -51,7 +38,7 @@ ) ) -app_create_page.add_global_action( +app_create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -60,16 +47,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -91,7 +70,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/approve_manage/approve_action.py b/api/v1/pages/approve_manage/approve_action.py index a10ec0157..beae7522b 100644 --- a/api/v1/pages/approve_manage/approve_action.py +++ b/api/v1/pages/approve_manage/approve_action.py @@ -22,24 +22,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -51,7 +38,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -60,16 +47,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -91,7 +70,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/auth_manage/auth_factor.py b/api/v1/pages/auth_manage/auth_factor.py index 5252e8e72..fdddb716c 100644 --- a/api/v1/pages/auth_manage/auth_factor.py +++ b/api/v1/pages/auth_manage/auth_factor.py @@ -23,7 +23,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -32,20 +32,12 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/auth_manage/auth_rules.py b/api/v1/pages/auth_manage/auth_rules.py index 772f5eb98..c31c91aec 100644 --- a/api/v1/pages/auth_manage/auth_rules.py +++ b/api/v1/pages/auth_manage/auth_rules.py @@ -23,24 +23,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -52,7 +39,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -61,16 +48,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -92,7 +71,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/auth_manage/auto_auth.py b/api/v1/pages/auth_manage/auto_auth.py index adea7da74..63b3f6cdc 100644 --- a/api/v1/pages/auth_manage/auto_auth.py +++ b/api/v1/pages/auth_manage/auto_auth.py @@ -23,24 +23,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -52,7 +39,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -61,16 +48,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -92,7 +71,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/auth_manage/third_auth.py b/api/v1/pages/auth_manage/third_auth.py index c5cdc6a1b..1ee0d130e 100644 --- a/api/v1/pages/auth_manage/third_auth.py +++ b/api/v1/pages/auth_manage/third_auth.py @@ -23,24 +23,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/third_auths/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/third_auths/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -52,7 +39,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -61,16 +48,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -92,7 +71,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/data_source_manage/permission_sync.py b/api/v1/pages/data_source_manage/permission_sync.py index 58a445df3..fdbc23721 100644 --- a/api/v1/pages/data_source_manage/permission_sync.py +++ b/api/v1/pages/data_source_manage/permission_sync.py @@ -23,24 +23,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -52,7 +39,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -61,16 +48,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -98,7 +77,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/data_source_manage/scim_sync.py b/api/v1/pages/data_source_manage/scim_sync.py index 2f512c204..2e0ddc3f8 100644 --- a/api/v1/pages/data_source_manage/scim_sync.py +++ b/api/v1/pages/data_source_manage/scim_sync.py @@ -23,24 +23,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -52,7 +39,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -61,16 +48,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -98,7 +77,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index f0703583b..2013034ec 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -25,24 +25,11 @@ ) ) -edit_page.add_global_action( +edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/webhooks/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -55,7 +42,7 @@ ) ) -create_page.add_global_action( +create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -64,16 +51,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -135,7 +114,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index 2d1c97b74..f370a9080 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -22,24 +22,11 @@ ) ) -user_edit_page.add_global_action( +user_edit_page.add_global_actions( [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/users/{id}/", - icon="icon-confirm" - ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/users/{id}/"), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -51,7 +38,7 @@ ) ) -user_create_page.add_global_action( +user_create_page.add_global_actions( [ pages.FrontAction( method=pages.FrontActionMethod.POST, @@ -60,16 +47,8 @@ action_type=pages.FrontActionType.DIRECT_ACTION, icon="icon-confirm" ), - pages.FrontAction( - name=_("取消"), - action_type=pages.FrontActionType.CANCEL_ACTION, - icon="icon-cancel" - ), - pages.FrontAction( - name=_("重置"), - action_type=pages.FrontActionType.RESET_ACTION, - icon="icon-reset" - ), + pages.CancelAction(), + pages.ResetAction(), ] ) @@ -91,7 +70,7 @@ ] ) -page.add_global_action( +page.add_global_actions( [ pages.FrontAction( name="创建", diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index c618ce640..56054c7f3 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -34,7 +34,7 @@ def delete_app_group(request, tenant_id: str, id: str): @api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) def get_apps_from_group(request, tenant_id: str, group_id: str): - """ 将应用移除出应用分组,TODO + """ 获取当前分组的应用列表,TODO """ return {} @@ -42,4 +42,18 @@ def get_apps_from_group(request, tenant_id: str, group_id: str): def remove_app_from_group(request, tenant_id: str, app_group_id: str,id:str): """ 将应用移除出应用分组,TODO """ - return {} \ No newline at end of file + return {} + +@api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) +def update_apps_from_group(request, tenant_id: str, group_id: str): + """ 更新当前分组的应用列表,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/", tags=[_("应用分组")]) +def get_select_apps(request, tenant_id: str, group_id: str): + """ 获取所有应用并附加是否在当前分组的状态,TODO + """ + return {} + + diff --git a/arkid/common/utils.py b/arkid/common/utils.py index d456153c8..4e8768ad6 100644 --- a/arkid/common/utils.py +++ b/arkid/common/utils.py @@ -2,6 +2,7 @@ from copy import deepcopy from functools import reduce from typing import Dict, List +from uuid import uuid4 def deep_merge(*dicts: List[Dict], update=False) -> Dict: @@ -178,3 +179,20 @@ def get_request_tenant(request): # 能够注册平台用户了 tenant = Tenant.active_objects.filter(id=1).first() return tenant + +global_tags = [] +def gen_tag(tag: str = None, tag_pre: str = None) -> str: + """ 生成tag + + Args: + tag (str, optional): tag字符串,可指定亦可动态生成. + tag_pre (str, optional): tag前缀,一般可为插件名称或者其他. + + Returns: + str: tag字符串 + """ + tag = tag if tag else uuid4().hex + tag = f"{tag_pre}_{tag}" if tag_pre else tag + assert tag not in global_tags + global_tags.append(tag) + return tag \ No newline at end of file diff --git a/arkid/core/actions.py b/arkid/core/actions.py new file mode 100644 index 000000000..3e7601186 --- /dev/null +++ b/arkid/core/actions.py @@ -0,0 +1,190 @@ +from enum import Enum +from typing import Union, Tuple +from arkid.common import DeepSN +from arkid.common.utils import gen_tag +from arkid.core.translation import gettext_default as _ + +class FrontActionType(Enum): + """前端动作类型枚举类 + + ActionType操作类型 [可扩展]: + ``` + - direct 直接操作类型 + - open 打开新页面类型 + - cancel 取消操作类型 + - reset 重置表单类型 + - import 导入数据类型 + - node 节点点击类型(页面中将隐藏该操作) + - url 内外链接类型 + - password 编辑密码类型 + ``` + """ + + DIRECT_ACTION = 'direct' + OPEN_ACTION = 'open' + CANCEL_ACTION = 'cancel' + RESET_ACTION = 'reset' + IMPORT_ACTION = 'import' + URL_ACTION = 'url' + PASSWORD_ACTION = 'password' + + +class FrontActionMethod(Enum): + """ 前端动作类型枚举类 + + ActionMethod 动作方法 [可扩展]: + + ``` + - get + - post + - put + - delete + ``` + """ + + GET = 'get' + POST = 'post' + PUT = 'put' + DELETE = 'delete' + + +class FrontAction(DeepSN): + """ 前端页面动作类 + + Examples: + >>> from arkid.core import pages + >>> from arkid.core.translation import gettext_default as _ + >>> + >>> edit_action = pages.FrontAction( + >>> name=_("编辑"), + >>> page=user_edit_page, + >>> icon="icon-edit", + >>> action_type=pages.FrontActionType.OPEN_ACTION + >>> ) + >>> delete_action = pages.FrontAction( + >>> name=_("删除"), + >>> method=pages.FrontActionMethod.DELETE, + >>> path="/api/v1/tenant/{tenant_id}/users/{id}/", + >>> icon="icon-delete", + >>> action_type=pages.FrontActionType.DIRECT_ACTION + >>> ) + """ + + def __init__(self, action_type: FrontActionType, tag: str = None, path: str = None, method: FrontActionMethod = None, + name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, next_action = None, + result_page = None, result_page_tag = None, *args, **kwargs): + """初始化函数 + + Args: + tag (str, optional): 标识. + action_type (FrontActionType): 动作类型. + name (str, optional): 名称. + page (FrontPage|str, optional): 指向页面,此处存储页面的标识. + path (str, optional): 请求路径. + method (FrontActionMethod, optional): 请求方法. + icon (str, optional): 图标名称. + tag_pre (str, optional): 标识前缀. + """ + self.type = action_type.value + + self.tag = gen_tag(tag, tag_pre) + + if name: + self.name = name + if page: + self.page = page.tag + # 指向page的tag + if page_tag: + self.page = page_tag + if path: + self.path = path + if method: + self.method = method + if icon: + self.icon = icon + + if next_action: + self.next_action = next_action + if result_page: + self.result_page = result_page.tag + if result_page_tag: + self.result_page = result_page_tag + + super().__init__(*args, **kwargs) + + def add_tag_pre(self, tag_pre: str): + """ 添加标识前缀 + + Args: + tag_pre (str): 标识前缀 + """ + self.tag = gen_tag(self.tag, tag_pre) + + +class DirectAction(FrontAction): + def __init__(self, *args, **kwargs): + super().__init__(action_type=FrontActionType.DIRECT_ACTION, *args, **kwargs) + + +class OpenAction(FrontAction): + def __init__(self, *args, **kwargs): + super().__init__(action_type=FrontActionType.OPEN_ACTION, *args, **kwargs) + + +class CancelAction(FrontAction): + """取消""" + + def __init__(self, *args, **kwargs): + self.name = _("取消") + super().__init__(action_type=FrontActionType.CANCEL_ACTION, *args, **kwargs) + + +class ResetAction(FrontAction): + def __init__(self, *args, **kwargs): + self.name = _("重置") + super().__init__(action_type=FrontActionType.RESET_ACTION, *args, **kwargs) + + +class ImportAction(FrontAction): + def __init__(self, *args, **kwargs): + super().__init__(action_type=FrontActionType.IMPORT_ACTION, *args, **kwargs) + + +class URLAction(FrontAction): + def __init__(self, *args, **kwargs): + super().__init__(action_type=FrontActionType.URL_ACTION, *args, **kwargs) + + +class PasswordAction(FrontAction): + def __init__(self, *args, **kwargs): + super().__init__(action_type=FrontActionType.PASSWORD_ACTION, *args, **kwargs) + + +class ConfirmAction(DirectAction): + def __init__(self, path: str, *args, **kwargs): + self.name = _("确认") + self.path = path + self.icon="icon-confirm" + self.method=FrontActionMethod.POST.value + super().__init__(*args, **kwargs) + + +class DeleteAction(DirectAction): + def __init__(self, path: str, *args, **kwargs): + self.name = _("删除"), + self.method = FrontActionMethod.DELETE.value, + self.icon="icon-delete", + self.path = path + super().__init__(*args, **kwargs) + +class CreateAction(OpenAction): + def __init__(self, page, *args, **kwargs): + self.name=_("创建"), + self.icon="icon-create", + super().__init__(page=page, *args, **kwargs) + +class EditAction(OpenAction): + def __init__(self, page, *args, **kwargs): + self.name=_("编辑"), + self.icon="icon-edit", + super().__init__(page=page, *args, **kwargs) \ No newline at end of file diff --git a/arkid/core/operation.py b/arkid/core/operation.py new file mode 100644 index 000000000..2eca5afdf --- /dev/null +++ b/arkid/core/operation.py @@ -0,0 +1,4 @@ +operation_list = {} +def get_operation(path, method): + operation_list[path+method] = False + return path, method \ No newline at end of file diff --git a/arkid/core/pages.py b/arkid/core/pages.py index d4c6ac610..628bbc19e 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -1,22 +1,23 @@ - -from collections import OrderedDict -from uuid import uuid4 from enum import Enum from arkid.common import DeepSN +from arkid.common.utils import gen_tag +from arkid.core.actions import FrontAction +from arkid.core.translation import gettext_default as _ global_pages = {} + class FrontPageType(Enum): """前端页面类型枚举类 Type页面类型 [可扩展]: ``` - - 表格型页面 (table) - - 表单型页面 (form) - - 描述型页面 (description) - - 树状型页面 (tree) - - 切换型页面 (tabs)- 暂不支持 - - 列表型页面 (list)- 暂不支持 - - 卡片型页面 (cards)- 暂不支持 - - 网格型页面 (grid)- 暂不支持 + - 表格型页面 (table) + - 表单型页面 (form) + - 描述型页面 (description) + - 树状型页面 (tree) + - 切换型页面 (tabs)- 暂不支持 + - 列表型页面 (list)- 暂不支持 + - 卡片型页面 (cards)- 暂不支持 + - 网格型页面 (grid)- 暂不支持 ``` """ FORM_PAGE = 'form' @@ -28,23 +29,12 @@ class FrontPageType(Enum): CARDS_PAGE = 'cards' GRID_PAGE = 'grid' -global_tags = [] # 全局tag列表 -def gen_tag(tag:str=None,tag_pre:str=None) -> str: - """ 为页面或者行为生成tag +global_tags = [] # 全局tag列表 + + - Args: - tag (str, optional): tag字符串,可指定亦可动态生成. - tag_pre (str, optional): tag前缀,一般可为插件名称或者其他. - Returns: - str: tag字符串 - """ - tag = tag if tag else uuid4().hex - tag = f"{tag_pre}_{tag}" if tag_pre else tag - assert tag not in global_tags - global_tags.append(tag) - return tag class FrontPage(DeepSN): """ 前端页面配置类 @@ -87,21 +77,29 @@ class FrontPage(DeepSN): >>> ] >>> ) """ - def __init__(self, name:str, tag:str=None, tag_pre:str=None, *args, **kwargs): + + def __init__(self, name: str, tag: str = None, tag_pre: str = None, *args, **kwargs): """初始化函数 Args: name (str): 页面名称 page_type (FrontPageType): 页面类型 init_action (FrontAction|OrderedDict): 初始化动作 + global_actions (list): 全局动作 + local_actions (list): 本地动作 tag (str, optional): 标识. tag_pre (str, optional): 标识前缀. """ - self.tag = gen_tag(tag,tag_pre) + self.tag = gen_tag(tag, tag_pre) self.name = name super().__init__(*args, **kwargs) - - def add_global_action(self, actions): + + def create_actions(self, init_action:FrontAction = None, global_actions: list = None, local_actions: list = None): + self.init_action = init_action + self.add_global_actions(global_actions) + self.add_local_action(local_actions) + + def add_global_actions(self, actions): """ 添加全局动作 Args: @@ -109,10 +107,10 @@ def add_global_action(self, actions): """ if not isinstance(actions, tuple) or not isinstance(actions, list): actions = list(actions) - if not hasattr(self,"global_action"): + if not hasattr(self, "global_action"): self.global_action = [] self.global_action.extend(actions) - + def add_local_action(self, actions): """ 添加表单动作 @@ -121,192 +119,102 @@ def add_local_action(self, actions): """ if not isinstance(actions, tuple) or not isinstance(actions, list): actions = list(actions) - if not hasattr(self,"local_action"): + if not hasattr(self, "local_action"): self.local_action = [] - self.local_action.extend(actions) + self.local_action.extend(actions) - def add_node_action(self, actions): - """ 添加树节点动作 - - Args: - actions (FrontAction|OrderedDict)): 动作列表 - """ - if not isinstance(actions, tuple) or not isinstance(actions, list): - actions = list(actions) - if not hasattr(self,'node'): - self.node = [] - self.node.extend(actions) - - def add_tag_pre(self,tag_pre:str): + def add_tag_pre(self, tag_pre: str): """添加标识前缀 - 用于插件中生成页面时给页面的标识添加前缀 - Args: tag_pre (str): 前缀 """ - self.tag = gen_tag(self.tag,tag_pre) + self.tag = gen_tag(self.tag, tag_pre) def dict(self): return super().dict() + +class SelectPage(FrontPage): + """选择型页面 + """ + + def __init__(self, select: bool = False, *args, **kwargs): + self.select = select + super().__init__(*args, **kwargs) + + def create_actions(self, select:bool=True,*args, **kwargs): + self.select = select + return super().create_actions(*args, **kwargs) + + class FormPage(FrontPage): """表单页面 """ + def __init__(self, *args, **kwargs): - self.type = FrontPageType.FORM_PAGE.value - super().__init__(*args, **kwargs) + super().__init__(type=FrontPageType.FORM_PAGE, *args, **kwargs) -class TablePage(FrontPage): + +class TablePage(SelectPage): """表格页面 """ + def __init__(self, *args, **kwargs): - self.type = FrontPageType.TABLE_PAGE.value - super().__init__(*args, **kwargs) + super().__init__(type=FrontPageType.TABLE_PAGE, *args, **kwargs) -class TreePage(FrontPage): + +class TreePage(SelectPage): """树形页面 """ - def __init__(self, *args, **kwargs): - self.type = FrontPageType.TREE_PAGE.value - super().__init__(*args, **kwargs) - def set_next(self,next): - self.next = next.tag if isinstance(next,FrontPage) else next + def create_actions(self, init_action: FrontAction = None, global_actions: list = None, local_actions: list = None, node_actions:list = None): + self.add_node_action(node_actions) + return super().create_actions(init_action, global_actions, local_actions) + + def add_node_action(self, actions): + """ 添加表单动作 + + Args: + actions (FrontAction|OrderedDict)): 动作列表 + """ + if not isinstance(actions, tuple) or not isinstance(actions, list): + actions = list(actions) + if not hasattr(self, "local_action"): + self.local_action = [] + self.local_action.extend(actions) + class DescriptionPage(FrontPage): """描述页面 """ - def __init__(self, *args, **kwargs): - self.type = FrontPageType.DESCRIPTION_PAGE.value - super().__init__(*args, **kwargs) -class ListPage(FrontPage): - """列表页面 - """ def __init__(self, *args, **kwargs): - self.type = FrontPageType.LIST_PAGE.value - super().__init__(*args, **kwargs) + super().__init__(type=FrontPageType.DESCRIPTION_PAGE, *args, **kwargs) -class CardsPage(FrontPage): - """卡片列表 - """ - def __init__(self, *args, **kwargs): - self.type = FrontPageType.CARDS_PAGE.value - super().__init__(*args, **kwargs) -class GridPage(FrontPage): - """网格页面 +class ListPage(SelectPage): + """列表页面 """ + def __init__(self, *args, **kwargs): - self.type = FrontPageType.GRID_PAGE.value - super().__init__(*args, **kwargs) + super().__init__(type=FrontPageType.LIST_PAGE, *args, **kwargs) -class FrontActionType(Enum): - """前端动作类型枚举类 - - ActionType操作类型 [可扩展]: - ``` - - direct 直接操作类型 - - open 打开新页面类型 - - cancel 取消操作类型 - - reset 重置表单类型 - - import 导入数据类型 - - node 节点点击类型(页面中将隐藏该操作) - - url 内外链接类型 - - password 编辑密码类型 - ``` - """ - - DIRECT_ACTION = 'direct' - OPEN_ACTION = 'open' - CANCEL_ACTION = 'cancel' - RESET_ACTION = 'reset' - IMPORT_ACTION = 'import' - NODE_ACTION = 'node' - URL_ACTION = 'url' - PASSWORD_ACTION = 'password' - -class FrontActionMethod(Enum): - """ 前端动作类型枚举类 - - ActionMethod 动作方法 [可扩展]: - - ``` - - get - - post - - put - - delete - ``` +class CardsPage(SelectPage): + """卡片列表 """ - - GET = 'get' - POST = 'post' - PUT = 'put' - DELETE = 'delete' + def __init__(self, *args, **kwargs): + super().__init__(type=FrontPageType.CARDS_PAGE, *args, **kwargs) -class FrontAction(DeepSN): - """ 前端页面动作类 - Examples: - >>> from arkid.core import pages - >>> from arkid.core.translation import gettext_default as _ - >>> - >>> edit_action = pages.FrontAction( - >>> name=_("编辑"), - >>> page=user_edit_page, - >>> icon="icon-edit", - >>> action_type=pages.FrontActionType.OPEN_ACTION - >>> ) - >>> delete_action = pages.FrontAction( - >>> name=_("删除"), - >>> method=pages.FrontActionMethod.DELETE, - >>> path="/api/v1/tenant/{tenant_id}/users/{id}/", - >>> icon="icon-delete", - >>> action_type=pages.FrontActionType.DIRECT_ACTION - >>> ) +class GridPage(FrontPage): + """网格页面 """ - - def __init__(self, tag:str=None, action_type:FrontActionType=None,name:str=None, page=None, path:str=None, method:FrontActionMethod=None, icon:str=None,tag_pre:str=None, *args, **kwargs): - """初始化函数 - - Args: - tag (str, optional): 标识. - action_type (FrontActionType, optional): 动作类型. - name (str, optional): 名称. - page (FrontPage|str, optional): 指向页面,此处存储页面的标识. - path (str, optional): 请求路径. - method (FrontActionMethod, optional): 请求方法. - icon (str, optional): 图标名称. - tag_pre (str, optional): 标识前缀. - """ - self.tag = gen_tag(tag,tag_pre) - - if name: - self.name = name - # 指向page的tag - if page: - self.page = page.tag if isinstance(page,FrontPage) else page - if path: - self.path = path - if method: - self.method = method.value - if icon: - self.icon = icon - - if action_type: - self.type = action_type.value - super().__init__(*args, **kwargs) - - def add_tag_pre(self,tag_pre:str): - """ 添加标识前缀 - Args: - tag_pre (str): 标识前缀 - """ - self.tag = gen_tag(self.tag,tag_pre) + def __init__(self, *args, **kwargs): + super().__init__(type=FrontPageType.GRID_PAGE, *args, **kwargs) def register_front_pages(pages): """注册前端页面 @@ -316,7 +224,7 @@ def register_front_pages(pages): """ if not isinstance(pages, tuple) or not isinstance(pages, list): pages = [pages] - + for page in pages: global_pages[page.tag] = page @@ -333,7 +241,8 @@ def unregister_front_pages(pages): for page in pages: global_pages.pop(page.tag) + def get_global_pages(): """获取页面列表 """ - return [ item.dict() for item in list(global_pages.values()) ] \ No newline at end of file + return [item.dict() for item in list(global_pages.values())] From c7abe4c573181adaa7f801cb3389adda075aebdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 06:53:20 +0000 Subject: [PATCH 03/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=8C=89=E7=85=A7?= =?UTF-8?q?=E6=96=B0=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_list.py | 125 +++++++---------- api/v1/pages/app_manage/app_protocol.py | 13 +- api/v1/pages/approve_manage/approve_action.py | 121 +++++++---------- api/v1/pages/approve_manage/approve_system.py | 16 +-- api/v1/pages/auth_manage/auth_factor.py | 97 ++++++------- api/v1/pages/auth_manage/auth_rules.py | 122 +++++++---------- api/v1/pages/auth_manage/auto_auth.py | 122 +++++++---------- api/v1/pages/auth_manage/third_auth.py | 122 +++++++---------- .../data_source_manage/permission_sync.py | 127 +++++++----------- api/v1/pages/data_source_manage/scim_sync.py | 127 +++++++----------- api/v1/views/auth_fator.py | 25 +++- arkid/core/pages.py | 2 +- 12 files changed, 421 insertions(+), 598 deletions(-) diff --git a/api/v1/pages/app_manage/app_list.py b/api/v1/pages/app_manage/app_list.py index 964d7a8db..b60c75c11 100644 --- a/api/v1/pages/app_manage/app_list.py +++ b/api/v1/pages/app_manage/app_list.py @@ -1,94 +1,67 @@ -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -app_list_tag = 'app_list' -app_list_name = '应用列表' +tag = 'app_list' +name = '应用列表' -page = pages.TablePage( - tag=app_list_tag, - name=app_list_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/apps/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑应用")) +create_page = pages.FormPage(name=_("创建一个新的应用")) -app_edit_page = pages.FormPage( - name=_("编辑应用"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/apps/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -app_edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + icon='app', + page=page, ) -app_create_page = pages.FormPage( - name=_("创建一个新的应用"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/apps/', - method=pages.FrontActionMethod.POST - ) -) - -app_create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/apps/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), - page=app_edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/apps/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=app_create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=app_list_tag, - name='应用管理', - icon='app', - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/apps/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(app_create_page) -pages.register_front_pages(app_edit_page) \ No newline at end of file diff --git a/api/v1/pages/app_manage/app_protocol.py b/api/v1/pages/app_manage/app_protocol.py index ed12897ff..d8f813690 100644 --- a/api/v1/pages/app_manage/app_protocol.py +++ b/api/v1/pages/app_manage/app_protocol.py @@ -3,20 +3,17 @@ from arkid.core.translation import gettext_default as _ from arkid.core.pages import FormPage,register_front_pages -app_protocol_tag = "app_protocol" -app_protocol_name = _("应用协议") +tag = "app_protocol" +name = _("应用协议") -page = FormPage( - name=app_protocol_name, - tag=app_protocol_tag, -) +page = FormPage(name=name,tag=tag) register_front_pages(page) router = FrontRouter( - path=app_protocol_tag, - name=app_protocol_name, + path=tag, + name=name, icon='app', page=page, ) \ No newline at end of file diff --git a/api/v1/pages/approve_manage/approve_action.py b/api/v1/pages/approve_manage/approve_action.py index beae7522b..3d87f4e73 100644 --- a/api/v1/pages/approve_manage/approve_action.py +++ b/api/v1/pages/approve_manage/approve_action.py @@ -1,93 +1,66 @@ -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -approve_action_tag = 'approve_action' -approve_action_name = '审批动作' +tag = 'approve_actions' +name = '审批动作' -page = pages.TablePage( - tag=approve_action_tag, - name=approve_action_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/approve_actions/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑审批动作")) +create_page = pages.FormPage(name=_("创建一个新的审批动作")) -edit_page = pages.FormPage( - name=_("编辑审批"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/approve_actions/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的审批"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/approve_actions/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/approve_actions/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/approve_actions/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=approve_action_tag, - name=approve_action_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/approve_actions/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/approve_actions/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/approve_manage/approve_system.py b/api/v1/pages/approve_manage/approve_system.py index 1d43d3059..9c62eb3f7 100644 --- a/api/v1/pages/approve_manage/approve_system.py +++ b/api/v1/pages/approve_manage/approve_system.py @@ -1,22 +1,18 @@ -# 审批系统 +# 应用协议 from arkid.core.routers import FrontRouter from arkid.core.translation import gettext_default as _ from arkid.core.pages import FormPage,register_front_pages -approve_system_tag = "approve_system" -approve_system_name = _("审批系统") +tag = "approve_system" +name = _("审批系统") -page = FormPage( - name=approve_system_name, - tag=approve_system_tag -) +page = FormPage(name=name,tag=tag) register_front_pages(page) router = FrontRouter( - path=approve_system_tag, - name=approve_system_name, - icon='app', + path=tag, + name=name, page=page, ) \ No newline at end of file diff --git a/api/v1/pages/auth_manage/auth_factor.py b/api/v1/pages/auth_manage/auth_factor.py index fdddb716c..1f05a4f99 100644 --- a/api/v1/pages/auth_manage/auth_factor.py +++ b/api/v1/pages/auth_manage/auth_factor.py @@ -1,59 +1,66 @@ -# 认证因素 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -auth_factor_tag = 'auth_factor' -auth_factor_name = '认证因素' +tag = 'auth_factor' +name = '认证因素' -page = pages.TablePage( - tag=auth_factor_tag, - name=auth_factor_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auth_factor/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑认证因素")) +create_page = pages.FormPage(name=_("创建一个新的认证因素")) -create_page = pages.FormPage( - name=_("创建一个新的认证因素"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auth_factor/', - method=pages.FrontActionMethod.POST - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/auth_factor/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auth_factors/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION ) - ] + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/auth_factors/{id}/", + ) + ], ) - -router = routers.FrontRouter( - path=auth_factor_tag, - name=auth_factor_name, - page=page, +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auth_factors/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_factors/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] ) -pages.register_front_pages(page) -pages.register_front_pages(create_page) \ No newline at end of file +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auth_factors/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auth_factors/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/auth_manage/auth_rules.py b/api/v1/pages/auth_manage/auth_rules.py index c31c91aec..88995361d 100644 --- a/api/v1/pages/auth_manage/auth_rules.py +++ b/api/v1/pages/auth_manage/auth_rules.py @@ -1,94 +1,66 @@ -# 认证规则 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -auth_rule_tag = 'auth_rule' -auth_rule_name = '认证规则' +tag = 'auth_rule' +name = '认证规则' -page = pages.TablePage( - tag=auth_rule_tag, - name=auth_rule_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auth_rules/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑认证规则")) +create_page = pages.FormPage(name=_("创建一个新的认证规则")) -edit_page = pages.FormPage( - name=_("编辑认证规则"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auth_rules/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的认证规则"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/auth_rules/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/auth_rules/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auth_rules/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=auth_rule_tag, - name=auth_rule_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auth_rules/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auth_rules/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/auth_manage/auto_auth.py b/api/v1/pages/auth_manage/auto_auth.py index 63b3f6cdc..07b9ae4c5 100644 --- a/api/v1/pages/auth_manage/auto_auth.py +++ b/api/v1/pages/auth_manage/auto_auth.py @@ -1,94 +1,66 @@ -# 自动认证 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -auto_auth_tag = 'auto_auth' -auto_auth_name = '自动认证' +tag = 'auto_auth' +name = '自动认证' -page = pages.TablePage( - tag=auto_auth_tag, - name=auto_auth_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auto_auths/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑自动认证")) +create_page = pages.FormPage(name=_("创建一个新的自动认证")) -edit_page = pages.FormPage( - name=_("编辑自动认证"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/auto_auths/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的自动认证"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/auto_auths/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/auto_auths/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auto_auths/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=auto_auth_tag, - name=auto_auth_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/auto_auths/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auto_auths/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/auth_manage/third_auth.py b/api/v1/pages/auth_manage/third_auth.py index 1ee0d130e..c16402fb8 100644 --- a/api/v1/pages/auth_manage/third_auth.py +++ b/api/v1/pages/auth_manage/third_auth.py @@ -1,94 +1,66 @@ -# 第三方认证 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -third_auth_tag = 'third_auth' -third_auth_name = '第三方认证' +tag = 'third_auth' +name = '第三方认证' -page = pages.TablePage( - tag=third_auth_tag, - name=third_auth_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/third_auths/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑第三方认证")) +create_page = pages.FormPage(name=_("创建一个新的第三方认证")) -edit_page = pages.FormPage( - name=_("编辑第三方认证"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/third_auths/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/third_auths/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的第三方认证"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/third_auths/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/third_auths/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/third_auths/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/third_auths/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/third_auths/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=third_auth_tag, - name=third_auth_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/third_auths/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/third_auths/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/data_source_manage/permission_sync.py b/api/v1/pages/data_source_manage/permission_sync.py index fdbc23721..e8d9cc49b 100644 --- a/api/v1/pages/data_source_manage/permission_sync.py +++ b/api/v1/pages/data_source_manage/permission_sync.py @@ -1,100 +1,71 @@ -# 权限数据同步 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -permission_sync_tag = 'permission_sync' -permission_sync_name = '权限数据同步' +tag = 'permission_sync' +name = '权限同步' -page = pages.TablePage( - tag=permission_sync_tag, - name=permission_sync_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/permission_syncs/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑权限同步配置")) +create_page = pages.FormPage(name=_("创建一个新的权限同步配置")) -edit_page = pages.FormPage( - name=_("编辑权限数据同步配置"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/permission_syncs/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的权限数据同步配置"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/permission_syncs/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/permission_syncs/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.DirectAction( name=_("同步"), - method=pages.FrontActionMethod.GET, + method=actions.FrontActionMethod.GET, path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/sync/", - action_type=pages.FrontActionType.DIRECT_ACTION ), - pages.FrontAction( - name=_("编辑"), + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_syncs/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=permission_sync_tag, - name=permission_sync_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_syncs/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_syncs/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/data_source_manage/scim_sync.py b/api/v1/pages/data_source_manage/scim_sync.py index 2e0ddc3f8..a8207c613 100644 --- a/api/v1/pages/data_source_manage/scim_sync.py +++ b/api/v1/pages/data_source_manage/scim_sync.py @@ -1,100 +1,71 @@ -# 用户数据同步 -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -scim_sync_tag = 'scim_sync' -scim_sync_name = '用户数据同步' +tag = 'scim_sync' +name = '用户/群组数据同步' -page = pages.TablePage( - tag=scim_sync_tag, - name=scim_sync_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/scim_syncs/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑用户/群组数据同步配置")) +create_page = pages.FormPage(name=_("创建一个新的用户/群组数据同步配置")) -edit_page = pages.FormPage( - name=_("编辑用户数据同步配置"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/scim_syncs/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的用户数据同步配置"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/scim_syncs/', - method=pages.FrontActionMethod.POST - ) -) - -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/scim_syncs/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.DirectAction( name=_("同步"), - method=pages.FrontActionMethod.GET, + method=actions.FrontActionMethod.GET, path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/sync/", - action_type=pages.FrontActionType.DIRECT_ACTION ), - pages.FrontAction( - name=_("编辑"), + actions.EditAction( page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/scim_syncs/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=scim_sync_tag, - name=scim_sync_name, - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/scim_syncs/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/scim_syncs/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/views/auth_fator.py b/api/v1/views/auth_fator.py index cce6bd149..344e3353e 100644 --- a/api/v1/views/auth_fator.py +++ b/api/v1/views/auth_fator.py @@ -20,7 +20,7 @@ class AuthFatorSchemaOut(Schema): config_id: str @transaction.atomic -@api.post("/{tenant_id}/auth_fator/", response=AuthFatorSchemaOut, tags=['认证因素'], auth=None) +@api.post("/{tenant_id}/auth_fators/", response=AuthFatorSchemaOut, tags=['认证因素'], auth=None) def create_auth_fator(request, tenant_id: str, data: AuthFatorSchemaIn): config = TenantExtensionConfig() config.tenant = request.tenant @@ -36,8 +36,27 @@ def create_auth_fator(request, tenant_id: str, data: AuthFatorSchemaIn): class AuthFatorListSchemaOut(Schema): data: List[AuthFatorListSchemaItem] -@api.get("/{tenant_id}/auth_fator/", response=AuthFatorListSchemaOut, tags=['认证因素'], auth=None) +@api.get("/{tenant_id}/auth_fators/", response=AuthFatorListSchemaOut, tags=['认证因素'], auth=None) def get_auth_fator_list(request, tenant_id: str): extensions = Extension.active_objects.filter(type=AuthFactorExtension.TYPE).all() configs = TenantExtensionConfig.active_objects.filter(extension__in=extensions) - return {"data": configs} \ No newline at end of file + return {"data": configs} + +@api.get("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +def get_auth_fator(request, tenant_id: str, id: str): + """ 获取认证因素,TODO + """ + return {} + + +@api.put("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +def update_auth_fator(request, tenant_id: str, id: str): + """ 编辑认证因素,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +def delete_auth_fator(request, tenant_id: str, id: str): + """ 删除认证因素,TODO + """ + return {} diff --git a/arkid/core/pages.py b/arkid/core/pages.py index 628bbc19e..47f21afb8 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -143,7 +143,7 @@ def __init__(self, select: bool = False, *args, **kwargs): self.select = select super().__init__(*args, **kwargs) - def create_actions(self, select:bool=True,*args, **kwargs): + def create_actions(self, select:bool=False,*args, **kwargs): self.select = select return super().create_actions(*args, **kwargs) From c8f95339897c20d420aabd81afa3e7b26caa6499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 09:06:50 +0000 Subject: [PATCH 04/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=A4=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/actions/__init__.py | 0 api/v1/pages/desktop/app_list.py | 28 +-- api/v1/pages/developer_manage/api_docs.py | 8 +- api/v1/pages/developer_manage/webhook.py | 185 +++++++----------- api/v1/pages/log_manage/__init__.py | 14 +- api/v1/pages/log_manage/administrator_log.py | 1 - api/v1/pages/log_manage/log_config.py | 27 ++- api/v1/pages/log_manage/manager_log.py | 36 ++++ api/v1/pages/log_manage/user_log.py | 37 +++- api/v1/pages/mine/__init__.py | 7 + api/v1/pages/mine/approval_manage.py | 22 --- api/v1/pages/mine/approve_manage.py | 28 +++ api/v1/pages/mine/auth_manage.py | 11 +- api/v1/pages/mine/grant_manage.py | 52 ++++- api/v1/pages/mine/logout.py | 12 +- api/v1/pages/mine/profile.py | 29 +++ api/v1/pages/mine/switch_tenant.py | 31 ++- api/v1/pages/mine/user_profile.py | 1 - api/v1/pages/permission_manage/__init__.py | 14 ++ .../pages/permission_manage/grant_manage.py | 1 - .../grant_manage/__init__.py | 9 + .../grant_manage/app_grant.py | 0 .../grant_manage/group_grant.py | 0 .../grant_manage/user_grant.py | 0 api/v1/pages/permission_manage/grant_rules.py | 67 ++++++- .../permission_manage/permission_group.py | 119 ++++++++++- .../permission_manage/permission_list.py | 67 ++++++- .../pages/tenant_manage/extension_manage.py | 1 + api/v1/views/approve_action.py | 2 +- api/v1/views/log.py | 33 ++++ api/v1/views/mine.py | 48 ++++- api/v1/views/permission.py | 35 ++++ api/v1/views/permission_group.py | 59 ++++++ api/v1/views/permission_rule.py | 35 ++++ api/v1/views/tenant.py | 9 + arkid/core/actions.py | 34 +++- arkid/core/openapi.py | 3 +- arkid/core/pages.py | 53 +++-- 38 files changed, 916 insertions(+), 202 deletions(-) create mode 100644 api/v1/actions/__init__.py delete mode 100644 api/v1/pages/log_manage/administrator_log.py create mode 100644 api/v1/pages/log_manage/manager_log.py delete mode 100644 api/v1/pages/mine/approval_manage.py create mode 100644 api/v1/pages/mine/approve_manage.py create mode 100644 api/v1/pages/mine/profile.py delete mode 100644 api/v1/pages/mine/user_profile.py delete mode 100644 api/v1/pages/permission_manage/grant_manage.py create mode 100644 api/v1/pages/permission_manage/grant_manage/__init__.py create mode 100644 api/v1/pages/permission_manage/grant_manage/app_grant.py create mode 100644 api/v1/pages/permission_manage/grant_manage/group_grant.py create mode 100644 api/v1/pages/permission_manage/grant_manage/user_grant.py create mode 100644 api/v1/views/log.py create mode 100644 api/v1/views/permission.py create mode 100644 api/v1/views/permission_group.py create mode 100644 api/v1/views/permission_rule.py create mode 100644 api/v1/views/tenant.py diff --git a/api/v1/actions/__init__.py b/api/v1/actions/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/api/v1/pages/desktop/app_list.py b/api/v1/pages/desktop/app_list.py index c61c4c6c4..6d6df1d5d 100644 --- a/api/v1/pages/desktop/app_list.py +++ b/api/v1/pages/desktop/app_list.py @@ -1,21 +1,21 @@ -from arkid.core import routers, pages +from arkid.core import routers, pages, actions -app_list_tag = 'mine_app_list' -app_list_name = '应用市集' +tag = 'mine_app_list' +name = '应用市集' -page = pages.CardsPage( - tag = app_list_tag, - name = app_list_name, - init_action=pages.FrontAction( - path = '/api/v1/tenant/{tenant_id}/mine/apps/', - method = pages.FrontActionMethod.GET - ) -) +page = pages.CardsPage(tag = tag, name = name) + +pages.register_front_pages(page) router = routers.FrontRouter( - path=app_list_tag, - name=app_list_name, + path=tag, + name=name, page=page ) -pages.register_front_pages(page) +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/mine/tenant/{tenant_id}/apps/', + method=actions.FrontActionMethod.GET, + ) +) \ No newline at end of file diff --git a/api/v1/pages/developer_manage/api_docs.py b/api/v1/pages/developer_manage/api_docs.py index dc2199763..090f0e027 100644 --- a/api/v1/pages/developer_manage/api_docs.py +++ b/api/v1/pages/developer_manage/api_docs.py @@ -2,11 +2,11 @@ from arkid.core.routers import FrontRouter from arkid.core.translation import gettext_default as _ -api_docs_tag = "api_docs" -api_docs_name = _("API文档") +tag = "api_docs" +name = _("API文档") router = FrontRouter( - path=api_docs_tag, - name=api_docs_name, + path=tag, + name=name, url='/api/v1/redoc' ) \ No newline at end of file diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index 2013034ec..d52b9df63 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -1,138 +1,103 @@ # Webhook -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -webhook_tag = 'webhook' -webhook_name = 'Webhook' +tag = 'webhook' +name = 'Webhook' -page = pages.TablePage( - tag=webhook_tag, - name=webhook_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/webhooks/', - method=pages.FrontActionMethod.GET, - action_type=pages.FrontActionType.DIRECT_ACTION - ) -) +page = pages.TablePage(tag=tag,name=name) +edit_page = pages.FormPage( name=_("编辑Webhook") ) +create_page = pages.FormPage( name=_("创建一个新的Webhook") ) +history_page = pages.TablePage( tag="webhook_history", name=_("webhook历史记录")) +history_detail_page = pages.DescriptionPage(name=_("webhook历史记录详情")) -edit_page = pages.FormPage( - name=_("编辑Webhook"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/webhooks/{id}/', - method=pages.FrontActionMethod.GET, - action_type=pages.FrontActionType.DIRECT_ACTION - ) -) +pages.register_front_pages(page) +pages.register_front_pages(history_page) +pages.register_front_pages(create_page) +pages.register_front_pages(edit_page) +pages.register_front_pages(history_detail_page) -edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + page=page, ) -create_page = pages.FormPage( - name=_("创建一个新的Webhook"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/webhooks/', - method=pages.FrontActionMethod.POST, - action_type=pages.FrontActionType.DIRECT_ACTION - ) + method=actions.FrontActionMethod.GET, + ), + global_actions = [ + actions.CreateAction( + page=create_page, + ) + ], + local_actions = [ + actions.OpenAction( + name=_("历史记录"), + page=history_page, + icon="icon-edit", + ), + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/webhooks/{id}/" + ) + ] ) -create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/webhooks/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/webhooks/{id}/', + method=actions.FrontActionMethod.GET, + ), + global_actions = [ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) -history_page = pages.TablePage( - name=_("webhook历史记录"), - tag="webhook_history", - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/', - method=pages.FrontActionMethod.GET, - action_type=pages.FrontActionType.DIRECT_ACTION - ) +create_page.create_actions( + # name=_("创建一个新的Webhook"), + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/webhooks/', + method=actions.FrontActionMethod.POST + ), + global_actions = [ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/"), + actions.CancelAction(), + actions.ResetAction(), + ] ) -history_page.add_local_action( - [ - pages.FrontAction( +history_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/', + method=actions.FrontActionMethod.GET, + ), + local_actions = [ + actions.OpenAction( name=_("查阅"), - path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/', - method=pages.FrontActionMethod.GET, - action_type=pages.FrontActionType.DIRECT_ACTION + page=history_detail_page ), - pages.FrontAction( + actions.DirectAction( name=_("重试"), path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/retry/', - method=pages.FrontActionMethod.GET, - action_type=pages.FrontActionType.DIRECT_ACTION + method=actions.FrontActionMethod.GET, ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/', - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION - ) - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("历史记录"), - page=history_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION - ), - pages.FrontAction( - name=_("编辑"), - page=edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION - ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, - path="/api/v1/tenant/{tenant_id}/webhooks/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) ] ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) - ] -) - - -router = routers.FrontRouter( - path=webhook_tag, - name=webhook_name, - page=page, +history_detail_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/', + method=actions.FrontActionMethod.GET, + ) ) - -pages.register_front_pages(history_page) -pages.register_front_pages(page) -pages.register_front_pages(create_page) -pages.register_front_pages(edit_page) \ No newline at end of file diff --git a/api/v1/pages/log_manage/__init__.py b/api/v1/pages/log_manage/__init__.py index 9268cdec2..44facee0b 100644 --- a/api/v1/pages/log_manage/__init__.py +++ b/api/v1/pages/log_manage/__init__.py @@ -1 +1,13 @@ -# 日志管理 \ No newline at end of file +from arkid.core import routers +from arkid.core.translation import gettext_default as _ +from . import log_config,manager_log,user_log + +router = routers.FrontRouter( + path='log_manage', + name=_('日志管理'), + children=[ + log_config.router, + manager_log.router, + user_log.router, + ] +) \ No newline at end of file diff --git a/api/v1/pages/log_manage/administrator_log.py b/api/v1/pages/log_manage/administrator_log.py deleted file mode 100644 index 57c429229..000000000 --- a/api/v1/pages/log_manage/administrator_log.py +++ /dev/null @@ -1 +0,0 @@ -# 管理员行为日志 \ No newline at end of file diff --git a/api/v1/pages/log_manage/log_config.py b/api/v1/pages/log_manage/log_config.py index 53e59f645..0ebfbb04c 100644 --- a/api/v1/pages/log_manage/log_config.py +++ b/api/v1/pages/log_manage/log_config.py @@ -1 +1,26 @@ -# 日志配置 \ No newline at end of file +from arkid.core import routers, pages, actions + +tag = 'log_config' +name = '日志配置' + +page = pages.FormPage(tag = tag, name = name) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path="/api/v1/tenant/{tenant_id}/log_config/", + method=actions.FrontActionMethod.GET, + ), + global_actions = [ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/log_config/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) \ No newline at end of file diff --git a/api/v1/pages/log_manage/manager_log.py b/api/v1/pages/log_manage/manager_log.py new file mode 100644 index 000000000..afa75969e --- /dev/null +++ b/api/v1/pages/log_manage/manager_log.py @@ -0,0 +1,36 @@ +from arkid.core import routers, pages, actions + +tag = 'manager_log' +name = '管理员行为日志' + +page = pages.TablePage(tag = tag, name = name) +detail_page = pages.DescriptionPage() + +pages.register_front_pages(page) +pages.register_front_pages(detail_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/manager_log/', + method=actions.FrontActionMethod.GET, + ), + local_actions=[ + actions.OpenAction( + name=_("查阅"), + page=detail_page + ) + ] +) + +detail_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/log/{id}/', + method=actions.FrontActionMethod.GET, + ) +) \ No newline at end of file diff --git a/api/v1/pages/log_manage/user_log.py b/api/v1/pages/log_manage/user_log.py index a63cac0f3..a02e4a8aa 100644 --- a/api/v1/pages/log_manage/user_log.py +++ b/api/v1/pages/log_manage/user_log.py @@ -1 +1,36 @@ -# 用户日志 \ No newline at end of file +from arkid.core import routers, pages, actions + +tag = 'user_log' +name = '用户行为日志' + +page = pages.TablePage(tag = tag, name = name) +detail_page = pages.DescriptionPage() + +pages.register_front_pages(page) +pages.register_front_pages(detail_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_log/', + method=actions.FrontActionMethod.GET, + ), + local_actions=[ + actions.OpenAction( + name=_("查阅"), + page=detail_page + ) + ] +) + +detail_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/log/{id}/', + method=actions.FrontActionMethod.GET, + ) +) \ No newline at end of file diff --git a/api/v1/pages/mine/__init__.py b/api/v1/pages/mine/__init__.py index f1c3a0ba2..0a24def0c 100644 --- a/api/v1/pages/mine/__init__.py +++ b/api/v1/pages/mine/__init__.py @@ -1,10 +1,17 @@ from arkid.core import routers from arkid.core.translation import gettext_default as _ +from . import profile, approve_manage,auth_manage,grant_manage,switch_tenant,logout router = routers.FrontRouter( path='mine', name=_('我的'), children=[ + profile.router, + approve_manage.router, + auth_manage.router, + grant_manage.router, + switch_tenant.router, + logout.router ] ) diff --git a/api/v1/pages/mine/approval_manage.py b/api/v1/pages/mine/approval_manage.py deleted file mode 100644 index 255081152..000000000 --- a/api/v1/pages/mine/approval_manage.py +++ /dev/null @@ -1,22 +0,0 @@ -# 审批管理 -from arkid.core.routers import FrontRouter -from arkid.core.translation import gettext_default as _ -from arkid.core.pages import FormPage,register_front_pages - -approve_action_tag = "approve_action" -approve_action_name = _("审批动作") - - -page = FormPage( - name=approve_action_name, - tag=approve_action_tag -) - -register_front_pages(page) - -router = FrontRouter( - path=approve_action_tag, - name=approve_action_name, - icon='app', - page=page, -) \ No newline at end of file diff --git a/api/v1/pages/mine/approve_manage.py b/api/v1/pages/mine/approve_manage.py new file mode 100644 index 000000000..4f4528e85 --- /dev/null +++ b/api/v1/pages/mine/approve_manage.py @@ -0,0 +1,28 @@ +# 审批管理 +from arkid.core.translation import gettext_default as _ +from arkid.core import pages,routers,actions + +tag = "mine_approve_manage" +name = _("审批动作") + + +page = pages.TablePage( + name=name, + tag=tag +) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + icon='app', + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/mine/tenant/{tenant_id}/approves/', + method=actions.FrontActionMethod.GET, + ) +) \ No newline at end of file diff --git a/api/v1/pages/mine/auth_manage.py b/api/v1/pages/mine/auth_manage.py index 6bdd4f3e0..0a4796a0b 100644 --- a/api/v1/pages/mine/auth_manage.py +++ b/api/v1/pages/mine/auth_manage.py @@ -1 +1,10 @@ -# 认证管理 \ No newline at end of file +from arkid.core.translation import gettext_default as _ +from arkid.core import routers + +tag = "mine_auth_manage" +name = _("认证管理") + +router = routers.FrontRouter( + path=tag, + name=name, +) \ No newline at end of file diff --git a/api/v1/pages/mine/grant_manage.py b/api/v1/pages/mine/grant_manage.py index 37c79e79d..67b965185 100644 --- a/api/v1/pages/mine/grant_manage.py +++ b/api/v1/pages/mine/grant_manage.py @@ -1 +1,51 @@ -# 授权管理 \ No newline at end of file +# 授权管理 +from select import select +from arkid.core.translation import gettext_default as _ +from arkid.core import pages,routers,actions + +tag = "mine_grant_manage" +name = _("授权管理") + + +page = pages.TablePage( + name=name, + tag=tag +) +permission_page = pages.TablePage( + name=_("申请权限"), + select=True, +) + + +pages.register_front_pages(page) +pages.register_front_pages(permission_page) + +router = routers.FrontRouter( + path=tag, + name=name, + icon='app', + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/mine/tenant/{tenant_id}/permissions/', + method=actions.FrontActionMethod.GET, + ), + global_actions=actions.OpenAction( + name=_("申请权限"), + page=permission_page + ) +) + +permission_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/mine/tenant/{tenant_id}/all_permissions/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/mine/tenant/{tenant_id}/permissions/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) \ No newline at end of file diff --git a/api/v1/pages/mine/logout.py b/api/v1/pages/mine/logout.py index 9bff41f9e..cc9bc9b3b 100644 --- a/api/v1/pages/mine/logout.py +++ b/api/v1/pages/mine/logout.py @@ -1 +1,11 @@ -# 退出登录 \ No newline at end of file +from arkid.core.translation import gettext_default as _ +from arkid.core import routers + +tag = "mine_logout" +name = _("退出登录") + +router = routers.FrontRouter( + path=tag, + name=name, + url='/mine/logout/' +) \ No newline at end of file diff --git a/api/v1/pages/mine/profile.py b/api/v1/pages/mine/profile.py new file mode 100644 index 000000000..ad7579814 --- /dev/null +++ b/api/v1/pages/mine/profile.py @@ -0,0 +1,29 @@ +from arkid.core.translation import gettext_default as _ +from arkid.core import actions, pages, routers + +tag = "mine_profile" +name = _("个人资料") + +page = pages.FormPage( + tag=tag, + name=name +) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/mine/tenant/{tenant_id}/profile/', + method=actions.FrontActionMethod.GET + ), + global_actions = [ + actions.ConfirmAction(path="/mine/tenant/{tenant_id}/profile/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) \ No newline at end of file diff --git a/api/v1/pages/mine/switch_tenant.py b/api/v1/pages/mine/switch_tenant.py index d33f9593f..c292ba521 100644 --- a/api/v1/pages/mine/switch_tenant.py +++ b/api/v1/pages/mine/switch_tenant.py @@ -1 +1,30 @@ -# 切换租户 \ No newline at end of file +from arkid.core.translation import gettext_default as _ +from arkid.core import actions, pages, routers + +tag = "mine_switch_tenant" +name = _("切换租户") + +page = pages.CardsPage( + tag=tag, + name=name +) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/mine/tenants/', + method=actions.FrontActionMethod.GET + ), + node_actions=[ + actions.DirectAction( + path='/api/v1/mine/switch_tenant/{tenant_id}/', + method=actions.FrontActionMethod.GET + ) + ] +) \ No newline at end of file diff --git a/api/v1/pages/mine/user_profile.py b/api/v1/pages/mine/user_profile.py deleted file mode 100644 index f5ae84d95..000000000 --- a/api/v1/pages/mine/user_profile.py +++ /dev/null @@ -1 +0,0 @@ -# 个人资料 \ No newline at end of file diff --git a/api/v1/pages/permission_manage/__init__.py b/api/v1/pages/permission_manage/__init__.py index e69de29bb..0f53b8286 100644 --- a/api/v1/pages/permission_manage/__init__.py +++ b/api/v1/pages/permission_manage/__init__.py @@ -0,0 +1,14 @@ +from arkid.core import routers +from arkid.core.translation import gettext_default as _ +from . import grant_rules,permission_group,permission_list,grant_manage + +router = routers.FrontRouter( + path='permission_manage', + name=_('权限管理'), + children=[ + grant_manage.router, + grant_rules.router, + permission_group.router, + permission_list.router + ] +) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage.py b/api/v1/pages/permission_manage/grant_manage.py deleted file mode 100644 index 37c79e79d..000000000 --- a/api/v1/pages/permission_manage/grant_manage.py +++ /dev/null @@ -1 +0,0 @@ -# 授权管理 \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/__init__.py b/api/v1/pages/permission_manage/grant_manage/__init__.py new file mode 100644 index 000000000..e51273390 --- /dev/null +++ b/api/v1/pages/permission_manage/grant_manage/__init__.py @@ -0,0 +1,9 @@ +from arkid.core import routers +from arkid.core.translation import gettext_default as _ + +router = routers.FrontRouter( + path='grant_manage', + name=_('授权管理'), + children=[ + ] +) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/app_grant.py b/api/v1/pages/permission_manage/grant_manage/app_grant.py new file mode 100644 index 000000000..e69de29bb diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py new file mode 100644 index 000000000..e69de29bb diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py new file mode 100644 index 000000000..e69de29bb diff --git a/api/v1/pages/permission_manage/grant_rules.py b/api/v1/pages/permission_manage/grant_rules.py index 6c3d6e129..8ccee163e 100644 --- a/api/v1/pages/permission_manage/grant_rules.py +++ b/api/v1/pages/permission_manage/grant_rules.py @@ -1 +1,66 @@ -# 授权规则 \ No newline at end of file +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'grant_rule' +name = '授权规则' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑授权规则")) +create_page = pages.FormPage(name=_("创建一个新的授权规则")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_rules/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/permission_rules/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_rules/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_rules/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_rules/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_rules/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index c1859475b..6e7363a20 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -1 +1,118 @@ -# 权限分组 \ No newline at end of file +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'permission_group' +name = '权限分组' + + +page = pages.TreePage(tag=tag,name=name) +group_permissions_page = pages.TablePage(name=_("组内权限")) +edit_permissions_page = pages.TablePage(name=_("更新组内权限")) +create_page = pages.FormPage(name=_("创建权限分组")) +edit_page = pages.FormPage(name=_("编辑权限分组")) + + +pages.register_front_pages(page) +pages.register_front_pages(group_permissions_page) +pages.register_front_pages(edit_permissions_page) +pages.register_front_pages(create_page) +pages.register_front_pages(edit_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/', + method=actions.FrontActionMethod.GET, + next_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=group_permissions_page + ) + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/permission_groups/{id}/", + ) + ], + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=group_permissions_page + ) + ] +) + +group_permissions_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.OpenAction( + name=_("添加权限"), + page=edit_permissions_page, + ) + ], + local_actions=[ + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/{id}/", + icon="icon-delete", + ) + ], +) + + +edit_permissions_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/select_permissions/', + method=actions.FrontActionMethod.GET, + ), + select=True, + global_actions=[ + actions.ConfirmAction( + path="/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/" + ), + actions.CancelAction() + ] +) + + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_groups/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permission_groups/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_groups/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/permission_manage/permission_list.py b/api/v1/pages/permission_manage/permission_list.py index 587ae1a18..4e91fedf8 100644 --- a/api/v1/pages/permission_manage/permission_list.py +++ b/api/v1/pages/permission_manage/permission_list.py @@ -1 +1,66 @@ -# 权限列表 \ No newline at end of file +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'permission_list' +name = '权限列表' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑权限")) +create_page = pages.FormPage(name=_("创建一个新的权限")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permissions/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/permissions/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permissions/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permissions/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/permissions/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permissions/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/tenant_manage/extension_manage.py b/api/v1/pages/tenant_manage/extension_manage.py index e69de29bb..b9b66d06b 100644 --- a/api/v1/pages/tenant_manage/extension_manage.py +++ b/api/v1/pages/tenant_manage/extension_manage.py @@ -0,0 +1 @@ +# 租户下的 extension的settings config \ No newline at end of file diff --git a/api/v1/views/approve_action.py b/api/v1/views/approve_action.py index 571fe5af1..ea0819870 100644 --- a/api/v1/views/approve_action.py +++ b/api/v1/views/approve_action.py @@ -8,7 +8,7 @@ def get_approve_actions(request, tenant_id: str): """ return [] -@api.get("/tenant/{tenant_id}/approve_actions/{id}/", tags=[_("审批动作")]) +@api.get(operation_id="",path="/tenant/{tenant_id}/approve_actions/{id}/", tags=[_("审批动作")]) def get_approve_action(request, tenant_id: str, id: str): """ 获取审批动作,TODO """ diff --git a/api/v1/views/log.py b/api/v1/views/log.py new file mode 100644 index 000000000..6c09c5fa3 --- /dev/null +++ b/api/v1/views/log.py @@ -0,0 +1,33 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/manager_log/", tags=[_("日志管理")]) +def get_manager_logs(request, tenant_id: str): + """ 获取租户管理员行为日志,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/user_log/", tags=[_("日志管理")]) +def get_user_logs(request, tenant_id: str): + """ 获取用户行为日志,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/log/{id}/", tags=[_("日志管理")]) +def get_log(request, tenant_id: str,id:str): + """ 获取日志详情,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/log_config/", tags=[_("日志管理")]) +def get_log_config(request, tenant_id: str): + """ 获取日志配置,TODO + """ + return [] + +@api.post("/tenant/{tenant_id}/log_config/", tags=[_("日志管理")]) +def update_log_config(request, tenant_id: str): + """ 更新日志配置,TODO + """ + return [] diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index 97074d278..e69f69960 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -1,39 +1,69 @@ +from django.shortcuts import render from arkid.core.api import api from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/mine/apps/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/apps/",tags=[_("我的")]) def get_mine_apps(request, tenant_id: str): """ 我的应用列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/mine/profile/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/profile/",tags=[_("我的")]) def get_mine_profile(request, tenant_id: str): """ 我的个人资料,TODO """ return {} -@api.get("/tenant/{tenant_id}/mine/permissions/",tags=[_("我的")]) +@api.post("/mine/tenant/{tenant_id}/profile/",tags=[_("我的")]) +def update_mine_profile(request, tenant_id: str): + """ 更新我的个人资料,TODO + """ + return {} + +@api.get("/mine/tenant/{tenant_id}/permissions/",tags=[_("我的")]) def get_mine_permissions(request, tenant_id: str): """ 我的权限列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/mine/approves/",tags=[_("我的")]) +@api.post("/mine/tenant/{tenant_id}/permissions/",tags=[_("我的")]) +def update_mine_permissions(request, tenant_id: str): + """ 更新我的权限列表,TODO + """ + return [] + +@api.get("/mine/tenant/{tenant_id}/all_permissions/",tags=[_("我的")]) +def get_mine_all_permissions(request, tenant_id: str): + """ 获取所有权限并附带是否已授权给我的状态,TODO + """ + return [] + +@api.get("/mine/tenant/{tenant_id}/approves/",tags=[_("我的")]) def get_mine_approves(request, tenant_id: str): """ 我的审批列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/mine/switch_tenant/",tags=[_("我的")]) -def get_mine_switch_tenant(request, tenant_id: str): +@api.get("/mine/switch_tenant/{tenant_id}/",tags=[_("我的")]) +def get_mine_switch_tenant(request,tenant_id): """ 租户开关,TODO """ - return {} + context = {} + slug = "" + context['tenant_id'] = tenant_id + context['slug'] = slug + + return render(request,template_name='switch_tenant.html', context=context) -@api.get("/tenant/{tenant_id}/mine/logout/",tags=[_("我的")]) -def get_mine_logout(request, tenant_id: str): +@api.get("/mine/logout/",tags=[_("我的")]) +def get_mine_logout(request): """ 退出登录,TODO """ + return {} + +@api.get("/mine/tenants/",tags=[_("我的")]) +def get_mine_tenants(request): + """ 获取我的租户,TODO + """ return {} \ No newline at end of file diff --git a/api/v1/views/permission.py b/api/v1/views/permission.py new file mode 100644 index 000000000..22b435205 --- /dev/null +++ b/api/v1/views/permission.py @@ -0,0 +1,35 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/permissions/", tags=[_("权限")]) +def get_permissions(request, tenant_id: str): + """ 权限列表,TODO + """ + return [] + +@api.get(operation_id="",path="/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +def get_permission(request, tenant_id: str, id: str): + """ 获取权限,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/permissions/", tags=[_("权限")]) +def create_permission(request, tenant_id: str): + """ 创建权限,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +def update_permission(request, tenant_id: str, id: str): + """ 编辑权限,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +def delete_permission(request, tenant_id: str, id: str): + """ 删除权限,TODO + """ + return {} + + diff --git a/api/v1/views/permission_group.py b/api/v1/views/permission_group.py new file mode 100644 index 000000000..07d644f63 --- /dev/null +++ b/api/v1/views/permission_group.py @@ -0,0 +1,59 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/permission_groups/", tags=[_("权限分组")]) +def get_permission_groups(request, tenant_id: str): + """ 权限分组列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +def get_permission_group(request, tenant_id: str, id: str): + """ 获取权限分组,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/permission_groups/", tags=[_("权限分组")]) +def create_permission_group(request, tenant_id: str): + """ 创建权限分组,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +def update_permission_group(request, tenant_id: str, id: str): + """ 编辑权限分组,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +def delete_permission_group(request, tenant_id: str, id: str): + """ 删除权限分组,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) +def get_permissions_from_group(request, tenant_id: str, group_id: str): + """ 获取当前分组的权限列表,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/{id}/", tags=[_("权限分组")]) +def remove_permission_from_group(request, tenant_id: str, permission_group_id: str,id:str): + """ 将权限移除出权限分组,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) +def update_permissions_from_group(request, tenant_id: str, group_id: str): + """ 更新当前分组的权限列表,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/select_permissions/", tags=[_("权限分组")]) +def get_select_permissions(request, tenant_id: str, group_id: str): + """ 获取所有权限并附加是否在当前分组的状态,TODO + """ + return {} + + diff --git a/api/v1/views/permission_rule.py b/api/v1/views/permission_rule.py new file mode 100644 index 000000000..08ba0c850 --- /dev/null +++ b/api/v1/views/permission_rule.py @@ -0,0 +1,35 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/permission_rules/", tags=[_("授权规则")]) +def get_permission_rules(request, tenant_id: str): + """ 授权规则列表,TODO + """ + return [] + +@api.get(operation_id="",path="/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +def get_permission_rule(request, tenant_id: str, id: str): + """ 获取授权规则,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/permission_rules/", tags=[_("授权规则")]) +def create_permission_rule(request, tenant_id: str): + """ 创建授权规则,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +def update_permission_rule(request, tenant_id: str, id: str): + """ 编辑授权规则,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +def delete_permission_rule(request, tenant_id: str, id: str): + """ 删除授权规则,TODO + """ + return {} + + diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py new file mode 100644 index 000000000..f3e97b6e7 --- /dev/null +++ b/api/v1/views/tenant.py @@ -0,0 +1,9 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenants/", tags=[_("租户管理")]) +def get_tenant_list(request): + """ 获取租户管理员行为日志,TODO + """ + return [] \ No newline at end of file diff --git a/arkid/core/actions.py b/arkid/core/actions.py index 3e7601186..187c6521b 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -187,4 +187,36 @@ class EditAction(OpenAction): def __init__(self, page, *args, **kwargs): self.name=_("编辑"), self.icon="icon-edit", - super().__init__(page=page, *args, **kwargs) \ No newline at end of file + super().__init__(page=page, *args, **kwargs) + +nav_actions = {} +def register_nav_actions(actions): + """注册前端页面 + + Args: + pages (List|FrontPage): 前端页面 + """ + if not isinstance(actions, tuple) or not isinstance(actions, list): + actions = [actions] + + for action in actions: + nav_actions[action.tag] = action + + +def unregister_nav_actions(actions): + """卸载页面 + + Args: + pages (List|FrontPage): 前端页面 + """ + if not isinstance(actions, tuple) or not isinstance(actions, list): + actions = [actions] + + for action in actions: + nav_actions.pop(action.tag) + + +def get_nav_actions(): + """获取页面列表 + """ + return [item.dict() for item in list(nav_actions.values())] \ No newline at end of file diff --git a/arkid/core/openapi.py b/arkid/core/openapi.py index cab256091..81d12a2f0 100644 --- a/arkid/core/openapi.py +++ b/arkid/core/openapi.py @@ -1,7 +1,7 @@ from typing import Optional from ninja.openapi.schema import OpenAPISchema from ninja.openapi import get_schema -from arkid.core import routers, pages, translation +from arkid.core import routers, pages, translation, actions def get_openapi_schema(self, path_prefix: Optional[str] = None) -> OpenAPISchema: @@ -10,6 +10,7 @@ def get_openapi_schema(self, path_prefix: Optional[str] = None) -> OpenAPISchema schema = get_schema(api=self, path_prefix=path_prefix) schema["routers"] = routers.get_global_routers() schema["pages"] = pages.get_global_pages() + schema["navs"] = actions.get_nav_actions() # permissions = get_permissions(self) # schema["permissions"] = permissions diff --git a/arkid/core/pages.py b/arkid/core/pages.py index 47f21afb8..1245e25a8 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -29,13 +29,6 @@ class FrontPageType(Enum): CARDS_PAGE = 'cards' GRID_PAGE = 'grid' - -global_tags = [] # 全局tag列表 - - - - - class FrontPage(DeepSN): """ 前端页面配置类 @@ -94,10 +87,11 @@ def __init__(self, name: str, tag: str = None, tag_pre: str = None, *args, **kwa self.name = name super().__init__(*args, **kwargs) - def create_actions(self, init_action:FrontAction = None, global_actions: list = None, local_actions: list = None): + def create_actions(self, init_action:FrontAction = None, global_actions: list = None, local_actions: list = None, node_actions:list=None): self.init_action = init_action self.add_global_actions(global_actions) - self.add_local_action(local_actions) + self.add_local_actions(local_actions) + self.add_node_actions(node_actions) def add_global_actions(self, actions): """ 添加全局动作 @@ -111,7 +105,19 @@ def add_global_actions(self, actions): self.global_action = [] self.global_action.extend(actions) - def add_local_action(self, actions): + def add_local_actions(self, actions): + """ 添加表单动作 + + Args: + actions (FrontAction|OrderedDict)): 动作列表 + """ + if not isinstance(actions, tuple) or not isinstance(actions, list): + actions = list(actions) + if not hasattr(self, "local_action"): + self.local_action = [] + self.local_action.extend(actions) + + def add_node_actions(self, actions): """ 添加表单动作 Args: @@ -143,7 +149,7 @@ def __init__(self, select: bool = False, *args, **kwargs): self.select = select super().__init__(*args, **kwargs) - def create_actions(self, select:bool=False,*args, **kwargs): + def create_actions(self, select:bool=True,*args, **kwargs): self.select = select return super().create_actions(*args, **kwargs) @@ -167,22 +173,8 @@ def __init__(self, *args, **kwargs): class TreePage(SelectPage): """树形页面 """ - - def create_actions(self, init_action: FrontAction = None, global_actions: list = None, local_actions: list = None, node_actions:list = None): - self.add_node_action(node_actions) - return super().create_actions(init_action, global_actions, local_actions) - - def add_node_action(self, actions): - """ 添加表单动作 - - Args: - actions (FrontAction|OrderedDict)): 动作列表 - """ - if not isinstance(actions, tuple) or not isinstance(actions, list): - actions = list(actions) - if not hasattr(self, "local_action"): - self.local_action = [] - self.local_action.extend(actions) + def __init__(self, *args, **kwargs): + super().__init__(type=FrontPageType.TREE_PAGE, *args, **kwargs) class DescriptionPage(FrontPage): @@ -216,6 +208,13 @@ class GridPage(FrontPage): def __init__(self, *args, **kwargs): super().__init__(type=FrontPageType.GRID_PAGE, *args, **kwargs) +class TabsPage(FrontPage): + """网格页面 + """ + + def __init__(self, *args, **kwargs): + super().__init__(type=FrontPageType.TABS_PAGE, *args, **kwargs) + def register_front_pages(pages): """注册前端页面 From 3d4b04f1fe1ddf5892a71404a53762582b52e21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 09:10:35 +0000 Subject: [PATCH 05/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=9D=83=E9=99=90?= =?UTF-8?q?=E9=83=A8=E5=88=86=E8=80=8C=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_protocol.py | 3 ++- .../permission_manage/grant_manage/__init__.py | 14 +++++++++++--- api/v1/pages/user_manage/user_list.py | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/api/v1/pages/app_manage/app_protocol.py b/api/v1/pages/app_manage/app_protocol.py index d8f813690..99efed669 100644 --- a/api/v1/pages/app_manage/app_protocol.py +++ b/api/v1/pages/app_manage/app_protocol.py @@ -16,4 +16,5 @@ name=name, icon='app', page=page, -) \ No newline at end of file +) + diff --git a/api/v1/pages/permission_manage/grant_manage/__init__.py b/api/v1/pages/permission_manage/grant_manage/__init__.py index e51273390..3a1faf908 100644 --- a/api/v1/pages/permission_manage/grant_manage/__init__.py +++ b/api/v1/pages/permission_manage/grant_manage/__init__.py @@ -1,9 +1,17 @@ -from arkid.core import routers +from arkid.core import routers,pages from arkid.core.translation import gettext_default as _ +tag = "grant_manage" +name = _("授权管理") + +page = pages.TabsPage( + tag=tag, + name=name +) + +pages.register_front_pages(page) + router = routers.FrontRouter( path='grant_manage', name=_('授权管理'), - children=[ - ] ) \ No newline at end of file diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index f370a9080..a4320b2f3 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -52,7 +52,7 @@ ] ) -page.add_local_action( +page.add_local_actions( [ pages.FrontAction( name=_("编辑"), From ff74ccb6db7dd0ff04b3af31ed938aa0e25a676c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 10:17:35 +0000 Subject: [PATCH 06/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/mine/grant_manage.py | 10 ++- api/v1/pages/user_manage/user_list.py | 125 ++++++++++---------------- api/v1/views/app_group.py | 6 +- arkid/common/__init__.py | 1 - arkid/core/actions.py | 40 +++++---- arkid/core/openapi.py | 2 +- arkid/core/pages.py | 20 +++-- 7 files changed, 97 insertions(+), 107 deletions(-) diff --git a/api/v1/pages/mine/grant_manage.py b/api/v1/pages/mine/grant_manage.py index 67b965185..5d96ded5c 100644 --- a/api/v1/pages/mine/grant_manage.py +++ b/api/v1/pages/mine/grant_manage.py @@ -32,10 +32,12 @@ path='/api/v1/mine/tenant/{tenant_id}/permissions/', method=actions.FrontActionMethod.GET, ), - global_actions=actions.OpenAction( - name=_("申请权限"), - page=permission_page - ) + global_actions=[ + actions.OpenAction( + name=_("申请权限"), + page=permission_page + ) + ] ) permission_page.create_actions( diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index f370a9080..0ff231875 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -1,94 +1,67 @@ -from arkid.core import routers, pages +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -user_list_tag = 'user_list' -user_list_name = '用户列表' +tag = 'user_list' +name = '用户列表' -page = pages.TablePage( - tag=user_list_tag, - name=user_list_name, - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/users/', - method=pages.FrontActionMethod.GET - ) -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑用户")) +create_page = pages.FormPage(name=_("创建一个新的用户")) -user_edit_page = pages.FormPage( - name=_("编辑用户"), - init_action=pages.FrontAction( - path='/api/v1/tenant/{tenant_id}/users/{id}/', - method=pages.FrontActionMethod.GET - ) -) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -user_edit_page.add_global_actions( - [ - pages.ConfirmAction(path="/api/v1/tenant/{tenant_id}/users/{id}/"), - pages.CancelAction(), - pages.ResetAction(), - ] +router = routers.FrontRouter( + path=tag, + name=name, + icon='user', + page=page, ) -user_create_page = pages.FormPage( - name=_("创建一个新的用户"), - init_action=pages.FrontAction( +page.create_actions( + init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/users/', - method=pages.FrontActionMethod.POST - ) -) - -user_create_page.add_global_actions( - [ - pages.FrontAction( - method=pages.FrontActionMethod.POST, - name=_("确认"), - path="/api/v1/tenant/{tenant_id}/users/", - action_type=pages.FrontActionType.DIRECT_ACTION, - icon="icon-confirm" - ), - pages.CancelAction(), - pages.ResetAction(), - ] -) - -page.add_local_action( - [ - pages.FrontAction( - name=_("编辑"), - page=user_edit_page, - icon="icon-edit", - action_type=pages.FrontActionType.OPEN_ACTION + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, ), - pages.FrontAction( - name=_("删除"), - method=pages.FrontActionMethod.DELETE, + actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/users/{id}/", - icon="icon-delete", - action_type=pages.FrontActionType.DIRECT_ACTION ) - ] + ], ) -page.add_global_actions( - [ - pages.FrontAction( - name="创建", - page=user_create_page, - icon="icon-create", - action_type=pages.FrontActionType.OPEN_ACTION - ) +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/users/{id}/"), + actions.CancelAction(), + actions.ResetAction(), ] ) - -router = routers.FrontRouter( - path=user_list_tag, - name='用户管理', - icon='user', - page=page, +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/users/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] ) - -pages.register_front_pages(page) -pages.register_front_pages(user_create_page) -pages.register_front_pages(user_edit_page) \ No newline at end of file diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index 56054c7f3..5f7240e4e 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -33,7 +33,7 @@ def delete_app_group(request, tenant_id: str, id: str): return {} @api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) -def get_apps_from_group(request, tenant_id: str, group_id: str): +def get_apps_from_group(request, tenant_id: str, app_group_id: str): """ 获取当前分组的应用列表,TODO """ return {} @@ -45,13 +45,13 @@ def remove_app_from_group(request, tenant_id: str, app_group_id: str,id:str): return {} @api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) -def update_apps_from_group(request, tenant_id: str, group_id: str): +def update_apps_from_group(request, tenant_id: str, app_group_id: str): """ 更新当前分组的应用列表,TODO """ return {} @api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/", tags=[_("应用分组")]) -def get_select_apps(request, tenant_id: str, group_id: str): +def get_select_apps(request, tenant_id: str, app_group_id: str): """ 获取所有应用并附加是否在当前分组的状态,TODO """ return {} diff --git a/arkid/common/__init__.py b/arkid/common/__init__.py index 33c15c258..b8a6b42c5 100644 --- a/arkid/common/__init__.py +++ b/arkid/common/__init__.py @@ -5,7 +5,6 @@ class DeepSN(SimpleNamespace): def dict(self): _data = {} for key,val in self.__dict__.items(): - if isinstance(val,DeepSN): _data[key] = val.dict() elif isinstance(val,list): diff --git a/arkid/core/actions.py b/arkid/core/actions.py index 187c6521b..5385dff27 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -4,6 +4,7 @@ from arkid.common.utils import gen_tag from arkid.core.translation import gettext_default as _ + class FrontActionType(Enum): """前端动作类型枚举类 @@ -71,8 +72,8 @@ class FrontAction(DeepSN): """ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = None, method: FrontActionMethod = None, - name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, next_action = None, - result_page = None, result_page_tag = None, *args, **kwargs): + name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, next_action=None, + result_page=None, result_page_tag=None, *args, **kwargs): """初始化函数 Args: @@ -86,7 +87,7 @@ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = No tag_pre (str, optional): 标识前缀. """ self.type = action_type.value - + self.tag = gen_tag(tag, tag_pre) if name: @@ -99,17 +100,17 @@ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = No if path: self.path = path if method: - self.method = method + self.method = method.value if icon: self.icon = icon - + if next_action: self.next_action = next_action if result_page: self.result_page = result_page.tag if result_page_tag: self.result_page = result_page_tag - + super().__init__(*args, **kwargs) def add_tag_pre(self, tag_pre: str): @@ -164,32 +165,37 @@ class ConfirmAction(DirectAction): def __init__(self, path: str, *args, **kwargs): self.name = _("确认") self.path = path - self.icon="icon-confirm" - self.method=FrontActionMethod.POST.value + self.icon = "icon-confirm" + self.method = FrontActionMethod.POST.value super().__init__(*args, **kwargs) class DeleteAction(DirectAction): def __init__(self, path: str, *args, **kwargs): - self.name = _("删除"), + self.name = _("删除") self.method = FrontActionMethod.DELETE.value, - self.icon="icon-delete", + self.icon = "icon-delete" self.path = path super().__init__(*args, **kwargs) -class CreateAction(OpenAction): + +class CreateAction(OpenAction): def __init__(self, page, *args, **kwargs): - self.name=_("创建"), - self.icon="icon-create", + self.name = _("创建") + self.icon = "icon-create" super().__init__(page=page, *args, **kwargs) -class EditAction(OpenAction): + +class EditAction(OpenAction): def __init__(self, page, *args, **kwargs): - self.name=_("编辑"), - self.icon="icon-edit", + self.name = _("编辑") + self.icon = "icon-edit" super().__init__(page=page, *args, **kwargs) + nav_actions = {} + + def register_nav_actions(actions): """注册前端页面 @@ -219,4 +225,4 @@ def unregister_nav_actions(actions): def get_nav_actions(): """获取页面列表 """ - return [item.dict() for item in list(nav_actions.values())] \ No newline at end of file + return [item.dict() for item in list(nav_actions.values())] diff --git a/arkid/core/openapi.py b/arkid/core/openapi.py index 81d12a2f0..822fff269 100644 --- a/arkid/core/openapi.py +++ b/arkid/core/openapi.py @@ -10,7 +10,7 @@ def get_openapi_schema(self, path_prefix: Optional[str] = None) -> OpenAPISchema schema = get_schema(api=self, path_prefix=path_prefix) schema["routers"] = routers.get_global_routers() schema["pages"] = pages.get_global_pages() - schema["navs"] = actions.get_nav_actions() + # schema["navs"] = actions.get_nav_actions() # permissions = get_permissions(self) # schema["permissions"] = permissions diff --git a/arkid/core/pages.py b/arkid/core/pages.py index 1245e25a8..f5eaa30cc 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -71,7 +71,7 @@ class FrontPage(DeepSN): >>> ) """ - def __init__(self, name: str, tag: str = None, tag_pre: str = None, *args, **kwargs): + def __init__(self, name: str, tag: str = None, tag_pre: str = None, type:FrontPageType=FrontPageType.TABLE_PAGE,*args, **kwargs): """初始化函数 Args: @@ -85,9 +85,10 @@ def __init__(self, name: str, tag: str = None, tag_pre: str = None, *args, **kwa """ self.tag = gen_tag(tag, tag_pre) self.name = name + self.type = type.value super().__init__(*args, **kwargs) - def create_actions(self, init_action:FrontAction = None, global_actions: list = None, local_actions: list = None, node_actions:list=None): + def create_actions(self, init_action:FrontAction = None, global_actions: list = [], local_actions: list = [], node_actions:list=[]): self.init_action = init_action self.add_global_actions(global_actions) self.add_local_actions(local_actions) @@ -99,6 +100,9 @@ def add_global_actions(self, actions): Args: actions (FrontAction|OrderedDict)): 动作列表 """ + if not actions: + return + if not isinstance(actions, tuple) or not isinstance(actions, list): actions = list(actions) if not hasattr(self, "global_action"): @@ -111,6 +115,9 @@ def add_local_actions(self, actions): Args: actions (FrontAction|OrderedDict)): 动作列表 """ + if not actions: + return + if not isinstance(actions, tuple) or not isinstance(actions, list): actions = list(actions) if not hasattr(self, "local_action"): @@ -123,11 +130,14 @@ def add_node_actions(self, actions): Args: actions (FrontAction|OrderedDict)): 动作列表 """ + if not actions: + return + if not isinstance(actions, tuple) or not isinstance(actions, list): actions = list(actions) - if not hasattr(self, "local_action"): - self.local_action = [] - self.local_action.extend(actions) + if not hasattr(self, "node_action"): + self.node_action = [] + self.node_action.extend(actions) def add_tag_pre(self, tag_pre: str): """添加标识前缀 From 8d5aa03eeca734b86adba166d12ce266e270de8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Mon, 25 Apr 2022 13:06:16 +0000 Subject: [PATCH 07/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=9D=83=E9=99=90?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/__init__.py | 8 +- api/v1/pages/app_manage/app_protocol.py | 21 +++--- api/v1/pages/charts_manage/bi_systems.py | 73 +++++++++++++++---- api/v1/pages/log_manage/manager_log.py | 3 +- api/v1/pages/log_manage/user_log.py | 3 +- .../grant_manage/__init__.py | 10 ++- .../grant_manage/app_grant.py | 38 ++++++++++ .../grant_manage/group_grant.py | 64 ++++++++++++++++ .../grant_manage/user_grant.py | 64 ++++++++++++++++ api/v1/views/app.py | 6 ++ api/v1/views/app_protocol.py | 9 +++ api/v1/views/bi_system.py | 35 +++++++++ api/v1/views/user.py | 27 ++++++- api/v1/views/user_group.py | 26 +++++++ arkid/core/pages.py | 14 +++- 15 files changed, 371 insertions(+), 30 deletions(-) create mode 100644 api/v1/views/app_protocol.py create mode 100644 api/v1/views/bi_system.py create mode 100644 api/v1/views/user_group.py diff --git a/api/v1/pages/__init__.py b/api/v1/pages/__init__.py index 596e298f6..2aec33a7b 100644 --- a/api/v1/pages/__init__.py +++ b/api/v1/pages/__init__.py @@ -7,6 +7,9 @@ charts_manage, data_source_manage, developer_manage, + log_manage, + mine, + permission_manage, ) from arkid.core import routers @@ -20,6 +23,9 @@ auth_manage.router, charts_manage.router, data_source_manage.router, - developer_manage.router + developer_manage.router, + log_manage.router, + mine.router, + permission_manage.router ] ) diff --git a/api/v1/pages/app_manage/app_protocol.py b/api/v1/pages/app_manage/app_protocol.py index 99efed669..fb2e2a744 100644 --- a/api/v1/pages/app_manage/app_protocol.py +++ b/api/v1/pages/app_manage/app_protocol.py @@ -1,20 +1,23 @@ -# 应用协议 -from arkid.core.routers import FrontRouter +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -from arkid.core.pages import FormPage,register_front_pages -tag = "app_protocol" -name = _("应用协议") +tag = 'app_protocol' +name = '应用协议' -page = FormPage(name=name,tag=tag) +page = pages.TablePage(tag=tag, name=name) -register_front_pages(page) +pages.register_front_pages(page) -router = FrontRouter( +router = routers.FrontRouter( path=tag, name=name, - icon='app', page=page, ) +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/app_protocols/', + method=actions.FrontActionMethod.GET, + ), +) \ No newline at end of file diff --git a/api/v1/pages/charts_manage/bi_systems.py b/api/v1/pages/charts_manage/bi_systems.py index e7cac61b9..fbabda614 100644 --- a/api/v1/pages/charts_manage/bi_systems.py +++ b/api/v1/pages/charts_manage/bi_systems.py @@ -1,21 +1,66 @@ -# BI系统 -from arkid.core.routers import FrontRouter +from arkid.core import routers, pages, actions from arkid.core.translation import gettext_default as _ -from arkid.core.pages import FormPage,register_front_pages -bi_systems_tag = "bi_systems" -bi_systems_name = _("BI系统") +tag = 'bi_system' +name = 'BI系统' -page = FormPage( - name=bi_systems_name, - tag=bi_systems_tag, -) +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑BI系统")) +create_page = pages.FormPage(name=_("创建一个新的BI系统")) -register_front_pages(page) +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) -router = FrontRouter( - path=bi_systems_tag, - name=bi_systems_name, +router = routers.FrontRouter( + path=tag, + name=name, page=page, -) \ No newline at end of file +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/bi_systems/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/bi_systems/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/bi_systems/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/bi_systems/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/bi_systems/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/bi_systems/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/log_manage/manager_log.py b/api/v1/pages/log_manage/manager_log.py index afa75969e..5d694e33f 100644 --- a/api/v1/pages/log_manage/manager_log.py +++ b/api/v1/pages/log_manage/manager_log.py @@ -1,10 +1,11 @@ +from arkid.core.translation import gettext_default as _ from arkid.core import routers, pages, actions tag = 'manager_log' name = '管理员行为日志' page = pages.TablePage(tag = tag, name = name) -detail_page = pages.DescriptionPage() +detail_page = pages.DescriptionPage(name=_("日志详情")) pages.register_front_pages(page) pages.register_front_pages(detail_page) diff --git a/api/v1/pages/log_manage/user_log.py b/api/v1/pages/log_manage/user_log.py index a02e4a8aa..4822d784d 100644 --- a/api/v1/pages/log_manage/user_log.py +++ b/api/v1/pages/log_manage/user_log.py @@ -1,10 +1,11 @@ +from arkid.core.translation import gettext_default as _ from arkid.core import routers, pages, actions tag = 'user_log' name = '用户行为日志' page = pages.TablePage(tag = tag, name = name) -detail_page = pages.DescriptionPage() +detail_page = pages.DescriptionPage(name=_("日志详情")) pages.register_front_pages(page) pages.register_front_pages(detail_page) diff --git a/api/v1/pages/permission_manage/grant_manage/__init__.py b/api/v1/pages/permission_manage/grant_manage/__init__.py index 3a1faf908..897ad9958 100644 --- a/api/v1/pages/permission_manage/grant_manage/__init__.py +++ b/api/v1/pages/permission_manage/grant_manage/__init__.py @@ -1,12 +1,17 @@ from arkid.core import routers,pages from arkid.core.translation import gettext_default as _ - +from . import user_grant,group_grant,app_grant tag = "grant_manage" name = _("授权管理") page = pages.TabsPage( tag=tag, - name=name + name=name, + pages=[ + user_grant.page, + group_grant.page, + app_grant.page + ] ) pages.register_front_pages(page) @@ -14,4 +19,5 @@ router = routers.FrontRouter( path='grant_manage', name=_('授权管理'), + page=page ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/app_grant.py b/api/v1/pages/permission_manage/grant_manage/app_grant.py index e69de29bb..ee75fe30b 100644 --- a/api/v1/pages/permission_manage/grant_manage/app_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/app_grant.py @@ -0,0 +1,38 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'app_grant' +name = '所有应用' + + +page = pages.ListPage(tag=tag,name=name) +app_permission_page = pages.TablePage(name=_("该应用权限")) + +pages.register_front_pages(page) +pages.register_front_pages(app_permission_page) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/', + method=actions.FrontActionMethod.GET, + next_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/{app_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=app_permission_page + ) + ), + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/{app_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=app_permission_page + ) + ] +) + +app_permission_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/apps/{app_id}/permissions/', + method=actions.FrontActionMethod.GET + ) +) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py index e69de29bb..667dc1802 100644 --- a/api/v1/pages/permission_manage/grant_manage/group_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/group_grant.py @@ -0,0 +1,64 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'group_grant' +name = '所有分组' + + +page = pages.ListPage(tag=tag,name=name) +group_permission_page = pages.TablePage(name=_("该分组权限")) +update_group_permission_page = pages.TablePage(name=_("更新用户分组权限"),select=True) + +pages.register_front_pages(page) +pages.register_front_pages(group_permission_page) +pages.register_front_pages(update_group_permission_page) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/', + method=actions.FrontActionMethod.GET, + next_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=group_permission_page + ) + ), + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=group_permission_page + ) + ], +) + +group_permission_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', + method=actions.FrontActionMethod.GET + ), + local_actions=[ + actions.DeleteAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/{id}/' + ) + ], + global_actions=[ + actions.OpenAction( + name=_("添加用户分组权限"), + page=update_group_permission_page + ) + ] +) + +update_group_permission_page.create_actions( + init_action=actions.DeleteAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/all_permissions/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', + ), + actions.CancelAction(), + ] +) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py index e69de29bb..c995b1746 100644 --- a/api/v1/pages/permission_manage/grant_manage/user_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/user_grant.py @@ -0,0 +1,64 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'user_grant' +name = '所有分组' + + +page = pages.ListPage(tag=tag,name=name) +user_permission_page = pages.TablePage(name=_("该分组权限")) +update_user_permission_page = pages.TablePage(name=_("更新用户分组权限"),select=True) + +pages.register_front_pages(page) +pages.register_front_pages(user_permission_page) +pages.register_front_pages(update_user_permission_page) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/', + method=actions.FrontActionMethod.GET, + next_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=user_permission_page + ) + ), + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', + method=actions.FrontActionMethod.GET, + result_page=user_permission_page + ) + ], +) + +user_permission_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', + method=actions.FrontActionMethod.GET + ), + local_actions=[ + actions.DeleteAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/{id}/' + ) + ], + global_actions=[ + actions.OpenAction( + name=_("添加用户分组权限"), + page=update_user_permission_page + ) + ] +) + +update_user_permission_page.create_actions( + init_action=actions.DeleteAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/all_permissions/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction( + path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', + ), + actions.CancelAction(), + ] +) \ No newline at end of file diff --git a/api/v1/views/app.py b/api/v1/views/app.py index c9504b411..aca5549dc 100644 --- a/api/v1/views/app.py +++ b/api/v1/views/app.py @@ -148,3 +148,9 @@ def update_app(request, tenant_id: str, app_id: str, data: AppConfigSchemaIn): extension.update_tenant_config(app.config.id, data.config.dict()) break return {'error': ErrorCode.OK.value} + +@api.get("/tenant/{tenant_id}/apps/{app_id}/permissions/",tags=[_("应用")]) +def get_app_permissions(request, tenant_id: str,app_id:str): + """ 应用权限列表,TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/app_protocol.py b/api/v1/views/app_protocol.py new file mode 100644 index 000000000..c7d8a4568 --- /dev/null +++ b/api/v1/views/app_protocol.py @@ -0,0 +1,9 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/app_protocols/", tags=[_("应用协议")]) +def get_app_protocols(request, tenant_id: str): + """ 应用协议列表,TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/bi_system.py b/api/v1/views/bi_system.py new file mode 100644 index 000000000..833365832 --- /dev/null +++ b/api/v1/views/bi_system.py @@ -0,0 +1,35 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/bi_systems/", tags=[_("BI系统")]) +def get_bi_systems(request, tenant_id: str): + """ BI系统列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +def get_bi_system(request, tenant_id: str, id: str): + """ 获取BI系统,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/bi_systems/", tags=[_("BI系统")]) +def create_bi_system(request, tenant_id: str): + """ 创建BI系统,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +def update_bi_system(request, tenant_id: str, id: str): + """ 编辑BI系统,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +def delete_bi_system(request, tenant_id: str, id: str): + """ 删除BI系统,TODO + """ + return {} + + diff --git a/api/v1/views/user.py b/api/v1/views/user.py index 0d1f9b780..c76c6e4b1 100644 --- a/api/v1/views/user.py +++ b/api/v1/views/user.py @@ -149,4 +149,29 @@ class Config: @operation(UserOutSchema) def user_list(request, tenant_id: str,id:str,data: UserInSchema=Query(...)): user = User.expand_objects.get(tenant__id=tenant_id,id=id) - return user \ No newline at end of file + return user + + +@api.get("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=[_("用户")]) +def get_user_permissions(request, tenant_id: str,user_id:str): + """ 用户权限列表,TODO + """ + return [] + +@api.post("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=[_("用户")]) +def update_user_permissions(request, tenant_id: str,user_id:str): + """ 更新用户权限列表,TODO + """ + return [] + +@api.delete("/tenant/{tenant_id}/users/{user_id}/permissions/{id}/",tags=[_("用户")]) +def delete_user_permissions(request, tenant_id: str,user_id:str,id:str): + """ 删除用户权限,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/users/{user_id}/all_permissions/",tags=[_("用户")]) +def get_user_all_permissions(request, tenant_id: str,user_id:str): + """ 获取所有权限并附带是否已授权给用户状态,TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/user_group.py b/api/v1/views/user_group.py new file mode 100644 index 000000000..6597bb6cc --- /dev/null +++ b/api/v1/views/user_group.py @@ -0,0 +1,26 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=[_("用户分组")]) +def get_user_group_permissions(request, tenant_id: str,user_group_id:str): + """ 用户分组权限列表,TODO + """ + return [] + +@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=[_("用户分组")]) +def update_user_group_permissions(request, tenant_id: str,user_group_id:str): + """ 更新用户分组权限列表,TODO + """ + return [] + +@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/{id}/",tags=[_("用户分组")]) +def delete_user_group_permissions(request, tenant_id: str,user_group_id:str,id:str): + """ 删除用户分组权限,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/all_permissions/",tags=[_("用户分组")]) +def get_user_group_all_permissions(request, tenant_id: str,user_group_id:str): + """ 获取所有权限并附带是否已授权给用户分组状态,TODO + """ + return [] \ No newline at end of file diff --git a/arkid/core/pages.py b/arkid/core/pages.py index f5eaa30cc..ea2295890 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -1,4 +1,5 @@ from enum import Enum +from typing import List from arkid.common import DeepSN from arkid.common.utils import gen_tag from arkid.core.actions import FrontAction @@ -222,9 +223,20 @@ class TabsPage(FrontPage): """网格页面 """ - def __init__(self, *args, **kwargs): + def __init__(self, pages:list=[],*args, **kwargs): + self.add_pages(pages) super().__init__(type=FrontPageType.TABS_PAGE, *args, **kwargs) + def add_pages(self,pages:list=[]): + if not pages: + return + + if not isinstance(pages, tuple) or not isinstance(pages, list): + pages = list(pages) + if not hasattr(self, "node_action"): + self.node_action = [] + self.node_action.extend(pages) + def register_front_pages(pages): """注册前端页面 From 8c41bbf046d2bfd1dd9f23607e0c10edf9c91e55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 01:35:22 +0000 Subject: [PATCH 08/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/platform_admin/__init__.py | 13 ++++ .../pages/platform_admin/extension_admin.py | 67 ++++++++++++++++++ api/v1/pages/platform_admin/language_admin.py | 37 ++++++++++ api/v1/pages/platform_admin/tenant_admin.py | 68 ++++++++++++++++++- api/v1/views/extension.py | 38 +++++++---- api/v1/views/languape.py | 8 +++ api/v1/views/tenant.py | 26 ++++++- 7 files changed, 243 insertions(+), 14 deletions(-) create mode 100644 api/v1/views/languape.py diff --git a/api/v1/pages/platform_admin/__init__.py b/api/v1/pages/platform_admin/__init__.py index e69de29bb..3b97d0a6c 100644 --- a/api/v1/pages/platform_admin/__init__.py +++ b/api/v1/pages/platform_admin/__init__.py @@ -0,0 +1,13 @@ +from arkid.core import routers +from arkid.core.translation import gettext_default as _ +from . import extension_admin,language_admin,tenant_admin + +router = routers.FrontRouter( + path='platform_admin', + name=_('平台管理'), + children=[ + extension_admin.router, + language_admin.router, + tenant_admin.router + ] +) \ No newline at end of file diff --git a/api/v1/pages/platform_admin/extension_admin.py b/api/v1/pages/platform_admin/extension_admin.py index e69de29bb..8525d6111 100644 --- a/api/v1/pages/platform_admin/extension_admin.py +++ b/api/v1/pages/platform_admin/extension_admin.py @@ -0,0 +1,67 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'extension_admin' +name = '插件管理' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑插件")) +create_page = pages.FormPage(name=_("创建一个新的插件")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/extensions/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + # 加载/卸载 插件 TODO + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/extensions/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/extensions/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/extensions/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/extensions/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/extensions/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/platform_admin/language_admin.py b/api/v1/pages/platform_admin/language_admin.py index e69de29bb..2cb5b0358 100644 --- a/api/v1/pages/platform_admin/language_admin.py +++ b/api/v1/pages/platform_admin/language_admin.py @@ -0,0 +1,37 @@ +from arkid.core.translation import gettext_default as _ +from arkid.core import routers, pages, actions + +tag = 'language_admin' +name = '语言包管理' + +page = pages.TablePage(tag = tag, name = name) +detail_page = pages.DescriptionPage(name=_("语言包详情")) + +pages.register_front_pages(page) +pages.register_front_pages(detail_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/languages/', + method=actions.FrontActionMethod.GET, + ), + local_actions=[ + actions.OpenAction( + name=_("查阅"), + page=detail_page + ) + ] +) + +detail_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/languages/', + method=actions.FrontActionMethod.GET, + ) +) \ No newline at end of file diff --git a/api/v1/pages/platform_admin/tenant_admin.py b/api/v1/pages/platform_admin/tenant_admin.py index 20ca9801d..8482d5f39 100644 --- a/api/v1/pages/platform_admin/tenant_admin.py +++ b/api/v1/pages/platform_admin/tenant_admin.py @@ -1 +1,67 @@ -# 所有租户列表/租户开关 \ No newline at end of file +# 所有租户列表/租户开关 +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'tenant_admin' +name = '租户管理' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑租户")) +create_page = pages.FormPage(name=_("创建一个新的租户")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenants/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenants/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenants/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenants/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenants/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenants/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/views/extension.py b/api/v1/views/extension.py index 0f6b57242..97df2a850 100644 --- a/api/v1/views/extension.py +++ b/api/v1/views/extension.py @@ -52,13 +52,15 @@ def get_extension_profile(request, extension_id: str): extension = ExtensionModel.objects.filter(id=extension_id).first() return extension -# @api.get("/extensions", response=List[ExtensionOut]) -# def list_extensions(request, status: str = None): -# if not status: -# qs = Extension.active_objects.filter(user=request.user) -# else: -# qs = Extension.active_objects.filter(user=request.user, status=status) -# return qs +@api.get("/extensions/", tags=['平台插件']) +def list_extensions(request, status: str = None): + """ 获取平台插件列表 TODO + """ + if not status: + qs = Extension.active_objects.filter(user=request.user) + else: + qs = Extension.active_objects.filter(user=request.user, status=status) + return qs # @operation(roles=["tenant-user", "platform-user"]) @@ -96,8 +98,20 @@ def get_extension_profile(request, extension_id: str): # return {"success": True} -# @api.delete("/extensions/{extension_id}") -# def delete_extension(request, extension_id: str): -# extension = get_object_or_404(Extension, uuid=extension_id) -# extension.delete() -# return {"success": True} \ No newline at end of file +@api.delete("/extensions/{id}/",tags=['平台插件']) +def delete_extension(request, id: str): + """ 删除平台插件 TODO + """ + return {"success": True} + +@api.post("/extensions/{id}/",tags=['平台插件']) +def update_extension(request, id: str): + """ 更新平台插件 TODO + """ + return {"success": True} + +@api.get("/extensions/{id}/",tags=['平台插件']) +def get_extension(request, id: str): + """ 获取平台插件信息 TODO + """ + return {"success": True} \ No newline at end of file diff --git a/api/v1/views/languape.py b/api/v1/views/languape.py new file mode 100644 index 000000000..b565d1794 --- /dev/null +++ b/api/v1/views/languape.py @@ -0,0 +1,8 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + +@api.get("/languages/",tags=['语言包']) +def get_language_list(request): + """ 获取语言包列表 TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index f3e97b6e7..b98e766cb 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -6,4 +6,28 @@ def get_tenant_list(request): """ 获取租户管理员行为日志,TODO """ - return [] \ No newline at end of file + return [] + +@api.get("/tenants/{id}/", tags=[_("租户管理")]) +def get_auth_rule(request, id: str): + """ 获取租户,TODO + """ + return {} + +@api.post("/tenants/", tags=[_("租户管理")]) +def create_auth_rule(request, tenant_id: str): + """ 创建租户,TODO + """ + return {} + +@api.put("/tenants/{id}/", tags=[_("租户管理")]) +def update_auth_rule(request, id: str): + """ 编辑租户,TODO + """ + return {} + +@api.delete("/tenants/{id}/", tags=[_("租户管理")]) +def delete_auth_rule(request, id: str): + """ 删除租户,TODO + """ + return {} From 6dbcc1dd84b1c577b4d4bdff677f0defe8853982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:28:39 +0000 Subject: [PATCH 09/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20TablePage=E4=B8=AD?= =?UTF-8?q?=E5=A7=8B=E7=BB=88=E5=B8=A6=E6=9C=89=E5=B1=9E=E6=80=A7select=3D?= =?UTF-8?q?True=EF=BC=8C=E9=9C=80=E5=8E=BB=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/desktop/__init__.py | 6 +- api/v1/pages/platform_admin/tenant_admin.py | 28 +++++++- api/v1/pages/tenant_manage/center_arkid.py | 29 +++++++- api/v1/pages/tenant_manage/child_manager.py | 66 ++++++++++++++++++ .../pages/tenant_manage/extension_manage.py | 68 ++++++++++++++++++- api/v1/views/center_arkid.py | 14 ++++ api/v1/views/child_manager.py | 35 ++++++++++ api/v1/views/platform_config.py | 14 ++++ api/v1/views/tenant.py | 2 +- api/v1/views/tenant_extension.py | 19 ++++++ arkid/core/pages.py | 8 ++- arkid/core/routers.py | 2 +- 12 files changed, 277 insertions(+), 14 deletions(-) create mode 100644 api/v1/views/center_arkid.py create mode 100644 api/v1/views/child_manager.py create mode 100644 api/v1/views/platform_config.py diff --git a/api/v1/pages/desktop/__init__.py b/api/v1/pages/desktop/__init__.py index 4a7968a5b..479e77457 100644 --- a/api/v1/pages/desktop/__init__.py +++ b/api/v1/pages/desktop/__init__.py @@ -3,12 +3,10 @@ from arkid.core import routers,pages router = routers.FrontRouter( - path='desktop', + path='', name='桌面', icon='home', - children=[ - app_list.router, - ], + page=app_list.page ) router.mobile_children = [ diff --git a/api/v1/pages/platform_admin/tenant_admin.py b/api/v1/pages/platform_admin/tenant_admin.py index 8482d5f39..31691f449 100644 --- a/api/v1/pages/platform_admin/tenant_admin.py +++ b/api/v1/pages/platform_admin/tenant_admin.py @@ -5,12 +5,15 @@ tag = 'tenant_admin' name = '租户管理' - -page = pages.TablePage(tag=tag, name=name) +page = pages.TabsPage(name=name,tag=tag) +platform_config_page = pages.FormPage(name=_("平台配置")) +tenant_list_page = pages.TablePage(name=_("租户管理")) edit_page = pages.FormPage(name=_("编辑租户")) create_page = pages.FormPage(name=_("创建一个新的租户")) pages.register_front_pages(page) +pages.register_front_pages(tenant_list_page) +pages.register_front_pages(platform_config_page) pages.register_front_pages(edit_page) pages.register_front_pages(create_page) @@ -20,7 +23,26 @@ page=page, ) -page.create_actions( +page.add_pages( + [ + tenant_list_page, + platform_config_page + ] +) + +platform_config_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/platform_config/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/platform_config/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +tenant_list_page.create_actions( init_action=actions.DirectAction( path='/api/v1/tenants/', method=actions.FrontActionMethod.GET, diff --git a/api/v1/pages/tenant_manage/center_arkid.py b/api/v1/pages/tenant_manage/center_arkid.py index 7a8842d7e..3d7a1b11e 100644 --- a/api/v1/pages/tenant_manage/center_arkid.py +++ b/api/v1/pages/tenant_manage/center_arkid.py @@ -1 +1,28 @@ -# 中心平台 \ No newline at end of file +# 中心平台 + +from arkid.core import routers, pages, actions + +tag = 'center_arkid' +name = '中心平台' + +page = pages.FormPage(tag = tag, name = name) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path="/api/v1/tenant/{tenant_id}/center_arkid/", + method=actions.FrontActionMethod.GET, + ), + global_actions = [ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/center_arkid/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) \ No newline at end of file diff --git a/api/v1/pages/tenant_manage/child_manager.py b/api/v1/pages/tenant_manage/child_manager.py index e69de29bb..2e0e450b6 100644 --- a/api/v1/pages/tenant_manage/child_manager.py +++ b/api/v1/pages/tenant_manage/child_manager.py @@ -0,0 +1,66 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'child_manager' +name = '子管理员' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑子管理员")) +create_page = pages.FormPage(name=_("创建一个新的子管理员")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/child_managers/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/child_managers/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/child_managers/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/child_managers/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/child_managers/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/child_managers/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/tenant_manage/extension_manage.py b/api/v1/pages/tenant_manage/extension_manage.py index b9b66d06b..87634276a 100644 --- a/api/v1/pages/tenant_manage/extension_manage.py +++ b/api/v1/pages/tenant_manage/extension_manage.py @@ -1 +1,67 @@ -# 租户下的 extension的settings config \ No newline at end of file +# 租户下的 extension的settings config +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'tenant_extension_manage' +name = '插件管理' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑插件")) +create_page = pages.FormPage(name=_("创建一个新的插件")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/extensions/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/extensions/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/extensions/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/extensions/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/extensions/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/extensions/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/views/center_arkid.py b/api/v1/views/center_arkid.py new file mode 100644 index 000000000..dd316eb29 --- /dev/null +++ b/api/v1/views/center_arkid.py @@ -0,0 +1,14 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + +@api.get("/tenant/{tenant_id}/center_arkid/", tags=[_("中心平台")]) +def get_center_arkid(request, tenant_id: str): + """ 获取中心平台配置,TODO + """ + return [] + +@api.post("/tenant/{tenant_id}/center_arkid/", tags=[_("中心平台")]) +def update_center_arkid(request, tenant_id: str): + """ 更新中心平台配置,TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/child_manager.py b/api/v1/views/child_manager.py new file mode 100644 index 000000000..6b0cfad12 --- /dev/null +++ b/api/v1/views/child_manager.py @@ -0,0 +1,35 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/child_managers/", tags=[_("子管理员")]) +def get_child_managers(request, tenant_id: str): + """ 子管理员列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +def get_child_manager(request, tenant_id: str, id: str): + """ 获取子管理员,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/child_managers/", tags=[_("子管理员")]) +def create_child_manager(request, tenant_id: str): + """ 创建子管理员,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +def update_child_manager(request, tenant_id: str, id: str): + """ 编辑子管理员,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +def delete_child_manager(request, tenant_id: str, id: str): + """ 删除子管理员,TODO + """ + return {} + + diff --git a/api/v1/views/platform_config.py b/api/v1/views/platform_config.py new file mode 100644 index 000000000..bed65be98 --- /dev/null +++ b/api/v1/views/platform_config.py @@ -0,0 +1,14 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + +@api.get("/platform_config/", tags=[_("平台配置")]) +def get_platform_config(request): + """ 获取平台配置,TODO + """ + return {} + +@api.post("/platform_config/", tags=[_("平台配置")]) +def update_platform_config(request): + """ 更新平台配置,TODO + """ + return {} \ No newline at end of file diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index b98e766cb..8d5519c2f 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -30,4 +30,4 @@ def update_auth_rule(request, id: str): def delete_auth_rule(request, id: str): """ 删除租户,TODO """ - return {} + return {} \ No newline at end of file diff --git a/api/v1/views/tenant_extension.py b/api/v1/views/tenant_extension.py index 45d406c91..95087fd61 100644 --- a/api/v1/views/tenant_extension.py +++ b/api/v1/views/tenant_extension.py @@ -7,6 +7,7 @@ from arkid.core.extension import Extension from arkid.extension.models import TenantExtensionConfig, TenantExtension from arkid.core.schema import RootSchema +from arkid.core.translation import gettext_default as _ ExtensionConfigSchemaIn = Extension.create_config_schema( 'ExtensionConfigSchemaIn', @@ -102,3 +103,21 @@ def create_extension_settings(request, tenant_id: str, extension_id: str, data: # extension = get_object_or_404(Extension, uuid=extension_id) # extension.delete() # return {"success": True} + +@api.get("/tenant/{tenant_id}/extensions/", tags=[_("租户插件")]) +def get_extensions(request, tenant_id: str): + """ 租户插件列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/extensions/{id}/", tags=[_("租户插件")]) +def get_extension(request, tenant_id: str, id: str): + """ 获取租户插件,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/extensions/{id}/", tags=[_("租户插件")]) +def delete_extension(request, tenant_id: str, id: str): + """ 删除租户插件,TODO + """ + return {} \ No newline at end of file diff --git a/arkid/core/pages.py b/arkid/core/pages.py index ea2295890..8ea8c0563 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -157,11 +157,13 @@ class SelectPage(FrontPage): """ def __init__(self, select: bool = False, *args, **kwargs): - self.select = select + if select: + self.select = select super().__init__(*args, **kwargs) - def create_actions(self, select:bool=True,*args, **kwargs): - self.select = select + def create_actions(self, select:bool=False,*args, **kwargs): + if select: + self.select = select return super().create_actions(*args, **kwargs) diff --git a/arkid/core/routers.py b/arkid/core/routers.py index fbedb79fe..c0c05b24d 100644 --- a/arkid/core/routers.py +++ b/arkid/core/routers.py @@ -63,7 +63,7 @@ def add_child(self, child): Args: child (OrderedDict): 子路由描述 """ - if not self.children: + if not hasattr(self,"children"): self.children = [] self.children.append(child) From cc3bee22f9132115e90538eae1cb68242ec990af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:32:50 +0000 Subject: [PATCH 10/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E5=85=88=E4=B8=8D=E5=A4=84=E7=90=86desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/desktop/__init__.py | 2 +- arkid/core/routers.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/api/v1/pages/desktop/__init__.py b/api/v1/pages/desktop/__init__.py index 479e77457..c52b3eb75 100644 --- a/api/v1/pages/desktop/__init__.py +++ b/api/v1/pages/desktop/__init__.py @@ -3,7 +3,7 @@ from arkid.core import routers,pages router = routers.FrontRouter( - path='', + path='desktop', name='桌面', icon='home', page=app_list.page diff --git a/arkid/core/routers.py b/arkid/core/routers.py index c0c05b24d..25ebb8f29 100644 --- a/arkid/core/routers.py +++ b/arkid/core/routers.py @@ -106,7 +106,6 @@ def register_front_routers(routers, primary: str = ''): if primary == primary_router.path: for router in routers: primary_router.add_child(router) - return global_routers.extend(routers) From 0d5dd9ee1ac225bd608b4a6942a1e2bfcb78acde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:35:08 +0000 Subject: [PATCH 11/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20DeleteAction=20meth?= =?UTF-8?q?od=E5=B1=9E=E6=80=A7=E8=B5=8B=E5=80=BC=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkid/core/actions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arkid/core/actions.py b/arkid/core/actions.py index 5385dff27..b9c039b73 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -173,7 +173,7 @@ def __init__(self, path: str, *args, **kwargs): class DeleteAction(DirectAction): def __init__(self, path: str, *args, **kwargs): self.name = _("删除") - self.method = FrontActionMethod.DELETE.value, + self.method = FrontActionMethod.DELETE.value self.icon = "icon-delete" self.path = path super().__init__(*args, **kwargs) From 7171a2726aa6817c77e30ae1ecd34edcf9cb4d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:38:31 +0000 Subject: [PATCH 12/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=8E=BB=E9=99=A4?= =?UTF-8?q?TreePage=E7=9A=84next=5Faction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 5 ----- api/v1/pages/permission_manage/permission_group.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index f70501bd6..c87f2c8fb 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -28,11 +28,6 @@ init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/app_groups/', method=actions.FrontActionMethod.GET, - next_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', - method=actions.FrontActionMethod.GET, - result_page=group_apps_page - ) ), global_actions=[ actions.CreateAction( diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index 6e7363a20..d21f9580b 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -28,11 +28,6 @@ init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/permission_groups/', method=actions.FrontActionMethod.GET, - next_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=group_permissions_page - ) ), global_actions=[ actions.CreateAction( From 456d1f796d38fa274698de6058cf1c0e2b701bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:40:42 +0000 Subject: [PATCH 13/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=8E=BB=E9=99=A4?= =?UTF-8?q?ListPage=E7=9A=84next=5Faction=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/permission_manage/grant_manage/app_grant.py | 5 ----- api/v1/pages/permission_manage/grant_manage/group_grant.py | 5 ----- api/v1/pages/permission_manage/grant_manage/user_grant.py | 5 ----- arkid/core/actions.py | 5 +---- 4 files changed, 1 insertion(+), 19 deletions(-) diff --git a/api/v1/pages/permission_manage/grant_manage/app_grant.py b/api/v1/pages/permission_manage/grant_manage/app_grant.py index ee75fe30b..296e92a73 100644 --- a/api/v1/pages/permission_manage/grant_manage/app_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/app_grant.py @@ -15,11 +15,6 @@ init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/apps/', method=actions.FrontActionMethod.GET, - next_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/apps/{app_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=app_permission_page - ) ), node_actions=[ actions.DirectAction( diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py index 667dc1802..e9beaf5ee 100644 --- a/api/v1/pages/permission_manage/grant_manage/group_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/group_grant.py @@ -17,11 +17,6 @@ init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/user_groups/', method=actions.FrontActionMethod.GET, - next_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=group_permission_page - ) ), node_actions=[ actions.DirectAction( diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py index c995b1746..641a8bb6d 100644 --- a/api/v1/pages/permission_manage/grant_manage/user_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/user_grant.py @@ -17,11 +17,6 @@ init_action=actions.DirectAction( path='/api/v1/tenant/{tenant_id}/users/', method=actions.FrontActionMethod.GET, - next_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=user_permission_page - ) ), node_actions=[ actions.DirectAction( diff --git a/arkid/core/actions.py b/arkid/core/actions.py index b9c039b73..340755458 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -72,7 +72,7 @@ class FrontAction(DeepSN): """ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = None, method: FrontActionMethod = None, - name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, next_action=None, + name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, result_page=None, result_page_tag=None, *args, **kwargs): """初始化函数 @@ -103,9 +103,6 @@ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = No self.method = method.value if icon: self.icon = icon - - if next_action: - self.next_action = next_action if result_page: self.result_page = result_page.tag if result_page_tag: From 335f93ca6dbc88d99e9d35cbab80a5e8d2be97e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 02:46:22 +0000 Subject: [PATCH 14/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20app=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=B7=AF=E5=BE=84=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=A1=8C?= =?UTF-8?q?=E9=9D=A2path=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/desktop/__init__.py | 2 +- api/v1/views/app.py | 10 +++++----- arkid/core/routers.py | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/api/v1/pages/desktop/__init__.py b/api/v1/pages/desktop/__init__.py index c52b3eb75..479e77457 100644 --- a/api/v1/pages/desktop/__init__.py +++ b/api/v1/pages/desktop/__init__.py @@ -3,7 +3,7 @@ from arkid.core import routers,pages router = routers.FrontRouter( - path='desktop', + path='', name='桌面', icon='home', page=app_list.page diff --git a/api/v1/views/app.py b/api/v1/views/app.py index aca5549dc..0f3049057 100644 --- a/api/v1/views/app.py +++ b/api/v1/views/app.py @@ -51,7 +51,7 @@ class Config: @transaction.atomic -@api.post("/{tenant_id}/apps", response=AppConfigSchemaOut, tags=['应用'], auth=None) +@api.post("/{tenant_id}/apps/", response=AppConfigSchemaOut, tags=['应用'], auth=None) def create_app(request, tenant_id: str, data: AppConfigSchemaIn): ''' app创建 @@ -80,7 +80,7 @@ def create_app(request, tenant_id: str, data: AppConfigSchemaIn): break return {"app_id": app.id.hex} -@api.get("/{tenant_id}/apps", response=List[AppListSchemaOut], tags=['应用'], auth=None) +@api.get("/{tenant_id}/apps/", response=List[AppListSchemaOut], tags=['应用'], auth=None) @paginate def list_apps(request, tenant_id: str): ''' @@ -91,7 +91,7 @@ def list_apps(request, tenant_id: str): ) return apps -@api.get("/{tenant_id}/apps/{app_id}", response=AppSchemaOut, tags=['应用'], auth=None) +@api.get("/{tenant_id}/apps/{app_id}/", response=AppSchemaOut, tags=['应用'], auth=None) def get_app(request, tenant_id: str, app_id: str): ''' 获取app @@ -109,7 +109,7 @@ def get_app(request, tenant_id: str, app_id: str): } return result -@api.delete("/{tenant_id}/apps/{app_id}", tags=['应用'], auth=None) +@api.delete("/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) def delete_app(request, tenant_id: str, app_id: str): ''' 删除app @@ -123,7 +123,7 @@ def delete_app(request, tenant_id: str, app_id: str): app.delete() return {'error': ErrorCode.OK.value} -@api.put("/{tenant_id}/apps/{app_id}", tags=['应用'], auth=None) +@api.put("/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) def update_app(request, tenant_id: str, app_id: str, data: AppConfigSchemaIn): ''' 修改app diff --git a/arkid/core/routers.py b/arkid/core/routers.py index 25ebb8f29..f74291da2 100644 --- a/arkid/core/routers.py +++ b/arkid/core/routers.py @@ -102,10 +102,11 @@ def register_front_routers(routers, primary: str = ''): if not isinstance(routers, tuple) or not isinstance(routers, list): routers = list(routers) - for primary_router in routers: - if primary == primary_router.path: - for router in routers: - primary_router.add_child(router) + # for primary_router in routers: + # if primary == primary_router.path: + # for router in routers: + # primary_router.add_child(router) + # continue global_routers.extend(routers) @@ -119,11 +120,11 @@ def unregister_front_routers(routers, primary: str = ''): if not isinstance(routers, tuple) or not isinstance(routers, list): routers = list(routers) - for primary_router in routers: - if primary == primary_router.path: - for router in routers: - primary_router.remove_child(router) - return + # for primary_router in routers: + # if primary == primary_router.path: + # for router in routers: + # primary_router.remove_child(router) + # continue for router in routers: global_routers.remove(router) From 9c613ccb7510cb7ad4ceb087b04321bb1adb8bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 03:10:32 +0000 Subject: [PATCH 15/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=B7=AF=E7=94=B1=E6=97=B6=E9=99=90=E5=AE=9A?= =?UTF-8?q?=E7=88=B6=E8=B7=AF=E7=94=B1=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkid/core/extension/__init__.py | 2 +- arkid/core/routers.py | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arkid/core/extension/__init__.py b/arkid/core/extension/__init__.py index 5e136e533..0548aaa5a 100644 --- a/arkid/core/extension/__init__.py +++ b/arkid/core/extension/__init__.py @@ -276,7 +276,7 @@ def register_languge(self, lang_code:str = 'en', lang_maps={}): core_translation.extension_lang_maps[lang_code][self.name] = lang_maps core_translation.lang_maps = core_translation.reset_lang_maps() - def register_front_routers(self, router, primary=''): + def register_front_routers(self, router, primary:core_routers.FrontRouter=None): """ primary: 一级路由名字,由 core_routers 文件提供定义 """ diff --git a/arkid/core/routers.py b/arkid/core/routers.py index f74291da2..eb4d5fe35 100644 --- a/arkid/core/routers.py +++ b/arkid/core/routers.py @@ -57,7 +57,7 @@ def __init__(self, path:str, name:str=None, icon:str=None, children=None, redire self.url = url super().__init__(*args, **kwargs) - def add_child(self, child): + def add_children(self, child): """添加子路由 Args: @@ -92,7 +92,7 @@ def change_page_tag(self, header): for child in self.children: child.change_page_tag(header) -def register_front_routers(routers, primary: str = ''): +def register_front_routers(routers, primary: FrontRouter = None): """注册前端路由 Args: @@ -102,15 +102,13 @@ def register_front_routers(routers, primary: str = ''): if not isinstance(routers, tuple) or not isinstance(routers, list): routers = list(routers) - # for primary_router in routers: - # if primary == primary_router.path: - # for router in routers: - # primary_router.add_child(router) - # continue + if primary: + primary.add_children(routers) + return global_routers.extend(routers) -def unregister_front_routers(routers, primary: str = ''): +def unregister_front_routers(routers, primary: FrontRouter = None): """卸载前端路由 Args: @@ -120,12 +118,11 @@ def unregister_front_routers(routers, primary: str = ''): if not isinstance(routers, tuple) or not isinstance(routers, list): routers = list(routers) - # for primary_router in routers: - # if primary == primary_router.path: - # for router in routers: - # primary_router.remove_child(router) - # continue - + if primary: + for router in routers: + primary.remove_child(router) + return + for router in routers: global_routers.remove(router) From 79c0cb7be9a92c297565f840b1ebb6beefe49f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 03:20:32 +0000 Subject: [PATCH 16/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E5=8C=85=E5=85=B3=E9=94=AE=E5=AD=97=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkid/core/translation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arkid/core/translation.py b/arkid/core/translation.py index 79e1be28f..9b80ea4da 100644 --- a/arkid/core/translation.py +++ b/arkid/core/translation.py @@ -5,8 +5,10 @@ default_lang_maps = {} +default_lang_maps["简体中文"] = {} +default_lang_maps["English"] = {} -def gettext_default(id,msg=None,lang="zh-hans"): +def gettext_default(id,msg=None,lang="简体中文"): if not msg: msg = id From 5120ed83809edb9fd0f80e11e3f903f993a7e9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 03:50:10 +0000 Subject: [PATCH 17/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=97=B6=E8=AF=AD=E8=A8=80=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extension_root/com_longgui_translation_zh/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension_root/com_longgui_translation_zh/__init__.py b/extension_root/com_longgui_translation_zh/__init__.py index 2e77ed37f..2cc887aa4 100644 --- a/extension_root/com_longgui_translation_zh/__init__.py +++ b/extension_root/com_longgui_translation_zh/__init__.py @@ -13,7 +13,7 @@ def load(self): super().load() self.register_languge( - 'zh-hans', + '简体中文', {"data":"数据"} ) From 9ed34a67cde65256f08c52dcba01922444f9d4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 04:32:23 +0000 Subject: [PATCH 18/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/user_manage/__init__.py | 5 +- api/v1/pages/user_manage/account_life.py | 66 +++++++++++++ api/v1/pages/user_manage/devices.py | 23 +++++ api/v1/pages/user_manage/user_group.py | 113 +++++++++++++++++++++++ api/v1/views/account_life.py | 35 +++++++ api/v1/views/devices.py | 9 ++ api/v1/views/user_group.py | 54 +++++++++++ 7 files changed, 304 insertions(+), 1 deletion(-) create mode 100644 api/v1/views/account_life.py create mode 100644 api/v1/views/devices.py diff --git a/api/v1/pages/user_manage/__init__.py b/api/v1/pages/user_manage/__init__.py index fd183e8bc..0bd2079b1 100644 --- a/api/v1/pages/user_manage/__init__.py +++ b/api/v1/pages/user_manage/__init__.py @@ -1,4 +1,4 @@ -from . import user_list +from . import user_list,user_group,devices,account_life from arkid.core import routers @@ -8,5 +8,8 @@ icon='user', children=[ user_list.router, + user_group.router, + devices.router, + account_life.router ], ) \ No newline at end of file diff --git a/api/v1/pages/user_manage/account_life.py b/api/v1/pages/user_manage/account_life.py index e69de29bb..9e36a4c7a 100644 --- a/api/v1/pages/user_manage/account_life.py +++ b/api/v1/pages/user_manage/account_life.py @@ -0,0 +1,66 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'account_life' +name = '账号生命周期' + + +page = pages.TablePage(tag=tag, name=name) +edit_page = pages.FormPage(name=_("编辑账号生命周期设置")) +create_page = pages.FormPage(name=_("创建一个新的账号生命周期设置")) + +pages.register_front_pages(page) +pages.register_front_pages(edit_page) +pages.register_front_pages(create_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/account_lifes/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/account_lifes/{id}/", + ) + ], +) + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/account_lifes/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/account_lifes/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/account_lifes/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/account_lifes/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/pages/user_manage/devices.py b/api/v1/pages/user_manage/devices.py index e69de29bb..8d4de09d9 100644 --- a/api/v1/pages/user_manage/devices.py +++ b/api/v1/pages/user_manage/devices.py @@ -0,0 +1,23 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'devices' +name = '设备管理' + + +page = pages.TablePage(tag=tag, name=name) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/devices/', + method=actions.FrontActionMethod.GET, + ), +) \ No newline at end of file diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index e69de29bb..085406486 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -0,0 +1,113 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'user_group' +name = '用户分组' + + +page = pages.TreePage(tag=tag,name=name) +group_users_page = pages.TablePage(name=_("组内用户")) +edit_users_page = pages.TablePage(name=_("更新组内用户")) +create_page = pages.FormPage(name=_("创建用户分组")) +edit_page = pages.FormPage(name=_("编辑用户分组")) + + +pages.register_front_pages(page) +pages.register_front_pages(group_users_page) +pages.register_front_pages(edit_users_page) +pages.register_front_pages(create_page) +pages.register_front_pages(edit_page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) + +page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/', + method=actions.FrontActionMethod.GET, + ), + global_actions=[ + actions.CreateAction( + page=create_page, + ) + ], + local_actions=[ + actions.EditAction( + page=edit_page, + ), + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/user_groups/{id}/", + ) + ], + node_actions=[ + actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/', + method=actions.FrontActionMethod.GET, + result_page=group_users_page + ) + ] +) + +group_users_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.OpenAction( + name=_("添加用户"), + page=edit_users_page, + ) + ], + local_actions=[ + actions.DeleteAction( + path="/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/{id}/", + icon="icon-delete", + ) + ], +) + + +edit_users_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/select_users/', + method=actions.FrontActionMethod.GET, + ), + select=True, + global_actions=[ + actions.ConfirmAction( + path="/tenant/{tenant_id}/user_groups/{user_group_id}/users/" + ), + actions.CancelAction() + ] +) + + +edit_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/{id}/', + method=actions.FrontActionMethod.GET + ), + global_actions=[ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/user_groups/{id}/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) + +create_page.create_actions( + init_action=actions.DirectAction( + path='/api/v1/tenant/{tenant_id}/user_groups/', + method=actions.FrontActionMethod.POST + ), + global_actions=[ + actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/user_groups/", + ), + actions.CancelAction(), + actions.ResetAction(), + ] +) diff --git a/api/v1/views/account_life.py b/api/v1/views/account_life.py new file mode 100644 index 000000000..56a07fd55 --- /dev/null +++ b/api/v1/views/account_life.py @@ -0,0 +1,35 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期")]) +def get_account_life_list(request, tenant_id: str): + """ 账号生命周期配置列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +def get_account_life(request, tenant_id: str, id: str): + """ 获取账号生命周期配置,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期配置")]) +def create_account_life(request, tenant_id: str): + """ 创建账号生命周期配置,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +def update_account_life(request, tenant_id: str, id: str): + """ 编辑账号生命周期配置,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +def delete_account_life(request, tenant_id: str, id: str): + """ 删除账号生命周期配置,TODO + """ + return {} + + diff --git a/api/v1/views/devices.py b/api/v1/views/devices.py new file mode 100644 index 000000000..5e0b7a93e --- /dev/null +++ b/api/v1/views/devices.py @@ -0,0 +1,9 @@ +from arkid.core.api import api +from arkid.core.translation import gettext_default as _ + + +@api.get("/tenant/{tenant_id}/devices/", tags=[_("设备管理")]) +def get_device_list(request, tenant_id: str): + """ 设备管理列表,TODO + """ + return [] \ No newline at end of file diff --git a/api/v1/views/user_group.py b/api/v1/views/user_group.py index 6597bb6cc..f8ce86b34 100644 --- a/api/v1/views/user_group.py +++ b/api/v1/views/user_group.py @@ -1,6 +1,60 @@ from arkid.core.api import api from arkid.core.translation import gettext_default as _ +@api.get("/tenant/{tenant_id}/user_groups/", tags=[_("用户分组")]) +def get_user_groups(request, tenant_id: str): + """ 用户分组列表,TODO + """ + return [] + +@api.get("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +def get_user_group(request, tenant_id: str, id: str): + """ 获取用户分组,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/user_groups/", tags=[_("用户分组")]) +def create_user_group(request, tenant_id: str): + """ 创建用户分组,TODO + """ + return {} + +@api.put("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +def update_user_group(request, tenant_id: str, id: str): + """ 编辑用户分组,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +def delete_user_group(request, tenant_id: str, id: str): + """ 删除用户分组,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=[_("用户分组")]) +def get_users_from_group(request, tenant_id: str, user_group_id: str): + """ 获取当前分组的用户列表,TODO + """ + return {} + +@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/users/{id}/", tags=[_("用户分组")]) +def remove_user_from_group(request, tenant_id: str, user_group_id: str,id:str): + """ 将用户移除出用户分组,TODO + """ + return {} + +@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=[_("用户分组")]) +def update_users_from_group(request, tenant_id: str, user_group_id: str): + """ 更新当前分组的用户列表,TODO + """ + return {} + +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/select_users/", tags=[_("用户分组")]) +def get_select_users(request, tenant_id: str, user_group_id: str): + """ 获取所有用户并附加是否在当前分组的状态,TODO + """ + return {} + @api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=[_("用户分组")]) def get_user_group_permissions(request, tenant_id: str,user_group_id:str): """ 用户分组权限列表,TODO From 643fe05672818bd8b7e65c7c7e36d2ed8a7ab9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 09:34:26 +0000 Subject: [PATCH 19/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20AppGroup=20Schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/app_group.py | 129 +++++++++++++++++++++++++++++++------- api/v1/views/user.py | 2 +- 2 files changed, 109 insertions(+), 22 deletions(-) diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index 5f7240e4e..f25e57229 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -1,57 +1,144 @@ -from arkid.core.api import api +from typing import List +from attr import field +from ninja import Field, ModelSchema, Query, Schema +from requests import Response +from arkid.core.api import api,operation +from arkid.core.models import AppGroup from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/app_groups/", tags=[_("应用分组")]) -def get_app_groups(request, tenant_id: str): +class AppGroupListQueryIn(Schema): + pass + +class AppGroupListOut(ModelSchema): + class Config: + model = AppGroup + model_fields = ["name"] + +@api.get("/tenant/{tenant_id}/app_groups/", response=List[AppGroupListOut],tags=[_("应用分组")]) +@operation(List[AppGroupListOut]) +def get_app_groups(request, tenant_id: str, query_data: AppGroupListQueryIn=Query(...)): """ 应用分组列表,TODO """ - return [] + groups = AppGroup.expand_objects.filter(tenant__id=tenant_id).all() + return groups -@api.get("/tenant/{tenant_id}/app_groups/{id}/", tags=[_("应用分组")]) -def get_app_group(request, tenant_id: str, id: str): +class AppGroupQueryIn(Schema): + pass + +class AppGroupOut(ModelSchema): + class Config: + model = AppGroup + model_fields = ["name"] + +@api.get("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupOut, tags=[_("应用分组")]) +@operation(AppGroupOut) +def get_app_group(request, tenant_id: str, id: str, query_data: AppGroupQueryIn=Query(...)): """ 获取应用分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/app_groups/", tags=[_("应用分组")]) -def create_app_group(request, tenant_id: str): +class AppGroupCreateIn(ModelSchema): + class Config: + model = AppGroup + model_fields = ["name"] + +class AppGroupCreateQueryIn(Schema): + pass + +class AppGroupCreateOut(Schema): + pass + +@api.post("/tenant/{tenant_id}/app_groups/", response=AppGroupCreateOut, tags=[_("应用分组")]) +@operation(AppGroupCreateOut) +def create_app_group(request, tenant_id: str, data: AppGroupCreateIn, query_data: AppGroupCreateQueryIn=Query(...)): """ 创建应用分组,TODO """ return {} -@api.put("/tenant/{tenant_id}/app_groups/{id}/", tags=[_("应用分组")]) -def update_app_group(request, tenant_id: str, id: str): + +class AppGroupUpdateIn(ModelSchema): + class Config: + model = AppGroup + model_fields = ["name"] + +class AppGroupUpdateQueryIn(Schema): + pass + +class AppGroupUpdateOut(Schema): + pass + +@api.put("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupUpdateOut,tags=[_("应用分组")]) +@operation(AppGroupUpdateOut) +def update_app_group(request, tenant_id: str, id: str,data: AppGroupUpdateIn, query_data: AppGroupUpdateQueryIn=Query(...)): """ 编辑应用分组,TODO """ return {} -@api.delete("/tenant/{tenant_id}/app_groups/{id}/", tags=[_("应用分组")]) -def delete_app_group(request, tenant_id: str, id: str): +class AppGroupDeleteQueryIn(Schema): + pass + +class AppGroupDeleteOut(Schema): + pass + +@api.delete("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupDeleteOut, tags=[_("应用分组")]) +@operation(AppGroupDeleteOut) +def delete_app_group(request, tenant_id: str, id: str,query_data: AppGroupDeleteQueryIn=Query(...)): """ 删除应用分组,TODO """ return {} -@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) -def get_apps_from_group(request, tenant_id: str, app_group_id: str): +class GroupAppsQueryIn(Schema): + pass + +class GroupAppsOut(Schema): + pass + +@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/",response=List[GroupAppsOut],tags=[_("应用分组")]) +@operation(List[GroupAppsOut]) +def get_apps_from_group(request, tenant_id: str, app_group_id: str, query_data: GroupAppsQueryIn=Query(...)): """ 获取当前分组的应用列表,TODO """ - return {} + return [] -@api.delete("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/", tags=[_("应用分组")]) -def remove_app_from_group(request, tenant_id: str, app_group_id: str,id:str): +class GroupAppRemoveQueryIn(Schema): + pass + +class GroupAppRemoveOut(Schema): + pass + +@api.delete("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/",response=GroupAppRemoveOut, tags=[_("应用分组")]) +@operation(GroupAppRemoveOut) +def remove_app_from_group(request, tenant_id: str, app_group_id: str,id:str, query_data: GroupAppRemoveQueryIn=Query(...)): """ 将应用移除出应用分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", tags=[_("应用分组")]) -def update_apps_from_group(request, tenant_id: str, app_group_id: str): +class GroupAppUpdateIn(Schema): + pass + +class GroupAppUpdateQueryIn(Schema): + pass + +class GroupAppUpdateOut(Schema): + pass + +@api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", response=GroupAppUpdateOut,tags=[_("应用分组")]) +@operation(GroupAppUpdateOut) +def update_apps_from_group(request, tenant_id: str, app_group_id: str,data: GroupAppUpdateIn, query_data: GroupAppUpdateQueryIn=Query(...)): """ 更新当前分组的应用列表,TODO """ return {} -@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/", tags=[_("应用分组")]) -def get_select_apps(request, tenant_id: str, app_group_id: str): +class GroupAllAppQueryIn(Schema): + pass + +class GroupAllAppOut(Schema): + pass + +@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/",response=List[GroupAllAppOut], tags=[_("应用分组")]) +@operation(List[GroupAllAppOut]) +def get_select_apps(request, tenant_id: str, app_group_id: str, query_data: GroupAllAppQueryIn=Query(...)): """ 获取所有应用并附加是否在当前分组的状态,TODO """ return {} diff --git a/api/v1/views/user.py b/api/v1/views/user.py index c76c6e4b1..8eb248fe5 100644 --- a/api/v1/views/user.py +++ b/api/v1/views/user.py @@ -21,7 +21,7 @@ class Config: @api.get("/tenant/{tenant_id}/users/",response=List[UserListOutSchema], tags=['用户'], auth=None) @operation(List[UserListOutSchema]) -def user_list(request, tenant_id: str,data: UserListInSchema=Query(...)): +def user_list(request, tenant_id: str, data: UserListInSchema=Query(...)): users = User.expand_objects.filter(tenant__id=tenant_id).all() return users From c0587ab1cf76517aec772a1faf19cbc0923a8f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Tue, 26 Apr 2022 13:01:10 +0000 Subject: [PATCH 20/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=AE=A1=E7=90=86=E5=92=8C=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AEBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/__init__.py | 6 ++++- api/v1/pages/tenant_manage/__init__.py | 14 +++++++++++ api/v1/pages/tenant_manage/tenant_config.py | 26 +++++++++++++++++++++ api/v1/views/app_group.py | 4 +++- api/v1/views/tenant.py | 20 ++++++++++++---- 5 files changed, 64 insertions(+), 6 deletions(-) diff --git a/api/v1/pages/__init__.py b/api/v1/pages/__init__.py index 2aec33a7b..fda60888d 100644 --- a/api/v1/pages/__init__.py +++ b/api/v1/pages/__init__.py @@ -10,6 +10,8 @@ log_manage, mine, permission_manage, + platform_admin, + tenant_manage ) from arkid.core import routers @@ -26,6 +28,8 @@ developer_manage.router, log_manage.router, mine.router, - permission_manage.router + permission_manage.router, + platform_admin.router, + tenant_manage.router ] ) diff --git a/api/v1/pages/tenant_manage/__init__.py b/api/v1/pages/tenant_manage/__init__.py index e69de29bb..4291fd457 100644 --- a/api/v1/pages/tenant_manage/__init__.py +++ b/api/v1/pages/tenant_manage/__init__.py @@ -0,0 +1,14 @@ +from arkid.core import routers +from arkid.core.translation import gettext_default as _ +from . import center_arkid,child_manager,tenant_config,extension_manage + +router = routers.FrontRouter( + path='tenant_manage', + name=_('租户管理'), + children=[ + center_arkid.router, + child_manager.router, + tenant_config.router, + extension_manage.router + ] +) \ No newline at end of file diff --git a/api/v1/pages/tenant_manage/tenant_config.py b/api/v1/pages/tenant_manage/tenant_config.py index e69de29bb..0fafc3d69 100644 --- a/api/v1/pages/tenant_manage/tenant_config.py +++ b/api/v1/pages/tenant_manage/tenant_config.py @@ -0,0 +1,26 @@ +from arkid.core import routers, pages, actions + +tag = 'tenant_config' +name = '租户配置' + +page = pages.FormPage(tag = tag, name = name) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page +) + +page.create_actions( + init_action=actions.DirectAction( + path="/api/v1/tenant/{tenant_id}/tenant_config/", + method=actions.FrontActionMethod.GET, + ), + global_actions = [ + actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/tenant_config/"), + actions.CancelAction(), + actions.ResetAction(), + ] +) \ No newline at end of file diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index f25e57229..3e084b45c 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -49,11 +49,13 @@ class AppGroupCreateQueryIn(Schema): class AppGroupCreateOut(Schema): pass -@api.post("/tenant/{tenant_id}/app_groups/", response=AppGroupCreateOut, tags=[_("应用分组")]) +@api.post("/tenant/{tenant_id}/app_groups/", response=AppGroupCreateOut, tags=[_("应用分组")],auth=None) @operation(AppGroupCreateOut) def create_app_group(request, tenant_id: str, data: AppGroupCreateIn, query_data: AppGroupCreateQueryIn=Query(...)): """ 创建应用分组,TODO """ + group = AppGroup.expand_objects.create(**data) + return {} diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index 8d5519c2f..1d3196218 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -9,25 +9,37 @@ def get_tenant_list(request): return [] @api.get("/tenants/{id}/", tags=[_("租户管理")]) -def get_auth_rule(request, id: str): +def get_tenant(request, id: str): """ 获取租户,TODO """ return {} @api.post("/tenants/", tags=[_("租户管理")]) -def create_auth_rule(request, tenant_id: str): +def create_tenant(request, tenant_id: str): """ 创建租户,TODO """ return {} @api.put("/tenants/{id}/", tags=[_("租户管理")]) -def update_auth_rule(request, id: str): +def update_tenant(request, id: str): """ 编辑租户,TODO """ return {} @api.delete("/tenants/{id}/", tags=[_("租户管理")]) -def delete_auth_rule(request, id: str): +def delete_tenant(request, id: str): """ 删除租户,TODO """ + return {} + +@api.get("/tenants/{id}/config/", tags=[_("租户管理")]) +def get_tenant_config(request, id: str): + """ 获取租户配置,TODO + """ + return {} + +@api.post("/tenants/{id}/config/", tags=[_("租户管理")]) +def update_tenant_config(request, id: str): + """ 编辑租户配置,TODO + """ return {} \ No newline at end of file From 209ff8fc826f45a76e85b4c69ca7dccd8521378f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 02:05:52 +0000 Subject: [PATCH 21/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3Schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/__init__.py | 1 + api/v1/views/tenant.py | 124 ++++++++++++++++++++++++++++++++------- 2 files changed, 103 insertions(+), 22 deletions(-) diff --git a/api/v1/views/__init__.py b/api/v1/views/__init__.py index 5c1e0313b..0511b0fda 100644 --- a/api/v1/views/__init__.py +++ b/api/v1/views/__init__.py @@ -17,4 +17,5 @@ scim_sync, webhook, send_sms, + tenant ) diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index 1d3196218..1e0a355db 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -1,45 +1,125 @@ -from arkid.core.api import api +from typing import List +from ninja import ModelSchema, Query, Schema +from arkid.core.api import api, operation +from arkid.core.models import Tenant from arkid.core.translation import gettext_default as _ +class TenantListQueryIn(Schema): + pass + +class TenantListOut(ModelSchema): + class Config: + model = Tenant + model_fields = ["name", "slug", "icon"] -@api.get("/tenants/", tags=[_("租户管理")]) -def get_tenant_list(request): - """ 获取租户管理员行为日志,TODO +@api.get("/tenants/", response=List[TenantListOut],tags=[_("租户管理")]) +@operation(List[TenantListOut]) +def get_tenant_list(request,query_data:TenantListQueryIn=Query(...)): + """ 获取租户列表 """ - return [] -@api.get("/tenants/{id}/", tags=[_("租户管理")]) -def get_tenant(request, id: str): - """ 获取租户,TODO + tenants = Tenant.active_objects.all() + + return tenants + +class TenantQueryIn(Schema): + pass + +class TenantOut(ModelSchema): + class Config: + model = Tenant + model_fields = ["name"] + +@api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")]) +@operation(TenantOut) +def get_tenant(request, id: str,query_data:TenantQueryIn=Query(...)): + """ 获取租户 """ - return {} + tenant = Tenant.active_objects.get(id=id) + return tenant -@api.post("/tenants/", tags=[_("租户管理")]) -def create_tenant(request, tenant_id: str): - """ 创建租户,TODO +class TenantCreateIn(ModelSchema): + class Config: + model = Tenant + model_fields = ["name"] + +class TenantCreateQueryIn(Schema): + pass + +class TenantCreateOut(Schema): + pass + +@api.post("/tenants/",response=TenantCreateOut,tags=[_("租户管理")]) +@operation(TenantCreateOut) +def create_tenant(request, tenant_id: str,data:TenantCreateIn,query_data:TenantCreateQueryIn=Query(...)): + """ 创建租户 """ + + tenant = Tenant.valid_objects.create(**data) + return {} -@api.put("/tenants/{id}/", tags=[_("租户管理")]) -def update_tenant(request, id: str): - """ 编辑租户,TODO +class TenantUpdateIn(ModelSchema): + class Config: + model = Tenant + model_fields = ["name","slug","icon"] + +class TenantUpdateQueryIn(Schema): + pass + +class TenantUpdateOut(Schema): + pass + +@api.put("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")]) +@operation(TenantUpdateOut) +def update_tenant(request, id: str,data:TenantUpdateIn,query_data:TenantUpdateQueryIn=Query(...)): + """ 编辑租户 """ + tenant = Tenant.active_objects.get(id=id) + tenant.update(**data) return {} -@api.delete("/tenants/{id}/", tags=[_("租户管理")]) -def delete_tenant(request, id: str): - """ 删除租户,TODO +class TenantDeleteQueryIn(Schema): + pass + +class TenantDeleteOut(Schema): + pass + +@api.delete("/tenants/{id}/", response=TenantDeleteOut, tags=[_("租户管理")]) +@operation(TenantDeleteOut) +def delete_tenant(request, id: str, query_data:TenantDeleteQueryIn=Query(...)): + """ 删除租户 """ + tenant = Tenant.active_objects.get(id=id) + tenant.delete() return {} -@api.get("/tenants/{id}/config/", tags=[_("租户管理")]) -def get_tenant_config(request, id: str): + +class TenantConfigQueryIn(Schema): + pass + +class TenantConfigOut(Schema): + pass + +@api.get("/tenants/{id}/config/", response=TenantConfigOut, tags=[_("租户管理")]) +@operation(TenantConfigOut) +def get_tenant_config(request, id: str,query_data:TenantConfigQueryIn=Query(...)): """ 获取租户配置,TODO """ return {} -@api.post("/tenants/{id}/config/", tags=[_("租户管理")]) -def update_tenant_config(request, id: str): +class TenantConfigUpdateQueryIn(Schema): + pass + +class TenantConfigUpdateIn(Schema): + pass + +class TenantConfigUpdateOut(Schema): + pass + +@api.post("/tenants/{id}/config/", response=TenantConfigUpdateOut,tags=[_("租户管理")]) +@operation(TenantConfigUpdateOut) +def update_tenant_config(request, id: str,data:TenantConfigUpdateIn,query_data:TenantConfigUpdateQueryIn=Query(...)): """ 编辑租户配置,TODO """ return {} \ No newline at end of file From 579f65871b00d7d12b2470c0ecc7275168882353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 02:09:24 +0000 Subject: [PATCH 22/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=B0=86=E5=B7=B2?= =?UTF-8?q?=E5=BB=BA=E7=9A=84view=E6=B7=BB=E5=8A=A0=E5=88=B0views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/api/v1/views/__init__.py b/api/v1/views/__init__.py index 0511b0fda..f62712746 100644 --- a/api/v1/views/__init__.py +++ b/api/v1/views/__init__.py @@ -14,8 +14,21 @@ auto_auth, third_auth, permission_sync, + permission_rule, + permission, scim_sync, webhook, send_sms, - tenant + tenant, + account_life, + app_protocol, + center_arkid, + bi_system, + child_manager, + permission_group, + platform_config, + devices, + user_group, + languape, + log, ) From 19644619b449fff5367769d04c7e4f5d02be1892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 02:22:42 +0000 Subject: [PATCH 23/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8DT?= =?UTF-8?q?abs=E9=A1=B5=E9=9D=A2=E5=8C=85=E5=90=AB=E5=AD=90=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=B1=9E=E6=80=A7=E5=90=8D=E7=A7=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/tenant.py | 14 +++++++------- arkid/core/pages.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index 1e0a355db..53210ea1e 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -12,7 +12,7 @@ class Config: model = Tenant model_fields = ["name", "slug", "icon"] -@api.get("/tenants/", response=List[TenantListOut],tags=[_("租户管理")]) +@api.get("/tenants/", response=List[TenantListOut],tags=[_("租户管理")],auth=None) @operation(List[TenantListOut]) def get_tenant_list(request,query_data:TenantListQueryIn=Query(...)): """ 获取租户列表 @@ -32,7 +32,7 @@ class Config: @api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")]) @operation(TenantOut) -def get_tenant(request, id: str,query_data:TenantQueryIn=Query(...)): +def get_tenant(request, id: str, query_data:TenantQueryIn=Query(...), auth=None): """ 获取租户 """ tenant = Tenant.active_objects.get(id=id) @@ -49,7 +49,7 @@ class TenantCreateQueryIn(Schema): class TenantCreateOut(Schema): pass -@api.post("/tenants/",response=TenantCreateOut,tags=[_("租户管理")]) +@api.post("/tenants/",response=TenantCreateOut,tags=[_("租户管理")],auth=None) @operation(TenantCreateOut) def create_tenant(request, tenant_id: str,data:TenantCreateIn,query_data:TenantCreateQueryIn=Query(...)): """ 创建租户 @@ -70,7 +70,7 @@ class TenantUpdateQueryIn(Schema): class TenantUpdateOut(Schema): pass -@api.put("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")]) +@api.put("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")],auth=None) @operation(TenantUpdateOut) def update_tenant(request, id: str,data:TenantUpdateIn,query_data:TenantUpdateQueryIn=Query(...)): """ 编辑租户 @@ -85,7 +85,7 @@ class TenantDeleteQueryIn(Schema): class TenantDeleteOut(Schema): pass -@api.delete("/tenants/{id}/", response=TenantDeleteOut, tags=[_("租户管理")]) +@api.delete("/tenants/{id}/", response=TenantDeleteOut, tags=[_("租户管理")],auth=None) @operation(TenantDeleteOut) def delete_tenant(request, id: str, query_data:TenantDeleteQueryIn=Query(...)): """ 删除租户 @@ -101,7 +101,7 @@ class TenantConfigQueryIn(Schema): class TenantConfigOut(Schema): pass -@api.get("/tenants/{id}/config/", response=TenantConfigOut, tags=[_("租户管理")]) +@api.get("/tenants/{id}/config/", response=TenantConfigOut, tags=[_("租户管理")],auth=None) @operation(TenantConfigOut) def get_tenant_config(request, id: str,query_data:TenantConfigQueryIn=Query(...)): """ 获取租户配置,TODO @@ -117,7 +117,7 @@ class TenantConfigUpdateIn(Schema): class TenantConfigUpdateOut(Schema): pass -@api.post("/tenants/{id}/config/", response=TenantConfigUpdateOut,tags=[_("租户管理")]) +@api.post("/tenants/{id}/config/", response=TenantConfigUpdateOut,tags=[_("租户管理")],auth=None) @operation(TenantConfigUpdateOut) def update_tenant_config(request, id: str,data:TenantConfigUpdateIn,query_data:TenantConfigUpdateQueryIn=Query(...)): """ 编辑租户配置,TODO diff --git a/arkid/core/pages.py b/arkid/core/pages.py index 8ea8c0563..b850b8185 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -235,9 +235,9 @@ def add_pages(self,pages:list=[]): if not isinstance(pages, tuple) or not isinstance(pages, list): pages = list(pages) - if not hasattr(self, "node_action"): - self.node_action = [] - self.node_action.extend(pages) + if not hasattr(self, "pages"): + self.pages = [] + self.pages.extend(pages) def register_front_pages(pages): """注册前端页面 From 225e5834544b1bbc714ea19bb5be3be60b027fb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 02:27:44 +0000 Subject: [PATCH 24/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=9C=A8TabsPage?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=90=E9=A1=B5=E9=9D=A2=E6=97=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkid/core/pages.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arkid/core/pages.py b/arkid/core/pages.py index b850b8185..6a9f26feb 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -237,7 +237,9 @@ def add_pages(self,pages:list=[]): pages = list(pages) if not hasattr(self, "pages"): self.pages = [] - self.pages.extend(pages) + + for item in pages: + self.pages.append(item.tag if isinstance(item,FrontPage) else item) def register_front_pages(pages): """注册前端页面 From eeebe0288acb3676f97c2cdd387bde69da00a1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 02:49:18 +0000 Subject: [PATCH 25/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E5=8A=A8=E4=BD=9CCascadeAction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 6 ++---- .../permission_manage/grant_manage/app_grant.py | 6 ++---- .../permission_manage/grant_manage/group_grant.py | 6 ++---- .../permission_manage/grant_manage/user_grant.py | 6 ++---- .../pages/permission_manage/permission_group.py | 6 ++---- api/v1/pages/user_manage/user_group.py | 6 ++---- arkid/core/actions.py | 15 +++++++++------ 7 files changed, 21 insertions(+), 30 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index c87f2c8fb..1015df317 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -43,10 +43,8 @@ ) ], node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', - method=actions.FrontActionMethod.GET, - result_page=group_apps_page + actions.CascadeAction( + page=group_apps_page ) ] ) diff --git a/api/v1/pages/permission_manage/grant_manage/app_grant.py b/api/v1/pages/permission_manage/grant_manage/app_grant.py index 296e92a73..3bf9a710d 100644 --- a/api/v1/pages/permission_manage/grant_manage/app_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/app_grant.py @@ -17,10 +17,8 @@ method=actions.FrontActionMethod.GET, ), node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/apps/{app_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=app_permission_page + actions.CascadeAction( + page=app_permission_page ) ] ) diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py index e9beaf5ee..2af371062 100644 --- a/api/v1/pages/permission_manage/grant_manage/group_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/group_grant.py @@ -19,10 +19,8 @@ method=actions.FrontActionMethod.GET, ), node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=group_permission_page + actions.CascadeAction( + page=group_permission_page ) ], ) diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py index 641a8bb6d..b24708b7e 100644 --- a/api/v1/pages/permission_manage/grant_manage/user_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/user_grant.py @@ -19,10 +19,8 @@ method=actions.FrontActionMethod.GET, ), node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=user_permission_page + actions.CascadeAction( + page=user_permission_page ) ], ) diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index d21f9580b..f62ff67d4 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -43,10 +43,8 @@ ) ], node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', - method=actions.FrontActionMethod.GET, - result_page=group_permissions_page + actions.CascadeAction( + page=group_permissions_page ) ] ) diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index 085406486..0e99b9727 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -43,10 +43,8 @@ ) ], node_actions=[ - actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/', - method=actions.FrontActionMethod.GET, - result_page=group_users_page + actions.CascadeAction( + page=group_users_page ) ] ) diff --git a/arkid/core/actions.py b/arkid/core/actions.py index 340755458..4db6e0399 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -18,6 +18,7 @@ class FrontActionType(Enum): - node 节点点击类型(页面中将隐藏该操作) - url 内外链接类型 - password 编辑密码类型 + - cascade 级联类型 ``` """ @@ -28,6 +29,7 @@ class FrontActionType(Enum): IMPORT_ACTION = 'import' URL_ACTION = 'url' PASSWORD_ACTION = 'password' + CASCADE_ACTION = 'cascade' class FrontActionMethod(Enum): @@ -72,8 +74,7 @@ class FrontAction(DeepSN): """ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = None, method: FrontActionMethod = None, - name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, - result_page=None, result_page_tag=None, *args, **kwargs): + name: str = None, page=None, page_tag=None, icon: str = None, tag_pre: str = None, *args, **kwargs): """初始化函数 Args: @@ -103,10 +104,6 @@ def __init__(self, action_type: FrontActionType, tag: str = None, path: str = No self.method = method.value if icon: self.icon = icon - if result_page: - self.result_page = result_page.tag - if result_page_tag: - self.result_page = result_page_tag super().__init__(*args, **kwargs) @@ -157,6 +154,10 @@ class PasswordAction(FrontAction): def __init__(self, *args, **kwargs): super().__init__(action_type=FrontActionType.PASSWORD_ACTION, *args, **kwargs) +class CascadeAction(FrontAction): + def __init__(self, page, *args, **kwargs): + super().__init__(action_type=FrontActionType.CASCADE_ACTION, page=page, *args, **kwargs) + class ConfirmAction(DirectAction): def __init__(self, path: str, *args, **kwargs): @@ -190,6 +191,8 @@ def __init__(self, page, *args, **kwargs): super().__init__(page=page, *args, **kwargs) + + nav_actions = {} From bd8c9890092ffb19af0d7af7a16b9481290a3177 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 08:21:42 +0000 Subject: [PATCH 26/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/mine.py | 13 +++++++++++-- api/v1/views/permission_group.py | 6 +++--- api/v1/views/tenant.py | 26 ++++++++++++-------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index e69f69960..606ae5d88 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -1,5 +1,8 @@ +from typing import List from django.shortcuts import render +from ninja import ModelSchema, Schema from arkid.core.api import api +from arkid.core.models import Tenant from arkid.core.translation import gettext_default as _ @@ -62,8 +65,14 @@ def get_mine_logout(request): """ return {} -@api.get("/mine/tenants/",tags=[_("我的")]) +class MineTenantsOut(ModelSchema): + class Config: + model = Tenant + model_fields=["id","name","slug","icon"] + +@api.get("/mine/tenants/",response=List[MineTenantsOut],tags=[_("我的")],auth=None) def get_mine_tenants(request): """ 获取我的租户,TODO """ - return {} \ No newline at end of file + tenants = Tenant.active_objects.all() + return tenants \ No newline at end of file diff --git a/api/v1/views/permission_group.py b/api/v1/views/permission_group.py index 07d644f63..4116ef996 100644 --- a/api/v1/views/permission_group.py +++ b/api/v1/views/permission_group.py @@ -33,7 +33,7 @@ def delete_permission_group(request, tenant_id: str, id: str): return {} @api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) -def get_permissions_from_group(request, tenant_id: str, group_id: str): +def get_permissions_from_group(request, tenant_id: str, permission_group_id: str): """ 获取当前分组的权限列表,TODO """ return {} @@ -45,13 +45,13 @@ def remove_permission_from_group(request, tenant_id: str, permission_group_id: s return {} @api.post("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) -def update_permissions_from_group(request, tenant_id: str, group_id: str): +def update_permissions_from_group(request, tenant_id: str, permission_group_id: str): """ 更新当前分组的权限列表,TODO """ return {} @api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/select_permissions/", tags=[_("权限分组")]) -def get_select_permissions(request, tenant_id: str, group_id: str): +def get_select_permissions(request, tenant_id: str, permission_group_id: str): """ 获取所有权限并附加是否在当前分组的状态,TODO """ return {} diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index 53210ea1e..b8775eec9 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -1,20 +1,22 @@ from typing import List -from ninja import ModelSchema, Query, Schema +from ninja import Field, ModelSchema, Query, Schema from arkid.core.api import api, operation from arkid.core.models import Tenant from arkid.core.translation import gettext_default as _ class TenantListQueryIn(Schema): - pass + name:str = Field( + default=None, + ) class TenantListOut(ModelSchema): class Config: model = Tenant - model_fields = ["name", "slug", "icon"] + model_fields = ["id","name", "slug", "icon"] @api.get("/tenants/", response=List[TenantListOut],tags=[_("租户管理")],auth=None) -@operation(List[TenantListOut]) -def get_tenant_list(request,query_data:TenantListQueryIn=Query(...)): +# @operation(List[TenantListOut]) +def get_tenant_list(request, query_data:TenantListQueryIn=Query(...)): """ 获取租户列表 """ @@ -28,7 +30,7 @@ class TenantQueryIn(Schema): class TenantOut(ModelSchema): class Config: model = Tenant - model_fields = ["name"] + model_fields = ["id","name"] @api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")]) @operation(TenantOut) @@ -41,28 +43,24 @@ def get_tenant(request, id: str, query_data:TenantQueryIn=Query(...), auth=None) class TenantCreateIn(ModelSchema): class Config: model = Tenant - model_fields = ["name"] + model_fields = ["id","name","slug","icon"] -class TenantCreateQueryIn(Schema): - pass - class TenantCreateOut(Schema): pass @api.post("/tenants/",response=TenantCreateOut,tags=[_("租户管理")],auth=None) -@operation(TenantCreateOut) -def create_tenant(request, tenant_id: str,data:TenantCreateIn,query_data:TenantCreateQueryIn=Query(...)): +def create_tenant(request, data:TenantCreateIn): """ 创建租户 """ - tenant = Tenant.valid_objects.create(**data) + tenant = Tenant.valid_objects.create(**data.dict()) return {} class TenantUpdateIn(ModelSchema): class Config: model = Tenant - model_fields = ["name","slug","icon"] + model_fields = ["id","name","slug","icon"] class TenantUpdateQueryIn(Schema): pass From 02dae7f1cbfa4ead5ed982326cbca1e0c0be10af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 08:27:47 +0000 Subject: [PATCH 27/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20switch=5Ftenant?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/mine/switch_tenant.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/v1/pages/mine/switch_tenant.py b/api/v1/pages/mine/switch_tenant.py index c292ba521..06896f177 100644 --- a/api/v1/pages/mine/switch_tenant.py +++ b/api/v1/pages/mine/switch_tenant.py @@ -14,6 +14,7 @@ router = routers.FrontRouter( path=tag, name=name, + page=page ) page.create_actions( From 1c9a8c7e3ab87baf8c46faa2488b23603fb43e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 09:05:45 +0000 Subject: [PATCH 28/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?tenant=5Fswitch=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/mine.py | 6 +- templates/switch_tenant.html | 117 +++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 templates/switch_tenant.html diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index 606ae5d88..9fdd7e60c 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -48,14 +48,14 @@ def get_mine_approves(request, tenant_id: str): """ return [] -@api.get("/mine/switch_tenant/{tenant_id}/",tags=[_("我的")]) +@api.get("/mine/switch_tenant/{tenant_id}/",tags=[_("我的")],auth=None) def get_mine_switch_tenant(request,tenant_id): """ 租户开关,TODO """ context = {} - slug = "" + tenant = Tenant.active_objects.get(id=tenant_id) context['tenant_id'] = tenant_id - context['slug'] = slug + context['slug'] = tenant.slug return render(request,template_name='switch_tenant.html', context=context) diff --git a/templates/switch_tenant.html b/templates/switch_tenant.html new file mode 100644 index 000000000..151dabedb --- /dev/null +++ b/templates/switch_tenant.html @@ -0,0 +1,117 @@ + + + + + + + Document + + + +
+
+ +
+
+ + + From 3f0ad5c89ab400549a016a212e580d0e392195aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 09:21:20 +0000 Subject: [PATCH 29/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/charts_manage/__init__.py | 5 +++-- api/v1/pages/charts_manage/charts.py | 16 ++++++++++++++++ arkid/settings.py | 1 - 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 api/v1/pages/charts_manage/charts.py diff --git a/api/v1/pages/charts_manage/__init__.py b/api/v1/pages/charts_manage/__init__.py index a5ee84f6a..972ac55eb 100644 --- a/api/v1/pages/charts_manage/__init__.py +++ b/api/v1/pages/charts_manage/__init__.py @@ -1,11 +1,12 @@ # 图表展示 from arkid.core import routers -from . import bi_systems +from . import bi_systems,charts router = routers.FrontRouter( path='charts', name='图表展示', children=[ - bi_systems.router + charts.router, + bi_systems.router, ] ) \ No newline at end of file diff --git a/api/v1/pages/charts_manage/charts.py b/api/v1/pages/charts_manage/charts.py new file mode 100644 index 000000000..4c117a350 --- /dev/null +++ b/api/v1/pages/charts_manage/charts.py @@ -0,0 +1,16 @@ +from arkid.core import routers, pages, actions +from arkid.core.translation import gettext_default as _ + +tag = 'charts' +name = '图表分析' + + +page = pages.DescriptionPage(tag=tag, name=name) + +pages.register_front_pages(page) + +router = routers.FrontRouter( + path=tag, + name=name, + page=page, +) \ No newline at end of file diff --git a/arkid/settings.py b/arkid/settings.py index a344ba9eb..842e817d5 100644 --- a/arkid/settings.py +++ b/arkid/settings.py @@ -149,5 +149,4 @@ ] LOCALE_PATHS = [ - # '/home/guancy/longgui/arkid/extension_root/com_longgui_international_en_us/locale' ] \ No newline at end of file From 4282fd52c7f22b8f5bec4c4478320168353b21b7 Mon Sep 17 00:00:00 2001 From: wely Date: Wed, 27 Apr 2022 18:05:21 +0800 Subject: [PATCH 30/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20=E8=B4=A6=E5=8F=B7=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=20?= =?UTF-8?q?=E7=9A=84tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/account_life.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/v1/views/account_life.py b/api/v1/views/account_life.py index 56a07fd55..14c09fb95 100644 --- a/api/v1/views/account_life.py +++ b/api/v1/views/account_life.py @@ -8,25 +8,25 @@ def get_account_life_list(request, tenant_id: str): """ return [] -@api.get("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +@api.get("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) def get_account_life(request, tenant_id: str, id: str): """ 获取账号生命周期配置,TODO """ return {} -@api.post("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期配置")]) +@api.post("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期")]) def create_account_life(request, tenant_id: str): """ 创建账号生命周期配置,TODO """ return {} -@api.put("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +@api.put("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) def update_account_life(request, tenant_id: str, id: str): """ 编辑账号生命周期配置,TODO """ return {} -@api.delete("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期配置")]) +@api.delete("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) def delete_account_life(request, tenant_id: str, id: str): """ 删除账号生命周期配置,TODO """ From ce422b8607e31495611209fe2bdefc7b8e673f4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 10:59:55 +0000 Subject: [PATCH 31/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E7=A7=9F=E6=88=B7=E9=A1=B5=E9=9D=A2=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/mine/switch_tenant.py | 4 ++-- api/v1/views/mine.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v1/pages/mine/switch_tenant.py b/api/v1/pages/mine/switch_tenant.py index 06896f177..c97f43096 100644 --- a/api/v1/pages/mine/switch_tenant.py +++ b/api/v1/pages/mine/switch_tenant.py @@ -23,8 +23,8 @@ method=actions.FrontActionMethod.GET ), node_actions=[ - actions.DirectAction( - path='/api/v1/mine/switch_tenant/{tenant_id}/', + actions.URLAction( + path='/api/v1/mine/switch_tenant/{id}/', method=actions.FrontActionMethod.GET ) ] diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index 9fdd7e60c..4029d64ad 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -48,7 +48,7 @@ def get_mine_approves(request, tenant_id: str): """ return [] -@api.get("/mine/switch_tenant/{tenant_id}/",tags=[_("我的")],auth=None) +@api.get("/mine/switch_tenant/{id}/",tags=[_("我的")],auth=None) def get_mine_switch_tenant(request,tenant_id): """ 租户开关,TODO """ From 07bcf461340f826936e879b3aff4a342b5c7cd3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 11:03:40 +0000 Subject: [PATCH 32/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20switch=5Ftenant?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=E5=90=8D=E7=A7=B0=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/mine.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index 4029d64ad..d47d5eec0 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -49,12 +49,12 @@ def get_mine_approves(request, tenant_id: str): return [] @api.get("/mine/switch_tenant/{id}/",tags=[_("我的")],auth=None) -def get_mine_switch_tenant(request,tenant_id): +def get_mine_switch_tenant(request,id): """ 租户开关,TODO """ context = {} - tenant = Tenant.active_objects.get(id=tenant_id) - context['tenant_id'] = tenant_id + tenant = Tenant.active_objects.get(id=id) + context['tenant_id'] = id context['slug'] = tenant.slug return render(request,template_name='switch_tenant.html', context=context) From 49efd3f26295dc314729a694333c8aff99956d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Wed, 27 Apr 2022 11:17:47 +0000 Subject: [PATCH 33/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?APIdoc=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arkid/settings.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arkid/settings.py b/arkid/settings.py index 842e817d5..24654c82e 100644 --- a/arkid/settings.py +++ b/arkid/settings.py @@ -38,12 +38,14 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'corsheaders', 'oauth2_provider', 'arkid.core', 'arkid.extension', ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', @@ -149,4 +151,19 @@ ] LOCALE_PATHS = [ -] \ No newline at end of file +] + +X_FRAME_OPTIONS = 'ALLOWALL' + +# CORS +CORS_ORIGIN_ALLOW_ALL = True +CORS_ALLOW_CREDENTIALS = True + +CORS_ALLOW_METHODS = ( + 'GET', + 'POST', + 'PUT', + 'PATCH', + 'DELETE', + 'OPTIONS', +) From ef868d2612fa5b5759c6e8eab587c1dd94bee938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 01:47:04 +0000 Subject: [PATCH 34/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/tenant.py | 20 +++++++------------- api/v1/views/user.py | 16 +++++++++------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index b8775eec9..c07912d36 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -24,17 +24,14 @@ def get_tenant_list(request, query_data:TenantListQueryIn=Query(...)): return tenants -class TenantQueryIn(Schema): - pass - class TenantOut(ModelSchema): class Config: model = Tenant model_fields = ["id","name"] -@api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")]) +@api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")],auth=None) @operation(TenantOut) -def get_tenant(request, id: str, query_data:TenantQueryIn=Query(...), auth=None): +def get_tenant(request, id: str): """ 获取租户 """ tenant = Tenant.active_objects.get(id=id) @@ -43,7 +40,7 @@ def get_tenant(request, id: str, query_data:TenantQueryIn=Query(...), auth=None) class TenantCreateIn(ModelSchema): class Config: model = Tenant - model_fields = ["id","name","slug","icon"] + model_fields = ["name","slug","icon"] class TenantCreateOut(Schema): pass @@ -60,21 +57,18 @@ def create_tenant(request, data:TenantCreateIn): class TenantUpdateIn(ModelSchema): class Config: model = Tenant - model_fields = ["id","name","slug","icon"] - -class TenantUpdateQueryIn(Schema): - pass + model_fields = ["name"] class TenantUpdateOut(Schema): pass -@api.put("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")],auth=None) +@api.post("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")],auth=None) @operation(TenantUpdateOut) -def update_tenant(request, id: str,data:TenantUpdateIn,query_data:TenantUpdateQueryIn=Query(...)): +def update_tenant(request, id: str, data:TenantUpdateIn): """ 编辑租户 """ tenant = Tenant.active_objects.get(id=id) - tenant.update(**data) + tenant.update(**data.dict()) return {} class TenantDeleteQueryIn(Schema): diff --git a/api/v1/views/user.py b/api/v1/views/user.py index 8eb248fe5..19d5abc8f 100644 --- a/api/v1/views/user.py +++ b/api/v1/views/user.py @@ -11,18 +11,20 @@ # ------------- 用户列表接口 -------------- -class UserListInSchema(Schema): - pass +class UserListQueryIn(Schema): + name:str = Field( + default=None + ) -class UserListOutSchema(ModelSchema): +class UserListOut(ModelSchema): class Config: model = User model_fields = ['id', 'username', 'avatar', 'is_platform_user'] -@api.get("/tenant/{tenant_id}/users/",response=List[UserListOutSchema], tags=['用户'], auth=None) -@operation(List[UserListOutSchema]) -def user_list(request, tenant_id: str, data: UserListInSchema=Query(...)): - users = User.expand_objects.filter(tenant__id=tenant_id).all() +@api.get("/tenant/{tenant_id}/users/",response=List[UserListOut], tags=['用户'], auth=None) +@operation(List[UserListOut]) +def user_list(request, tenant_id: str, query_data: UserListQueryIn=Query(...)): + users = User.expand_objects.all() return users # ------------- 创建用户接口 -------------- From 1918be377da94ef9a37b5022ba5692fbd7a6a64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 01:51:36 +0000 Subject: [PATCH 35/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E8=B7=AF=E5=BE=84=E5=89=8D?= =?UTF-8?q?=E7=BC=80=20/tenant/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/app.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/v1/views/app.py b/api/v1/views/app.py index 0f3049057..14f3f4849 100644 --- a/api/v1/views/app.py +++ b/api/v1/views/app.py @@ -51,7 +51,7 @@ class Config: @transaction.atomic -@api.post("/{tenant_id}/apps/", response=AppConfigSchemaOut, tags=['应用'], auth=None) +@api.post("/tenant/{tenant_id}/apps/", response=AppConfigSchemaOut, tags=['应用'], auth=None) def create_app(request, tenant_id: str, data: AppConfigSchemaIn): ''' app创建 @@ -80,7 +80,7 @@ def create_app(request, tenant_id: str, data: AppConfigSchemaIn): break return {"app_id": app.id.hex} -@api.get("/{tenant_id}/apps/", response=List[AppListSchemaOut], tags=['应用'], auth=None) +@api.get("/tenant/{tenant_id}/apps/", response=List[AppListSchemaOut], tags=['应用'], auth=None) @paginate def list_apps(request, tenant_id: str): ''' @@ -91,7 +91,7 @@ def list_apps(request, tenant_id: str): ) return apps -@api.get("/{tenant_id}/apps/{app_id}/", response=AppSchemaOut, tags=['应用'], auth=None) +@api.get("/tenant/{tenant_id}/apps/{app_id}/", response=AppSchemaOut, tags=['应用'], auth=None) def get_app(request, tenant_id: str, app_id: str): ''' 获取app @@ -109,7 +109,7 @@ def get_app(request, tenant_id: str, app_id: str): } return result -@api.delete("/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) +@api.delete("/tenant/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) def delete_app(request, tenant_id: str, app_id: str): ''' 删除app @@ -123,7 +123,7 @@ def delete_app(request, tenant_id: str, app_id: str): app.delete() return {'error': ErrorCode.OK.value} -@api.put("/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) +@api.put("/tenant/{tenant_id}/apps/{app_id}/", tags=['应用'], auth=None) def update_app(request, tenant_id: str, app_id: str, data: AppConfigSchemaIn): ''' 修改app From 2a80da4f2b5734d47e8f21389ef5c924a7839d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 04:40:20 +0000 Subject: [PATCH 36/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=85=8D=E7=BD=AE=E4=B8=AD=E7=9A=84=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E5=92=8C=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 6 ++---- api/v1/pages/app_manage/app_list.py | 6 ++---- api/v1/pages/approve_manage/approve_action.py | 6 ++---- api/v1/pages/auth_manage/auth_factor.py | 6 ++---- api/v1/pages/auth_manage/auth_rules.py | 6 ++---- api/v1/pages/auth_manage/auto_auth.py | 6 ++---- api/v1/pages/auth_manage/third_auth.py | 6 ++---- api/v1/pages/charts_manage/bi_systems.py | 6 ++---- api/v1/pages/data_source_manage/permission_sync.py | 6 ++---- api/v1/pages/data_source_manage/scim_sync.py | 6 ++---- api/v1/pages/developer_manage/webhook.py | 6 ++---- api/v1/pages/log_manage/log_config.py | 3 +-- api/v1/pages/mine/grant_manage.py | 3 +-- api/v1/pages/mine/profile.py | 3 +-- api/v1/pages/permission_manage/grant_rules.py | 6 ++---- api/v1/pages/permission_manage/permission_group.py | 6 ++---- api/v1/pages/permission_manage/permission_list.py | 6 ++---- api/v1/pages/platform_admin/extension_admin.py | 6 ++---- api/v1/pages/platform_admin/tenant_admin.py | 9 +++------ api/v1/pages/tenant_manage/center_arkid.py | 2 -- api/v1/pages/tenant_manage/child_manager.py | 6 ++---- api/v1/pages/tenant_manage/extension_manage.py | 6 ++---- api/v1/pages/tenant_manage/tenant_config.py | 3 +-- api/v1/pages/user_manage/account_life.py | 6 ++---- api/v1/pages/user_manage/user_group.py | 6 ++---- api/v1/pages/user_manage/user_list.py | 6 ++---- 26 files changed, 47 insertions(+), 96 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index 1015df317..9ac253e5b 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -91,8 +91,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/app_groups/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -105,7 +104,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/app_groups/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/app_manage/app_list.py b/api/v1/pages/app_manage/app_list.py index b60c75c11..f44ff2847 100644 --- a/api/v1/pages/app_manage/app_list.py +++ b/api/v1/pages/app_manage/app_list.py @@ -47,8 +47,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -61,7 +60,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/apps/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/approve_manage/approve_action.py b/api/v1/pages/approve_manage/approve_action.py index 3d87f4e73..582f9e92a 100644 --- a/api/v1/pages/approve_manage/approve_action.py +++ b/api/v1/pages/approve_manage/approve_action.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/approve_actions/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/auth_manage/auth_factor.py b/api/v1/pages/auth_manage/auth_factor.py index 1f05a4f99..ea24d9ddb 100644 --- a/api/v1/pages/auth_manage/auth_factor.py +++ b/api/v1/pages/auth_manage/auth_factor.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_factors/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/auth_factors/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/auth_manage/auth_rules.py b/api/v1/pages/auth_manage/auth_rules.py index 88995361d..908fe4936 100644 --- a/api/v1/pages/auth_manage/auth_rules.py +++ b/api/v1/pages/auth_manage/auth_rules.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/auth_rules/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/auth_manage/auto_auth.py b/api/v1/pages/auth_manage/auto_auth.py index 07b9ae4c5..162d22aec 100644 --- a/api/v1/pages/auth_manage/auto_auth.py +++ b/api/v1/pages/auth_manage/auto_auth.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/auto_auths/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/auth_manage/third_auth.py b/api/v1/pages/auth_manage/third_auth.py index c16402fb8..002d3fec1 100644 --- a/api/v1/pages/auth_manage/third_auth.py +++ b/api/v1/pages/auth_manage/third_auth.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/third_auths/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/third_auths/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/charts_manage/bi_systems.py b/api/v1/pages/charts_manage/bi_systems.py index fbabda614..7672952e2 100644 --- a/api/v1/pages/charts_manage/bi_systems.py +++ b/api/v1/pages/charts_manage/bi_systems.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/bi_systems/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/bi_systems/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/data_source_manage/permission_sync.py b/api/v1/pages/data_source_manage/permission_sync.py index e8d9cc49b..62fae5f9b 100644 --- a/api/v1/pages/data_source_manage/permission_sync.py +++ b/api/v1/pages/data_source_manage/permission_sync.py @@ -51,8 +51,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -65,7 +64,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/permission_syncs/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/data_source_manage/scim_sync.py b/api/v1/pages/data_source_manage/scim_sync.py index a8207c613..c63318126 100644 --- a/api/v1/pages/data_source_manage/scim_sync.py +++ b/api/v1/pages/data_source_manage/scim_sync.py @@ -51,8 +51,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -65,7 +64,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/scim_syncs/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index d52b9df63..dd901dc81 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -56,8 +56,7 @@ ), global_actions = [ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -69,8 +68,7 @@ ), global_actions = [ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/log_manage/log_config.py b/api/v1/pages/log_manage/log_config.py index 0ebfbb04c..515da366b 100644 --- a/api/v1/pages/log_manage/log_config.py +++ b/api/v1/pages/log_manage/log_config.py @@ -20,7 +20,6 @@ ), global_actions = [ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/log_config/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) \ No newline at end of file diff --git a/api/v1/pages/mine/grant_manage.py b/api/v1/pages/mine/grant_manage.py index 5d96ded5c..2c5d15edc 100644 --- a/api/v1/pages/mine/grant_manage.py +++ b/api/v1/pages/mine/grant_manage.py @@ -47,7 +47,6 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/mine/tenant/{tenant_id}/permissions/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) \ No newline at end of file diff --git a/api/v1/pages/mine/profile.py b/api/v1/pages/mine/profile.py index ad7579814..7caed3bd3 100644 --- a/api/v1/pages/mine/profile.py +++ b/api/v1/pages/mine/profile.py @@ -23,7 +23,6 @@ ), global_actions = [ actions.ConfirmAction(path="/mine/tenant/{tenant_id}/profile/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_rules.py b/api/v1/pages/permission_manage/grant_rules.py index 8ccee163e..75afae056 100644 --- a/api/v1/pages/permission_manage/grant_rules.py +++ b/api/v1/pages/permission_manage/grant_rules.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_rules/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/permission_rules/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index f62ff67d4..75b8998d1 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -91,8 +91,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_groups/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -105,7 +104,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/permission_groups/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/permission_manage/permission_list.py b/api/v1/pages/permission_manage/permission_list.py index 4e91fedf8..89e1bbb78 100644 --- a/api/v1/pages/permission_manage/permission_list.py +++ b/api/v1/pages/permission_manage/permission_list.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permissions/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/permissions/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/platform_admin/extension_admin.py b/api/v1/pages/platform_admin/extension_admin.py index 8525d6111..91769160e 100644 --- a/api/v1/pages/platform_admin/extension_admin.py +++ b/api/v1/pages/platform_admin/extension_admin.py @@ -47,8 +47,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/extensions/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -61,7 +60,6 @@ actions.ConfirmAction( path="/api/v1/extensions/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/platform_admin/tenant_admin.py b/api/v1/pages/platform_admin/tenant_admin.py index 31691f449..6daa28a38 100644 --- a/api/v1/pages/platform_admin/tenant_admin.py +++ b/api/v1/pages/platform_admin/tenant_admin.py @@ -37,8 +37,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/platform_config/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -69,8 +68,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenants/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -83,7 +81,6 @@ actions.ConfirmAction( path="/api/v1/tenants/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/tenant_manage/center_arkid.py b/api/v1/pages/tenant_manage/center_arkid.py index 3d7a1b11e..772ec9514 100644 --- a/api/v1/pages/tenant_manage/center_arkid.py +++ b/api/v1/pages/tenant_manage/center_arkid.py @@ -22,7 +22,5 @@ ), global_actions = [ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/center_arkid/"), - actions.CancelAction(), - actions.ResetAction(), ] ) \ No newline at end of file diff --git a/api/v1/pages/tenant_manage/child_manager.py b/api/v1/pages/tenant_manage/child_manager.py index 2e0e450b6..5e486eee4 100644 --- a/api/v1/pages/tenant_manage/child_manager.py +++ b/api/v1/pages/tenant_manage/child_manager.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/child_managers/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/child_managers/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/tenant_manage/extension_manage.py b/api/v1/pages/tenant_manage/extension_manage.py index 87634276a..0940ca304 100644 --- a/api/v1/pages/tenant_manage/extension_manage.py +++ b/api/v1/pages/tenant_manage/extension_manage.py @@ -47,8 +47,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/extensions/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -61,7 +60,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/extensions/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/tenant_manage/tenant_config.py b/api/v1/pages/tenant_manage/tenant_config.py index 0fafc3d69..c762d5640 100644 --- a/api/v1/pages/tenant_manage/tenant_config.py +++ b/api/v1/pages/tenant_manage/tenant_config.py @@ -20,7 +20,6 @@ ), global_actions = [ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/tenant_config/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) \ No newline at end of file diff --git a/api/v1/pages/user_manage/account_life.py b/api/v1/pages/user_manage/account_life.py index 9e36a4c7a..a83184df8 100644 --- a/api/v1/pages/user_manage/account_life.py +++ b/api/v1/pages/user_manage/account_life.py @@ -46,8 +46,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/account_lifes/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -60,7 +59,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/account_lifes/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index 0e99b9727..a646a6ae8 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -91,8 +91,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/user_groups/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -105,7 +104,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/user_groups/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index 0ff231875..1c6dac7ba 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -47,8 +47,7 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/users/{id}/"), - actions.CancelAction(), - actions.ResetAction(), + ] ) @@ -61,7 +60,6 @@ actions.ConfirmAction( path="/api/v1/tenant/{tenant_id}/users/", ), - actions.CancelAction(), - actions.ResetAction(), + ] ) From ab1d89d22155cc3541e32b6411da85b2738b56d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 06:23:57 +0000 Subject: [PATCH 37/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20create=20action?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=B7=BB=E5=8A=A0Page=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 17 +---------------- api/v1/pages/app_manage/app_list.py | 18 +----------------- api/v1/pages/approve_manage/approve_action.py | 17 +++-------------- api/v1/pages/auth_manage/auth_factor.py | 17 +++-------------- api/v1/pages/auth_manage/auth_rules.py | 17 +++-------------- api/v1/pages/auth_manage/auto_auth.py | 17 +++-------------- api/v1/pages/auth_manage/third_auth.py | 17 +++-------------- api/v1/pages/charts_manage/bi_systems.py | 17 +++-------------- .../data_source_manage/permission_sync.py | 17 +++-------------- api/v1/pages/data_source_manage/scim_sync.py | 17 +++-------------- api/v1/pages/developer_manage/webhook.py | 4 ++-- api/v1/pages/permission_manage/grant_rules.py | 17 +++-------------- .../permission_manage/permission_group.py | 17 +++-------------- .../pages/permission_manage/permission_list.py | 17 +++-------------- api/v1/pages/platform_admin/extension_admin.py | 17 +++-------------- api/v1/pages/platform_admin/tenant_admin.py | 17 +++-------------- api/v1/pages/tenant_manage/child_manager.py | 17 +++-------------- api/v1/pages/tenant_manage/extension_manage.py | 17 +++-------------- api/v1/pages/user_manage/account_life.py | 17 +++-------------- api/v1/pages/user_manage/user_group.py | 17 +++-------------- api/v1/pages/user_manage/user_list.py | 17 +++-------------- arkid/core/actions.py | 6 ++++-- 22 files changed, 62 insertions(+), 289 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index 9ac253e5b..b7614a018 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -8,14 +8,12 @@ page = pages.TreePage(tag=tag,name=name) group_apps_page = pages.TablePage(name=_("组内应用")) edit_apps_page = pages.TablePage(name=_("更新组内应用")) -create_page = pages.FormPage(name=_("创建应用分组")) edit_page = pages.FormPage(name=_("编辑应用分组")) pages.register_front_pages(page) pages.register_front_pages(group_apps_page) pages.register_front_pages(edit_apps_page) -pages.register_front_pages(create_page) pages.register_front_pages(edit_page) router = routers.FrontRouter( @@ -31,7 +29,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/app_groups/' ) ], local_actions=[ @@ -94,16 +92,3 @@ ] ) - -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/app_groups/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/app_groups/", - ), - - ] -) diff --git a/api/v1/pages/app_manage/app_list.py b/api/v1/pages/app_manage/app_list.py index f44ff2847..e2cc8a3c4 100644 --- a/api/v1/pages/app_manage/app_list.py +++ b/api/v1/pages/app_manage/app_list.py @@ -7,11 +7,9 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑应用")) -create_page = pages.FormPage(name=_("创建一个新的应用")) pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) router = routers.FrontRouter( path=tag, @@ -27,7 +25,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/apps/' ) ], local_actions=[ @@ -47,19 +45,5 @@ ), global_actions=[ actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), - - ] -) - -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/apps/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/apps/", - ), - ] ) diff --git a/api/v1/pages/approve_manage/approve_action.py b/api/v1/pages/approve_manage/approve_action.py index 582f9e92a..c6c1fb2e4 100644 --- a/api/v1/pages/approve_manage/approve_action.py +++ b/api/v1/pages/approve_manage/approve_action.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑审批动作")) -create_page = pages.FormPage(name=_("创建一个新的审批动作")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/approve_actions/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/approve_actions/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/approve_actions/", - ), - ] -) diff --git a/api/v1/pages/auth_manage/auth_factor.py b/api/v1/pages/auth_manage/auth_factor.py index ea24d9ddb..575d57b17 100644 --- a/api/v1/pages/auth_manage/auth_factor.py +++ b/api/v1/pages/auth_manage/auth_factor.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑认证因素")) -create_page = pages.FormPage(name=_("创建一个新的认证因素")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/auth_factors/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/auth_factors/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/auth_factors/", - ), - ] -) diff --git a/api/v1/pages/auth_manage/auth_rules.py b/api/v1/pages/auth_manage/auth_rules.py index 908fe4936..88e271a0e 100644 --- a/api/v1/pages/auth_manage/auth_rules.py +++ b/api/v1/pages/auth_manage/auth_rules.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑认证规则")) -create_page = pages.FormPage(name=_("创建一个新的认证规则")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/auth_rules/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/auth_rules/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/auth_rules/", - ), - ] -) diff --git a/api/v1/pages/auth_manage/auto_auth.py b/api/v1/pages/auth_manage/auto_auth.py index 162d22aec..45afc554a 100644 --- a/api/v1/pages/auth_manage/auto_auth.py +++ b/api/v1/pages/auth_manage/auto_auth.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑自动认证")) -create_page = pages.FormPage(name=_("创建一个新的自动认证")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/auto_auths/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/auto_auths/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/auto_auths/", - ), - ] -) diff --git a/api/v1/pages/auth_manage/third_auth.py b/api/v1/pages/auth_manage/third_auth.py index 002d3fec1..1090aea69 100644 --- a/api/v1/pages/auth_manage/third_auth.py +++ b/api/v1/pages/auth_manage/third_auth.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑第三方认证")) -create_page = pages.FormPage(name=_("创建一个新的第三方认证")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/third_auths/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/third_auths/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/third_auths/", - ), - ] -) diff --git a/api/v1/pages/charts_manage/bi_systems.py b/api/v1/pages/charts_manage/bi_systems.py index 7672952e2..66cdd71e4 100644 --- a/api/v1/pages/charts_manage/bi_systems.py +++ b/api/v1/pages/charts_manage/bi_systems.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑BI系统")) -create_page = pages.FormPage(name=_("创建一个新的BI系统")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/bi_systems/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/bi_systems/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/bi_systems/", - ), - ] -) diff --git a/api/v1/pages/data_source_manage/permission_sync.py b/api/v1/pages/data_source_manage/permission_sync.py index 62fae5f9b..269136e0a 100644 --- a/api/v1/pages/data_source_manage/permission_sync.py +++ b/api/v1/pages/data_source_manage/permission_sync.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑权限同步配置")) -create_page = pages.FormPage(name=_("创建一个新的权限同步配置")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/permission_syncs/', ) ], local_actions=[ @@ -55,15 +55,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permission_syncs/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/permission_syncs/", - ), - ] -) diff --git a/api/v1/pages/data_source_manage/scim_sync.py b/api/v1/pages/data_source_manage/scim_sync.py index c63318126..a3b7ee0be 100644 --- a/api/v1/pages/data_source_manage/scim_sync.py +++ b/api/v1/pages/data_source_manage/scim_sync.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑用户/群组数据同步配置")) -create_page = pages.FormPage(name=_("创建一个新的用户/群组数据同步配置")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/scim_syncs/', ) ], local_actions=[ @@ -55,15 +55,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/scim_syncs/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/scim_syncs/", - ), - ] -) diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index dd901dc81..f679ce73d 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -14,7 +14,7 @@ pages.register_front_pages(page) pages.register_front_pages(history_page) -pages.register_front_pages(create_page) + pages.register_front_pages(edit_page) pages.register_front_pages(history_detail_page) @@ -31,7 +31,7 @@ ), global_actions = [ actions.CreateAction( - page=create_page, + path=create_page, ) ], local_actions = [ diff --git a/api/v1/pages/permission_manage/grant_rules.py b/api/v1/pages/permission_manage/grant_rules.py index 75afae056..4ce84aa61 100644 --- a/api/v1/pages/permission_manage/grant_rules.py +++ b/api/v1/pages/permission_manage/grant_rules.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑授权规则")) -create_page = pages.FormPage(name=_("创建一个新的授权规则")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/permission_rules/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permission_rules/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/permission_rules/", - ), - ] -) diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index 75b8998d1..e8f6e9548 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -8,14 +8,14 @@ page = pages.TreePage(tag=tag,name=name) group_permissions_page = pages.TablePage(name=_("组内权限")) edit_permissions_page = pages.TablePage(name=_("更新组内权限")) -create_page = pages.FormPage(name=_("创建权限分组")) + edit_page = pages.FormPage(name=_("编辑权限分组")) pages.register_front_pages(page) pages.register_front_pages(group_permissions_page) pages.register_front_pages(edit_permissions_page) -pages.register_front_pages(create_page) + pages.register_front_pages(edit_page) router = routers.FrontRouter( @@ -31,7 +31,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/permission_groups/', ) ], local_actions=[ @@ -95,15 +95,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permission_groups/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/permission_groups/", - ), - ] -) diff --git a/api/v1/pages/permission_manage/permission_list.py b/api/v1/pages/permission_manage/permission_list.py index 89e1bbb78..e9a5bf06e 100644 --- a/api/v1/pages/permission_manage/permission_list.py +++ b/api/v1/pages/permission_manage/permission_list.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑权限")) -create_page = pages.FormPage(name=_("创建一个新的权限")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/permissions/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/permissions/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/permissions/", - ), - ] -) diff --git a/api/v1/pages/platform_admin/extension_admin.py b/api/v1/pages/platform_admin/extension_admin.py index 91769160e..2d2e0d471 100644 --- a/api/v1/pages/platform_admin/extension_admin.py +++ b/api/v1/pages/platform_admin/extension_admin.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑插件")) -create_page = pages.FormPage(name=_("创建一个新的插件")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/extensions/', ) ], local_actions=[ @@ -51,15 +51,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/extensions/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/extensions/", - ), - ] -) diff --git a/api/v1/pages/platform_admin/tenant_admin.py b/api/v1/pages/platform_admin/tenant_admin.py index 6daa28a38..2c456cb28 100644 --- a/api/v1/pages/platform_admin/tenant_admin.py +++ b/api/v1/pages/platform_admin/tenant_admin.py @@ -9,13 +9,13 @@ platform_config_page = pages.FormPage(name=_("平台配置")) tenant_list_page = pages.TablePage(name=_("租户管理")) edit_page = pages.FormPage(name=_("编辑租户")) -create_page = pages.FormPage(name=_("创建一个新的租户")) + pages.register_front_pages(page) pages.register_front_pages(tenant_list_page) pages.register_front_pages(platform_config_page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -48,7 +48,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenants/', ) ], local_actions=[ @@ -72,15 +72,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenants/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenants/", - ), - ] -) diff --git a/api/v1/pages/tenant_manage/child_manager.py b/api/v1/pages/tenant_manage/child_manager.py index 5e486eee4..c1d9d9fd5 100644 --- a/api/v1/pages/tenant_manage/child_manager.py +++ b/api/v1/pages/tenant_manage/child_manager.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑子管理员")) -create_page = pages.FormPage(name=_("创建一个新的子管理员")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/child_managers/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/child_managers/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/child_managers/", - ), - ] -) diff --git a/api/v1/pages/tenant_manage/extension_manage.py b/api/v1/pages/tenant_manage/extension_manage.py index 0940ca304..40a7e0781 100644 --- a/api/v1/pages/tenant_manage/extension_manage.py +++ b/api/v1/pages/tenant_manage/extension_manage.py @@ -8,11 +8,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑插件")) -create_page = pages.FormPage(name=_("创建一个新的插件")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -27,7 +27,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/extensions/', ) ], local_actions=[ @@ -51,15 +51,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/extensions/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/extensions/", - ), - ] -) diff --git a/api/v1/pages/user_manage/account_life.py b/api/v1/pages/user_manage/account_life.py index a83184df8..f6992073b 100644 --- a/api/v1/pages/user_manage/account_life.py +++ b/api/v1/pages/user_manage/account_life.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑账号生命周期设置")) -create_page = pages.FormPage(name=_("创建一个新的账号生命周期设置")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -26,7 +26,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/account_lifes/', ) ], local_actions=[ @@ -50,15 +50,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/account_lifes/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/account_lifes/", - ), - ] -) diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index a646a6ae8..f6ef4f05d 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -8,14 +8,14 @@ page = pages.TreePage(tag=tag,name=name) group_users_page = pages.TablePage(name=_("组内用户")) edit_users_page = pages.TablePage(name=_("更新组内用户")) -create_page = pages.FormPage(name=_("创建用户分组")) + edit_page = pages.FormPage(name=_("编辑用户分组")) pages.register_front_pages(page) pages.register_front_pages(group_users_page) pages.register_front_pages(edit_users_page) -pages.register_front_pages(create_page) + pages.register_front_pages(edit_page) router = routers.FrontRouter( @@ -31,7 +31,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/user_groups/', ) ], local_actions=[ @@ -95,15 +95,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/user_groups/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/user_groups/", - ), - ] -) diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index 1c6dac7ba..6ddecf05e 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -7,11 +7,11 @@ page = pages.TablePage(tag=tag, name=name) edit_page = pages.FormPage(name=_("编辑用户")) -create_page = pages.FormPage(name=_("创建一个新的用户")) + pages.register_front_pages(page) pages.register_front_pages(edit_page) -pages.register_front_pages(create_page) + router = routers.FrontRouter( path=tag, @@ -27,7 +27,7 @@ ), global_actions=[ actions.CreateAction( - page=create_page, + path='/api/v1/tenant/{tenant_id}/users/', ) ], local_actions=[ @@ -51,15 +51,4 @@ ] ) -create_page.create_actions( - init_action=actions.DirectAction( - path='/api/v1/tenant/{tenant_id}/users/', - method=actions.FrontActionMethod.POST - ), - global_actions=[ - actions.ConfirmAction( - path="/api/v1/tenant/{tenant_id}/users/", - ), - ] -) diff --git a/arkid/core/actions.py b/arkid/core/actions.py index 4db6e0399..ff7bdd747 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -178,10 +178,12 @@ def __init__(self, path: str, *args, **kwargs): class CreateAction(OpenAction): - def __init__(self, page, *args, **kwargs): + def __init__(self, path: str, *args, **kwargs): self.name = _("创建") self.icon = "icon-create" - super().__init__(page=page, *args, **kwargs) + self.method = FrontActionMethod.POST.value + self.path = path + super().__init__(*args, **kwargs) class EditAction(OpenAction): From 569d42a7839549cbecf6060436863b312138bd38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 07:43:06 +0000 Subject: [PATCH 38/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20auth=3DNone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 1 - .../grant_manage/group_grant.py | 1 - .../grant_manage/user_grant.py | 1 - .../permission_manage/permission_group.py | 1 - api/v1/pages/user_manage/user_group.py | 1 - api/v1/views/account_life.py | 10 +++---- api/v1/views/app.py | 2 +- api/v1/views/app_group.py | 18 ++++++------- api/v1/views/app_protocol.py | 2 +- api/v1/views/approve_action.py | 10 +++---- api/v1/views/auth_fator.py | 6 ++--- api/v1/views/auth_rules.py | 10 +++---- api/v1/views/auto_auth.py | 10 +++---- api/v1/views/bi_system.py | 10 +++---- api/v1/views/center_arkid.py | 4 +-- api/v1/views/child_manager.py | 10 +++---- api/v1/views/devices.py | 2 +- api/v1/views/log.py | 10 +++---- api/v1/views/mine.py | 20 +++++++------- api/v1/views/permission.py | 10 +++---- api/v1/views/permission_group.py | 18 ++++++------- api/v1/views/permission_rule.py | 10 +++---- api/v1/views/permission_sync.py | 12 ++++----- api/v1/views/platform_config.py | 4 +-- api/v1/views/scim_sync.py | 12 ++++----- api/v1/views/tenant.py | 17 ++++++------ api/v1/views/tenant_extension.py | 6 ++--- api/v1/views/third_auth.py | 10 +++---- api/v1/views/user.py | 8 +++--- api/v1/views/user_group.py | 26 +++++++++---------- api/v1/views/webhook.py | 22 ++++++++-------- arkid/core/actions.py | 14 ---------- 32 files changed, 140 insertions(+), 158 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index b7614a018..97a2f1d91 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -77,7 +77,6 @@ actions.ConfirmAction( path="/tenant/{tenant_id}/app_groups/{app_group_id}/apps/" ), - actions.CancelAction() ] ) diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py index 2af371062..0a454268a 100644 --- a/api/v1/pages/permission_manage/grant_manage/group_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/group_grant.py @@ -52,6 +52,5 @@ actions.ConfirmAction( path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', ), - actions.CancelAction(), ] ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py index b24708b7e..a6779651a 100644 --- a/api/v1/pages/permission_manage/grant_manage/user_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/user_grant.py @@ -52,6 +52,5 @@ actions.ConfirmAction( path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', ), - actions.CancelAction(), ] ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index e8f6e9548..eb02ee709 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -79,7 +79,6 @@ actions.ConfirmAction( path="/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/" ), - actions.CancelAction() ] ) diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index f6ef4f05d..571910bfe 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -79,7 +79,6 @@ actions.ConfirmAction( path="/tenant/{tenant_id}/user_groups/{user_group_id}/users/" ), - actions.CancelAction() ] ) diff --git a/api/v1/views/account_life.py b/api/v1/views/account_life.py index 14c09fb95..962cdf798 100644 --- a/api/v1/views/account_life.py +++ b/api/v1/views/account_life.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期")]) +@api.get("/tenant/{tenant_id}/account_lifes/", tags=["账号生命周期"],auth=None) def get_account_life_list(request, tenant_id: str): """ 账号生命周期配置列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) +@api.get("/tenant/{tenant_id}/account_lifes/{id}/", tags=["账号生命周期"],auth=None) def get_account_life(request, tenant_id: str, id: str): """ 获取账号生命周期配置,TODO """ return {} -@api.post("/tenant/{tenant_id}/account_lifes/", tags=[_("账号生命周期")]) +@api.post("/tenant/{tenant_id}/account_lifes/", tags=["账号生命周期"],auth=None) def create_account_life(request, tenant_id: str): """ 创建账号生命周期配置,TODO """ return {} -@api.put("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) +@api.put("/tenant/{tenant_id}/account_lifes/{id}/", tags=["账号生命周期"],auth=None) def update_account_life(request, tenant_id: str, id: str): """ 编辑账号生命周期配置,TODO """ return {} -@api.delete("/tenant/{tenant_id}/account_lifes/{id}/", tags=[_("账号生命周期")]) +@api.delete("/tenant/{tenant_id}/account_lifes/{id}/", tags=["账号生命周期"],auth=None) def delete_account_life(request, tenant_id: str, id: str): """ 删除账号生命周期配置,TODO """ diff --git a/api/v1/views/app.py b/api/v1/views/app.py index 14f3f4849..6938ad35f 100644 --- a/api/v1/views/app.py +++ b/api/v1/views/app.py @@ -149,7 +149,7 @@ def update_app(request, tenant_id: str, app_id: str, data: AppConfigSchemaIn): break return {'error': ErrorCode.OK.value} -@api.get("/tenant/{tenant_id}/apps/{app_id}/permissions/",tags=[_("应用")]) +@api.get("/tenant/{tenant_id}/apps/{app_id}/permissions/",tags=["应用"],auth=None) def get_app_permissions(request, tenant_id: str,app_id:str): """ 应用权限列表,TODO """ diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index 3e084b45c..e2acb1258 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -15,7 +15,7 @@ class Config: model = AppGroup model_fields = ["name"] -@api.get("/tenant/{tenant_id}/app_groups/", response=List[AppGroupListOut],tags=[_("应用分组")]) +@api.get("/tenant/{tenant_id}/app_groups/", response=List[AppGroupListOut],tags=["应用分组"],auth=None) @operation(List[AppGroupListOut]) def get_app_groups(request, tenant_id: str, query_data: AppGroupListQueryIn=Query(...)): """ 应用分组列表,TODO @@ -31,7 +31,7 @@ class Config: model = AppGroup model_fields = ["name"] -@api.get("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupOut, tags=[_("应用分组")]) +@api.get("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupOut, tags=["应用分组"],auth=None) @operation(AppGroupOut) def get_app_group(request, tenant_id: str, id: str, query_data: AppGroupQueryIn=Query(...)): """ 获取应用分组,TODO @@ -49,7 +49,7 @@ class AppGroupCreateQueryIn(Schema): class AppGroupCreateOut(Schema): pass -@api.post("/tenant/{tenant_id}/app_groups/", response=AppGroupCreateOut, tags=[_("应用分组")],auth=None) +@api.post("/tenant/{tenant_id}/app_groups/", response=AppGroupCreateOut, tags=["应用分组"],auth=None) @operation(AppGroupCreateOut) def create_app_group(request, tenant_id: str, data: AppGroupCreateIn, query_data: AppGroupCreateQueryIn=Query(...)): """ 创建应用分组,TODO @@ -70,7 +70,7 @@ class AppGroupUpdateQueryIn(Schema): class AppGroupUpdateOut(Schema): pass -@api.put("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupUpdateOut,tags=[_("应用分组")]) +@api.put("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupUpdateOut,tags=["应用分组"],auth=None) @operation(AppGroupUpdateOut) def update_app_group(request, tenant_id: str, id: str,data: AppGroupUpdateIn, query_data: AppGroupUpdateQueryIn=Query(...)): """ 编辑应用分组,TODO @@ -83,7 +83,7 @@ class AppGroupDeleteQueryIn(Schema): class AppGroupDeleteOut(Schema): pass -@api.delete("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupDeleteOut, tags=[_("应用分组")]) +@api.delete("/tenant/{tenant_id}/app_groups/{id}/", response=AppGroupDeleteOut, tags=["应用分组"],auth=None) @operation(AppGroupDeleteOut) def delete_app_group(request, tenant_id: str, id: str,query_data: AppGroupDeleteQueryIn=Query(...)): """ 删除应用分组,TODO @@ -96,7 +96,7 @@ class GroupAppsQueryIn(Schema): class GroupAppsOut(Schema): pass -@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/",response=List[GroupAppsOut],tags=[_("应用分组")]) +@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/",response=List[GroupAppsOut],tags=["应用分组"],auth=None) @operation(List[GroupAppsOut]) def get_apps_from_group(request, tenant_id: str, app_group_id: str, query_data: GroupAppsQueryIn=Query(...)): """ 获取当前分组的应用列表,TODO @@ -109,7 +109,7 @@ class GroupAppRemoveQueryIn(Schema): class GroupAppRemoveOut(Schema): pass -@api.delete("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/",response=GroupAppRemoveOut, tags=[_("应用分组")]) +@api.delete("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/",response=GroupAppRemoveOut, tags=["应用分组"],auth=None) @operation(GroupAppRemoveOut) def remove_app_from_group(request, tenant_id: str, app_group_id: str,id:str, query_data: GroupAppRemoveQueryIn=Query(...)): """ 将应用移除出应用分组,TODO @@ -125,7 +125,7 @@ class GroupAppUpdateQueryIn(Schema): class GroupAppUpdateOut(Schema): pass -@api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", response=GroupAppUpdateOut,tags=[_("应用分组")]) +@api.post("/tenant/{tenant_id}/app_groups/{app_group_id}/apps/", response=GroupAppUpdateOut,tags=["应用分组"],auth=None) @operation(GroupAppUpdateOut) def update_apps_from_group(request, tenant_id: str, app_group_id: str,data: GroupAppUpdateIn, query_data: GroupAppUpdateQueryIn=Query(...)): """ 更新当前分组的应用列表,TODO @@ -138,7 +138,7 @@ class GroupAllAppQueryIn(Schema): class GroupAllAppOut(Schema): pass -@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/",response=List[GroupAllAppOut], tags=[_("应用分组")]) +@api.get("/tenant/{tenant_id}/app_groups/{app_group_id}/select_apps/",response=List[GroupAllAppOut], tags=["应用分组"],auth=None) @operation(List[GroupAllAppOut]) def get_select_apps(request, tenant_id: str, app_group_id: str, query_data: GroupAllAppQueryIn=Query(...)): """ 获取所有应用并附加是否在当前分组的状态,TODO diff --git a/api/v1/views/app_protocol.py b/api/v1/views/app_protocol.py index c7d8a4568..2ac85ebdb 100644 --- a/api/v1/views/app_protocol.py +++ b/api/v1/views/app_protocol.py @@ -2,7 +2,7 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/app_protocols/", tags=[_("应用协议")]) +@api.get("/tenant/{tenant_id}/app_protocols/", tags=["应用协议"],auth=None) def get_app_protocols(request, tenant_id: str): """ 应用协议列表,TODO """ diff --git a/api/v1/views/approve_action.py b/api/v1/views/approve_action.py index ea0819870..5d0c08d6f 100644 --- a/api/v1/views/approve_action.py +++ b/api/v1/views/approve_action.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/approve_actions/", tags=[_("审批动作")]) +@api.get("/tenant/{tenant_id}/approve_actions/", tags=["审批动作"],auth=None) def get_approve_actions(request, tenant_id: str): """ 审批动作列表,TODO """ return [] -@api.get(operation_id="",path="/tenant/{tenant_id}/approve_actions/{id}/", tags=[_("审批动作")]) +@api.get(operation_id="",path="/tenant/{tenant_id}/approve_actions/{id}/", tags=["审批动作"],auth=None) def get_approve_action(request, tenant_id: str, id: str): """ 获取审批动作,TODO """ return {} -@api.post("/tenant/{tenant_id}/approve_actions/", tags=[_("审批动作")]) +@api.post("/tenant/{tenant_id}/approve_actions/", tags=["审批动作"],auth=None) def create_approve_action(request, tenant_id: str): """ 创建审批动作,TODO """ return {} -@api.put("/tenant/{tenant_id}/approve_actions/{id}/", tags=[_("审批动作")]) +@api.put("/tenant/{tenant_id}/approve_actions/{id}/", tags=["审批动作"],auth=None) def update_approve_action(request, tenant_id: str, id: str): """ 编辑审批动作,TODO """ return {} -@api.delete("/tenant/{tenant_id}/approve_actions/{id}/", tags=[_("审批动作")]) +@api.delete("/tenant/{tenant_id}/approve_actions/{id}/", tags=["审批动作"],auth=None) def delete_approve_action(request, tenant_id: str, id: str): """ 删除审批动作,TODO """ diff --git a/api/v1/views/auth_fator.py b/api/v1/views/auth_fator.py index 344e3353e..fc1b3b479 100644 --- a/api/v1/views/auth_fator.py +++ b/api/v1/views/auth_fator.py @@ -42,20 +42,20 @@ def get_auth_fator_list(request, tenant_id: str): configs = TenantExtensionConfig.active_objects.filter(extension__in=extensions) return {"data": configs} -@api.get("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +@api.get("/tenant/{tenant_id}/auth_fators/{id}/", tags=["认证因素"],auth=None) def get_auth_fator(request, tenant_id: str, id: str): """ 获取认证因素,TODO """ return {} -@api.put("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +@api.put("/tenant/{tenant_id}/auth_fators/{id}/", tags=["认证因素"],auth=None) def update_auth_fator(request, tenant_id: str, id: str): """ 编辑认证因素,TODO """ return {} -@api.delete("/tenant/{tenant_id}/auth_fators/{id}/", tags=[_("认证因素")]) +@api.delete("/tenant/{tenant_id}/auth_fators/{id}/", tags=["认证因素"],auth=None) def delete_auth_fator(request, tenant_id: str, id: str): """ 删除认证因素,TODO """ diff --git a/api/v1/views/auth_rules.py b/api/v1/views/auth_rules.py index 8df8771e5..cb5ca90ed 100644 --- a/api/v1/views/auth_rules.py +++ b/api/v1/views/auth_rules.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/auth_rules/", tags=[_("认证规则")]) +@api.get("/tenant/{tenant_id}/auth_rules/", tags=["认证规则"],auth=None) def get_auth_rules(request, tenant_id: str): """ 认证规则列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/auth_rules/{id}/", tags=[_("认证规则")]) +@api.get("/tenant/{tenant_id}/auth_rules/{id}/", tags=["认证规则"],auth=None) def get_auth_rule(request, tenant_id: str, id: str): """ 获取认证规则,TODO """ return {} -@api.post("/tenant/{tenant_id}/auth_rules/", tags=[_("认证规则")]) +@api.post("/tenant/{tenant_id}/auth_rules/", tags=["认证规则"],auth=None) def create_auth_rule(request, tenant_id: str): """ 创建认证规则,TODO """ return {} -@api.put("/tenant/{tenant_id}/auth_rules/{id}/", tags=[_("认证规则")]) +@api.put("/tenant/{tenant_id}/auth_rules/{id}/", tags=["认证规则"],auth=None) def update_auth_rule(request, tenant_id: str, id: str): """ 编辑认证规则,TODO """ return {} -@api.delete("/tenant/{tenant_id}/auth_rules/{id}/", tags=[_("认证规则")]) +@api.delete("/tenant/{tenant_id}/auth_rules/{id}/", tags=["认证规则"],auth=None) def delete_auth_rule(request, tenant_id: str, id: str): """ 删除认证规则,TODO """ diff --git a/api/v1/views/auto_auth.py b/api/v1/views/auto_auth.py index 854affcc4..a6077666b 100644 --- a/api/v1/views/auto_auth.py +++ b/api/v1/views/auto_auth.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/auto_auths/", tags=[_("自动认证")]) +@api.get("/tenant/{tenant_id}/auto_auths/", tags=["自动认证"],auth=None) def get_auto_auths(request, tenant_id: str): """ 自动认证列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/auto_auths/{id}/", tags=[_("自动认证")]) +@api.get("/tenant/{tenant_id}/auto_auths/{id}/", tags=["自动认证"],auth=None) def get_auto_auth(request, tenant_id: str, id: str): """ 获取自动认证,TODO """ return {} -@api.post("/tenant/{tenant_id}/auto_auths/", tags=[_("自动认证")]) +@api.post("/tenant/{tenant_id}/auto_auths/", tags=["自动认证"],auth=None) def create_auto_auth(request, tenant_id: str): """ 创建自动认证,TODO """ return {} -@api.put("/tenant/{tenant_id}/auto_auths/{id}/", tags=[_("自动认证")]) +@api.put("/tenant/{tenant_id}/auto_auths/{id}/", tags=["自动认证"],auth=None) def update_auto_auth(request, tenant_id: str, id: str): """ 编辑自动认证,TODO """ return {} -@api.delete("/tenant/{tenant_id}/auto_auths/{id}/", tags=[_("自动认证")]) +@api.delete("/tenant/{tenant_id}/auto_auths/{id}/", tags=["自动认证"],auth=None) def delete_auto_auth(request, tenant_id: str, id: str): """ 删除自动认证,TODO """ diff --git a/api/v1/views/bi_system.py b/api/v1/views/bi_system.py index 833365832..e774ef92c 100644 --- a/api/v1/views/bi_system.py +++ b/api/v1/views/bi_system.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/bi_systems/", tags=[_("BI系统")]) +@api.get("/tenant/{tenant_id}/bi_systems/", tags=["BI系统"],auth=None) def get_bi_systems(request, tenant_id: str): """ BI系统列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +@api.get("/tenant/{tenant_id}/bi_systems/{id}/", tags=["BI系统"],auth=None) def get_bi_system(request, tenant_id: str, id: str): """ 获取BI系统,TODO """ return {} -@api.post("/tenant/{tenant_id}/bi_systems/", tags=[_("BI系统")]) +@api.post("/tenant/{tenant_id}/bi_systems/", tags=["BI系统"],auth=None) def create_bi_system(request, tenant_id: str): """ 创建BI系统,TODO """ return {} -@api.put("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +@api.put("/tenant/{tenant_id}/bi_systems/{id}/", tags=["BI系统"],auth=None) def update_bi_system(request, tenant_id: str, id: str): """ 编辑BI系统,TODO """ return {} -@api.delete("/tenant/{tenant_id}/bi_systems/{id}/", tags=[_("BI系统")]) +@api.delete("/tenant/{tenant_id}/bi_systems/{id}/", tags=["BI系统"],auth=None) def delete_bi_system(request, tenant_id: str, id: str): """ 删除BI系统,TODO """ diff --git a/api/v1/views/center_arkid.py b/api/v1/views/center_arkid.py index dd316eb29..2b1bc2bd8 100644 --- a/api/v1/views/center_arkid.py +++ b/api/v1/views/center_arkid.py @@ -1,13 +1,13 @@ from arkid.core.api import api from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/center_arkid/", tags=[_("中心平台")]) +@api.get("/tenant/{tenant_id}/center_arkid/", tags=["中心平台"],auth=None) def get_center_arkid(request, tenant_id: str): """ 获取中心平台配置,TODO """ return [] -@api.post("/tenant/{tenant_id}/center_arkid/", tags=[_("中心平台")]) +@api.post("/tenant/{tenant_id}/center_arkid/", tags=["中心平台"],auth=None) def update_center_arkid(request, tenant_id: str): """ 更新中心平台配置,TODO """ diff --git a/api/v1/views/child_manager.py b/api/v1/views/child_manager.py index 6b0cfad12..6781cfdcd 100644 --- a/api/v1/views/child_manager.py +++ b/api/v1/views/child_manager.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/child_managers/", tags=[_("子管理员")]) +@api.get("/tenant/{tenant_id}/child_managers/", tags=["子管理员"],auth=None) def get_child_managers(request, tenant_id: str): """ 子管理员列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +@api.get("/tenant/{tenant_id}/child_managers/{id}/", tags=["子管理员"],auth=None) def get_child_manager(request, tenant_id: str, id: str): """ 获取子管理员,TODO """ return {} -@api.post("/tenant/{tenant_id}/child_managers/", tags=[_("子管理员")]) +@api.post("/tenant/{tenant_id}/child_managers/", tags=["子管理员"],auth=None) def create_child_manager(request, tenant_id: str): """ 创建子管理员,TODO """ return {} -@api.put("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +@api.put("/tenant/{tenant_id}/child_managers/{id}/", tags=["子管理员"],auth=None) def update_child_manager(request, tenant_id: str, id: str): """ 编辑子管理员,TODO """ return {} -@api.delete("/tenant/{tenant_id}/child_managers/{id}/", tags=[_("子管理员")]) +@api.delete("/tenant/{tenant_id}/child_managers/{id}/", tags=["子管理员"],auth=None) def delete_child_manager(request, tenant_id: str, id: str): """ 删除子管理员,TODO """ diff --git a/api/v1/views/devices.py b/api/v1/views/devices.py index 5e0b7a93e..7cea05fa9 100644 --- a/api/v1/views/devices.py +++ b/api/v1/views/devices.py @@ -2,7 +2,7 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/devices/", tags=[_("设备管理")]) +@api.get("/tenant/{tenant_id}/devices/", tags=["设备管理"],auth=None) def get_device_list(request, tenant_id: str): """ 设备管理列表,TODO """ diff --git a/api/v1/views/log.py b/api/v1/views/log.py index 6c09c5fa3..7c1225d68 100644 --- a/api/v1/views/log.py +++ b/api/v1/views/log.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/manager_log/", tags=[_("日志管理")]) +@api.get("/tenant/{tenant_id}/manager_log/", tags=["日志管理"],auth=None) def get_manager_logs(request, tenant_id: str): """ 获取租户管理员行为日志,TODO """ return [] -@api.get("/tenant/{tenant_id}/user_log/", tags=[_("日志管理")]) +@api.get("/tenant/{tenant_id}/user_log/", tags=["日志管理"],auth=None) def get_user_logs(request, tenant_id: str): """ 获取用户行为日志,TODO """ return [] -@api.get("/tenant/{tenant_id}/log/{id}/", tags=[_("日志管理")]) +@api.get("/tenant/{tenant_id}/log/{id}/", tags=["日志管理"],auth=None) def get_log(request, tenant_id: str,id:str): """ 获取日志详情,TODO """ return {} -@api.get("/tenant/{tenant_id}/log_config/", tags=[_("日志管理")]) +@api.get("/tenant/{tenant_id}/log_config/", tags=["日志管理"],auth=None) def get_log_config(request, tenant_id: str): """ 获取日志配置,TODO """ return [] -@api.post("/tenant/{tenant_id}/log_config/", tags=[_("日志管理")]) +@api.post("/tenant/{tenant_id}/log_config/", tags=["日志管理"],auth=None) def update_log_config(request, tenant_id: str): """ 更新日志配置,TODO """ diff --git a/api/v1/views/mine.py b/api/v1/views/mine.py index d47d5eec0..81bed2710 100644 --- a/api/v1/views/mine.py +++ b/api/v1/views/mine.py @@ -6,49 +6,49 @@ from arkid.core.translation import gettext_default as _ -@api.get("/mine/tenant/{tenant_id}/apps/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/apps/",tags=["我的"],auth=None) def get_mine_apps(request, tenant_id: str): """ 我的应用列表,TODO """ return [] -@api.get("/mine/tenant/{tenant_id}/profile/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/profile/",tags=["我的"],auth=None) def get_mine_profile(request, tenant_id: str): """ 我的个人资料,TODO """ return {} -@api.post("/mine/tenant/{tenant_id}/profile/",tags=[_("我的")]) +@api.post("/mine/tenant/{tenant_id}/profile/",tags=["我的"],auth=None) def update_mine_profile(request, tenant_id: str): """ 更新我的个人资料,TODO """ return {} -@api.get("/mine/tenant/{tenant_id}/permissions/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/permissions/",tags=["我的"],auth=None) def get_mine_permissions(request, tenant_id: str): """ 我的权限列表,TODO """ return [] -@api.post("/mine/tenant/{tenant_id}/permissions/",tags=[_("我的")]) +@api.post("/mine/tenant/{tenant_id}/permissions/",tags=["我的"],auth=None) def update_mine_permissions(request, tenant_id: str): """ 更新我的权限列表,TODO """ return [] -@api.get("/mine/tenant/{tenant_id}/all_permissions/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/all_permissions/",tags=["我的"],auth=None) def get_mine_all_permissions(request, tenant_id: str): """ 获取所有权限并附带是否已授权给我的状态,TODO """ return [] -@api.get("/mine/tenant/{tenant_id}/approves/",tags=[_("我的")]) +@api.get("/mine/tenant/{tenant_id}/approves/",tags=["我的"],auth=None) def get_mine_approves(request, tenant_id: str): """ 我的审批列表,TODO """ return [] -@api.get("/mine/switch_tenant/{id}/",tags=[_("我的")],auth=None) +@api.get("/mine/switch_tenant/{id}/",tags=["我的"],auth=None) def get_mine_switch_tenant(request,id): """ 租户开关,TODO """ @@ -59,7 +59,7 @@ def get_mine_switch_tenant(request,id): return render(request,template_name='switch_tenant.html', context=context) -@api.get("/mine/logout/",tags=[_("我的")]) +@api.get("/mine/logout/",tags=["我的"],auth=None) def get_mine_logout(request): """ 退出登录,TODO """ @@ -70,7 +70,7 @@ class Config: model = Tenant model_fields=["id","name","slug","icon"] -@api.get("/mine/tenants/",response=List[MineTenantsOut],tags=[_("我的")],auth=None) +@api.get("/mine/tenants/",response=List[MineTenantsOut],tags=["我的"],auth=None) def get_mine_tenants(request): """ 获取我的租户,TODO """ diff --git a/api/v1/views/permission.py b/api/v1/views/permission.py index 22b435205..38a2f07f2 100644 --- a/api/v1/views/permission.py +++ b/api/v1/views/permission.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/permissions/", tags=[_("权限")]) +@api.get("/tenant/{tenant_id}/permissions/", tags=["权限"],auth=None) def get_permissions(request, tenant_id: str): """ 权限列表,TODO """ return [] -@api.get(operation_id="",path="/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +@api.get(operation_id="",path="/tenant/{tenant_id}/permissions/{id}/", tags=["权限"],auth=None) def get_permission(request, tenant_id: str, id: str): """ 获取权限,TODO """ return {} -@api.post("/tenant/{tenant_id}/permissions/", tags=[_("权限")]) +@api.post("/tenant/{tenant_id}/permissions/", tags=["权限"],auth=None) def create_permission(request, tenant_id: str): """ 创建权限,TODO """ return {} -@api.put("/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +@api.put("/tenant/{tenant_id}/permissions/{id}/", tags=["权限"],auth=None) def update_permission(request, tenant_id: str, id: str): """ 编辑权限,TODO """ return {} -@api.delete("/tenant/{tenant_id}/permissions/{id}/", tags=[_("权限")]) +@api.delete("/tenant/{tenant_id}/permissions/{id}/", tags=["权限"],auth=None) def delete_permission(request, tenant_id: str, id: str): """ 删除权限,TODO """ diff --git a/api/v1/views/permission_group.py b/api/v1/views/permission_group.py index 4116ef996..c9597b6ab 100644 --- a/api/v1/views/permission_group.py +++ b/api/v1/views/permission_group.py @@ -2,55 +2,55 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/permission_groups/", tags=[_("权限分组")]) +@api.get("/tenant/{tenant_id}/permission_groups/", tags=["权限分组"],auth=None) def get_permission_groups(request, tenant_id: str): """ 权限分组列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +@api.get("/tenant/{tenant_id}/permission_groups/{id}/", tags=["权限分组"],auth=None) def get_permission_group(request, tenant_id: str, id: str): """ 获取权限分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/permission_groups/", tags=[_("权限分组")]) +@api.post("/tenant/{tenant_id}/permission_groups/", tags=["权限分组"],auth=None) def create_permission_group(request, tenant_id: str): """ 创建权限分组,TODO """ return {} -@api.put("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +@api.put("/tenant/{tenant_id}/permission_groups/{id}/", tags=["权限分组"],auth=None) def update_permission_group(request, tenant_id: str, id: str): """ 编辑权限分组,TODO """ return {} -@api.delete("/tenant/{tenant_id}/permission_groups/{id}/", tags=[_("权限分组")]) +@api.delete("/tenant/{tenant_id}/permission_groups/{id}/", tags=["权限分组"],auth=None) def delete_permission_group(request, tenant_id: str, id: str): """ 删除权限分组,TODO """ return {} -@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) +@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=["权限分组"],auth=None) def get_permissions_from_group(request, tenant_id: str, permission_group_id: str): """ 获取当前分组的权限列表,TODO """ return {} -@api.delete("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/{id}/", tags=[_("权限分组")]) +@api.delete("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/{id}/", tags=["权限分组"],auth=None) def remove_permission_from_group(request, tenant_id: str, permission_group_id: str,id:str): """ 将权限移除出权限分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=[_("权限分组")]) +@api.post("/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/", tags=["权限分组"],auth=None) def update_permissions_from_group(request, tenant_id: str, permission_group_id: str): """ 更新当前分组的权限列表,TODO """ return {} -@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/select_permissions/", tags=[_("权限分组")]) +@api.get("/tenant/{tenant_id}/permission_groups/{permission_group_id}/select_permissions/", tags=["权限分组"],auth=None) def get_select_permissions(request, tenant_id: str, permission_group_id: str): """ 获取所有权限并附加是否在当前分组的状态,TODO """ diff --git a/api/v1/views/permission_rule.py b/api/v1/views/permission_rule.py index 08ba0c850..ee0660bae 100644 --- a/api/v1/views/permission_rule.py +++ b/api/v1/views/permission_rule.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/permission_rules/", tags=[_("授权规则")]) +@api.get("/tenant/{tenant_id}/permission_rules/", tags=["授权规则"],auth=None) def get_permission_rules(request, tenant_id: str): """ 授权规则列表,TODO """ return [] -@api.get(operation_id="",path="/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +@api.get(operation_id="",path="/tenant/{tenant_id}/permission_rules/{id}/", tags=["授权规则"],auth=None) def get_permission_rule(request, tenant_id: str, id: str): """ 获取授权规则,TODO """ return {} -@api.post("/tenant/{tenant_id}/permission_rules/", tags=[_("授权规则")]) +@api.post("/tenant/{tenant_id}/permission_rules/", tags=["授权规则"],auth=None) def create_permission_rule(request, tenant_id: str): """ 创建授权规则,TODO """ return {} -@api.put("/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +@api.put("/tenant/{tenant_id}/permission_rules/{id}/", tags=["授权规则"],auth=None) def update_permission_rule(request, tenant_id: str, id: str): """ 编辑授权规则,TODO """ return {} -@api.delete("/tenant/{tenant_id}/permission_rules/{id}/", tags=[_("授权规则")]) +@api.delete("/tenant/{tenant_id}/permission_rules/{id}/", tags=["授权规则"],auth=None) def delete_permission_rule(request, tenant_id: str, id: str): """ 删除授权规则,TODO """ diff --git a/api/v1/views/permission_sync.py b/api/v1/views/permission_sync.py index 8ca7ad1eb..aff0cdeab 100644 --- a/api/v1/views/permission_sync.py +++ b/api/v1/views/permission_sync.py @@ -2,37 +2,37 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/permission_syncs/", tags=[_("权限数据同步配置")]) +@api.get("/tenant/{tenant_id}/permission_syncs/", tags=["权限数据同步配置"],auth=None) def get_permission_syncs(request, tenant_id: str): """ 权限数据同步配置列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/permission_syncs/{id}/", tags=[_("权限数据同步配置")]) +@api.get("/tenant/{tenant_id}/permission_syncs/{id}/", tags=["权限数据同步配置"],auth=None) def get_permission_sync(request, tenant_id: str, id: str): """ 获取权限数据同步配置,TODO """ return {} -@api.post("/tenant/{tenant_id}/permission_syncs/", tags=[_("权限数据同步配置")]) +@api.post("/tenant/{tenant_id}/permission_syncs/", tags=["权限数据同步配置"],auth=None) def create_permission_sync(request, tenant_id: str): """ 创建权限数据同步配置,TODO """ return {} -@api.put("/tenant/{tenant_id}/permission_syncs/{id}/", tags=[_("权限数据同步配置")]) +@api.put("/tenant/{tenant_id}/permission_syncs/{id}/", tags=["权限数据同步配置"],auth=None) def update_permission_sync(request, tenant_id: str, id: str): """ 编辑权限数据同步配置,TODO """ return {} -@api.delete("/tenant/{tenant_id}/permission_syncs/{id}/", tags=[_("权限数据同步配置")]) +@api.delete("/tenant/{tenant_id}/permission_syncs/{id}/", tags=["权限数据同步配置"],auth=None) def delete_permission_sync(request, tenant_id: str, id: str): """ 删除权限数据同步配置,TODO """ return {} -@api.get("/tenant/{tenant_id}/permission_syncs/{id}/sync/", tags=[_("权限数据同步配置")]) +@api.get("/tenant/{tenant_id}/permission_syncs/{id}/sync/", tags=["权限数据同步配置"],auth=None) def permission_sync(request, tenant_id: str, id: str): """ 同步权限数据,TODO """ diff --git a/api/v1/views/platform_config.py b/api/v1/views/platform_config.py index bed65be98..1797a173e 100644 --- a/api/v1/views/platform_config.py +++ b/api/v1/views/platform_config.py @@ -1,13 +1,13 @@ from arkid.core.api import api from arkid.core.translation import gettext_default as _ -@api.get("/platform_config/", tags=[_("平台配置")]) +@api.get("/platform_config/", tags=["平台配置"],auth=None) def get_platform_config(request): """ 获取平台配置,TODO """ return {} -@api.post("/platform_config/", tags=[_("平台配置")]) +@api.post("/platform_config/", tags=["平台配置"],auth=None) def update_platform_config(request): """ 更新平台配置,TODO """ diff --git a/api/v1/views/scim_sync.py b/api/v1/views/scim_sync.py index b4a3141cb..a35a4b0d3 100644 --- a/api/v1/views/scim_sync.py +++ b/api/v1/views/scim_sync.py @@ -2,37 +2,37 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/scim_syncs/", tags=[_("用户数据同步配置")]) +@api.get("/tenant/{tenant_id}/scim_syncs/", tags=["用户数据同步配置"],auth=None) def get_scim_syncs(request, tenant_id: str): """ 用户数据同步配置列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/scim_syncs/{id}/", tags=[_("用户数据同步配置")]) +@api.get("/tenant/{tenant_id}/scim_syncs/{id}/", tags=["用户数据同步配置"],auth=None) def get_scim_sync(request, tenant_id: str, id: str): """ 获取用户数据同步配置,TODO """ return {} -@api.post("/tenant/{tenant_id}/scim_syncs/", tags=[_("用户数据同步配置")]) +@api.post("/tenant/{tenant_id}/scim_syncs/", tags=["用户数据同步配置"],auth=None) def create_scim_sync(request, tenant_id: str): """ 创建用户数据同步配置,TODO """ return {} -@api.put("/tenant/{tenant_id}/scim_syncs/{id}/", tags=[_("用户数据同步配置")]) +@api.put("/tenant/{tenant_id}/scim_syncs/{id}/", tags=["用户数据同步配置"],auth=None) def update_scim_sync(request, tenant_id: str, id: str): """ 编辑用户数据同步配置,TODO """ return {} -@api.delete("/tenant/{tenant_id}/scim_syncs/{id}/", tags=[_("用户数据同步配置")]) +@api.delete("/tenant/{tenant_id}/scim_syncs/{id}/", tags=["用户数据同步配置"],auth=None) def delete_scim_sync(request, tenant_id: str, id: str): """ 删除用户数据同步配置,TODO """ return {} -@api.get("/tenant/{tenant_id}/scim_syncs/{id}/sync/", tags=[_("用户数据同步配置")]) +@api.get("/tenant/{tenant_id}/scim_syncs/{id}/sync/", tags=["用户数据同步配置"],auth=None) def scim_sync(request, tenant_id: str, id: str): """ 同步权限数据,TODO """ diff --git a/api/v1/views/tenant.py b/api/v1/views/tenant.py index c07912d36..2b8cb1347 100644 --- a/api/v1/views/tenant.py +++ b/api/v1/views/tenant.py @@ -14,7 +14,7 @@ class Config: model = Tenant model_fields = ["id","name", "slug", "icon"] -@api.get("/tenants/", response=List[TenantListOut],tags=[_("租户管理")],auth=None) +@api.get("/tenants/", response=List[TenantListOut],tags=["租户管理"],auth=None) # @operation(List[TenantListOut]) def get_tenant_list(request, query_data:TenantListQueryIn=Query(...)): """ 获取租户列表 @@ -29,7 +29,7 @@ class Config: model = Tenant model_fields = ["id","name"] -@api.get("/tenants/{id}/", response=TenantOut,tags=[_("租户管理")],auth=None) +@api.get("/tenants/{id}/", response=TenantOut,tags=["租户管理"],auth=None) @operation(TenantOut) def get_tenant(request, id: str): """ 获取租户 @@ -45,7 +45,7 @@ class Config: class TenantCreateOut(Schema): pass -@api.post("/tenants/",response=TenantCreateOut,tags=[_("租户管理")],auth=None) +@api.post("/tenants/",response=TenantCreateOut,tags=["租户管理"],auth=None) def create_tenant(request, data:TenantCreateIn): """ 创建租户 """ @@ -62,13 +62,14 @@ class Config: class TenantUpdateOut(Schema): pass -@api.post("/tenants/{id}/", response=TenantUpdateOut,tags=[_("租户管理")],auth=None) +@api.post("/tenants/{id}/", response=TenantUpdateOut,tags=["租户管理"],auth=None) @operation(TenantUpdateOut) def update_tenant(request, id: str, data:TenantUpdateIn): """ 编辑租户 """ tenant = Tenant.active_objects.get(id=id) - tenant.update(**data.dict()) + tenant.name = data.dict().get("name") + tenant.save() return {} class TenantDeleteQueryIn(Schema): @@ -77,7 +78,7 @@ class TenantDeleteQueryIn(Schema): class TenantDeleteOut(Schema): pass -@api.delete("/tenants/{id}/", response=TenantDeleteOut, tags=[_("租户管理")],auth=None) +@api.delete("/tenants/{id}/", response=TenantDeleteOut, tags=["租户管理"],auth=None) @operation(TenantDeleteOut) def delete_tenant(request, id: str, query_data:TenantDeleteQueryIn=Query(...)): """ 删除租户 @@ -93,7 +94,7 @@ class TenantConfigQueryIn(Schema): class TenantConfigOut(Schema): pass -@api.get("/tenants/{id}/config/", response=TenantConfigOut, tags=[_("租户管理")],auth=None) +@api.get("/tenants/{id}/config/", response=TenantConfigOut, tags=["租户管理"],auth=None) @operation(TenantConfigOut) def get_tenant_config(request, id: str,query_data:TenantConfigQueryIn=Query(...)): """ 获取租户配置,TODO @@ -109,7 +110,7 @@ class TenantConfigUpdateIn(Schema): class TenantConfigUpdateOut(Schema): pass -@api.post("/tenants/{id}/config/", response=TenantConfigUpdateOut,tags=[_("租户管理")],auth=None) +@api.post("/tenants/{id}/config/", response=TenantConfigUpdateOut,tags=["租户管理"],auth=None) @operation(TenantConfigUpdateOut) def update_tenant_config(request, id: str,data:TenantConfigUpdateIn,query_data:TenantConfigUpdateQueryIn=Query(...)): """ 编辑租户配置,TODO diff --git a/api/v1/views/tenant_extension.py b/api/v1/views/tenant_extension.py index 95087fd61..dab791f55 100644 --- a/api/v1/views/tenant_extension.py +++ b/api/v1/views/tenant_extension.py @@ -104,19 +104,19 @@ def create_extension_settings(request, tenant_id: str, extension_id: str, data: # extension.delete() # return {"success": True} -@api.get("/tenant/{tenant_id}/extensions/", tags=[_("租户插件")]) +@api.get("/tenant/{tenant_id}/extensions/", tags=["租户插件"],auth=None) def get_extensions(request, tenant_id: str): """ 租户插件列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/extensions/{id}/", tags=[_("租户插件")]) +@api.get("/tenant/{tenant_id}/extensions/{id}/", tags=["租户插件"],auth=None) def get_extension(request, tenant_id: str, id: str): """ 获取租户插件,TODO """ return {} -@api.delete("/tenant/{tenant_id}/extensions/{id}/", tags=[_("租户插件")]) +@api.delete("/tenant/{tenant_id}/extensions/{id}/", tags=["租户插件"],auth=None) def delete_extension(request, tenant_id: str, id: str): """ 删除租户插件,TODO """ diff --git a/api/v1/views/third_auth.py b/api/v1/views/third_auth.py index e7174105b..0a943f368 100644 --- a/api/v1/views/third_auth.py +++ b/api/v1/views/third_auth.py @@ -2,31 +2,31 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/third_auths/", tags=[_("第三方认证")]) +@api.get("/tenant/{tenant_id}/third_auths/", tags=["第三方认证"],auth=None) def get_third_auths(request, tenant_id: str): """ 第三方认证列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/third_auths/{id}/", tags=[_("第三方认证")]) +@api.get("/tenant/{tenant_id}/third_auths/{id}/", tags=["第三方认证"],auth=None) def get_third_auth(request, tenant_id: str, id: str): """ 获取第三方认证,TODO """ return {} -@api.post("/tenant/{tenant_id}/third_auths/", tags=[_("第三方认证")]) +@api.post("/tenant/{tenant_id}/third_auths/", tags=["第三方认证"],auth=None) def create_third_auth(request, tenant_id: str): """ 创建第三方认证,TODO """ return {} -@api.put("/tenant/{tenant_id}/third_auths/{id}/", tags=[_("第三方认证")]) +@api.put("/tenant/{tenant_id}/third_auths/{id}/", tags=["第三方认证"],auth=None) def update_third_auth(request, tenant_id: str, id: str): """ 编辑第三方认证,TODO """ return {} -@api.delete("/tenant/{tenant_id}/third_auths/{id}/", tags=[_("第三方认证")]) +@api.delete("/tenant/{tenant_id}/third_auths/{id}/", tags=["第三方认证"],auth=None) def delete_third_auth(request, tenant_id: str, id: str): """ 删除第三方认证,TODO """ diff --git a/api/v1/views/user.py b/api/v1/views/user.py index 19d5abc8f..dec05f4ca 100644 --- a/api/v1/views/user.py +++ b/api/v1/views/user.py @@ -154,25 +154,25 @@ def user_list(request, tenant_id: str,id:str,data: UserInSchema=Query(...)): return user -@api.get("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=[_("用户")]) +@api.get("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=["用户"],auth=None) def get_user_permissions(request, tenant_id: str,user_id:str): """ 用户权限列表,TODO """ return [] -@api.post("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=[_("用户")]) +@api.post("/tenant/{tenant_id}/users/{user_id}/permissions/",tags=["用户"],auth=None) def update_user_permissions(request, tenant_id: str,user_id:str): """ 更新用户权限列表,TODO """ return [] -@api.delete("/tenant/{tenant_id}/users/{user_id}/permissions/{id}/",tags=[_("用户")]) +@api.delete("/tenant/{tenant_id}/users/{user_id}/permissions/{id}/",tags=["用户"],auth=None) def delete_user_permissions(request, tenant_id: str,user_id:str,id:str): """ 删除用户权限,TODO """ return [] -@api.get("/tenant/{tenant_id}/users/{user_id}/all_permissions/",tags=[_("用户")]) +@api.get("/tenant/{tenant_id}/users/{user_id}/all_permissions/",tags=["用户"],auth=None) def get_user_all_permissions(request, tenant_id: str,user_id:str): """ 获取所有权限并附带是否已授权给用户状态,TODO """ diff --git a/api/v1/views/user_group.py b/api/v1/views/user_group.py index f8ce86b34..876967e9b 100644 --- a/api/v1/views/user_group.py +++ b/api/v1/views/user_group.py @@ -1,79 +1,79 @@ from arkid.core.api import api from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/user_groups/", tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/", tags=["用户分组"],auth=None) def get_user_groups(request, tenant_id: str): """ 用户分组列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/{id}/", tags=["用户分组"],auth=None) def get_user_group(request, tenant_id: str, id: str): """ 获取用户分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/user_groups/", tags=[_("用户分组")]) +@api.post("/tenant/{tenant_id}/user_groups/", tags=["用户分组"],auth=None) def create_user_group(request, tenant_id: str): """ 创建用户分组,TODO """ return {} -@api.put("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +@api.put("/tenant/{tenant_id}/user_groups/{id}/", tags=["用户分组"],auth=None) def update_user_group(request, tenant_id: str, id: str): """ 编辑用户分组,TODO """ return {} -@api.delete("/tenant/{tenant_id}/user_groups/{id}/", tags=[_("用户分组")]) +@api.delete("/tenant/{tenant_id}/user_groups/{id}/", tags=["用户分组"],auth=None) def delete_user_group(request, tenant_id: str, id: str): """ 删除用户分组,TODO """ return {} -@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=["用户分组"],auth=None) def get_users_from_group(request, tenant_id: str, user_group_id: str): """ 获取当前分组的用户列表,TODO """ return {} -@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/users/{id}/", tags=[_("用户分组")]) +@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/users/{id}/", tags=["用户分组"],auth=None) def remove_user_from_group(request, tenant_id: str, user_group_id: str,id:str): """ 将用户移除出用户分组,TODO """ return {} -@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=[_("用户分组")]) +@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/users/", tags=["用户分组"],auth=None) def update_users_from_group(request, tenant_id: str, user_group_id: str): """ 更新当前分组的用户列表,TODO """ return {} -@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/select_users/", tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/select_users/", tags=["用户分组"],auth=None) def get_select_users(request, tenant_id: str, user_group_id: str): """ 获取所有用户并附加是否在当前分组的状态,TODO """ return {} -@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=["用户分组"],auth=None) def get_user_group_permissions(request, tenant_id: str,user_group_id:str): """ 用户分组权限列表,TODO """ return [] -@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=[_("用户分组")]) +@api.post("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/",tags=["用户分组"],auth=None) def update_user_group_permissions(request, tenant_id: str,user_group_id:str): """ 更新用户分组权限列表,TODO """ return [] -@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/{id}/",tags=[_("用户分组")]) +@api.delete("/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/{id}/",tags=["用户分组"],auth=None) def delete_user_group_permissions(request, tenant_id: str,user_group_id:str,id:str): """ 删除用户分组权限,TODO """ return [] -@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/all_permissions/",tags=[_("用户分组")]) +@api.get("/tenant/{tenant_id}/user_groups/{user_group_id}/all_permissions/",tags=["用户分组"],auth=None) def get_user_group_all_permissions(request, tenant_id: str,user_group_id:str): """ 获取所有权限并附带是否已授权给用户分组状态,TODO """ diff --git a/api/v1/views/webhook.py b/api/v1/views/webhook.py index 27364083b..4a296890b 100644 --- a/api/v1/views/webhook.py +++ b/api/v1/views/webhook.py @@ -2,67 +2,67 @@ from arkid.core.translation import gettext_default as _ -@api.get("/tenant/{tenant_id}/webhooks/", tags=[_("Webhook")]) +@api.get("/tenant/{tenant_id}/webhooks/", tags=["Webhook"],auth=None) def get_webhooks(request, tenant_id: str): """ Webhook列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +@api.get("/tenant/{tenant_id}/webhooks/{id}/", tags=["Webhook"],auth=None) def get_webhook(request, tenant_id: str, id: str): """ 获取Webhook,TODO """ return {} -@api.post("/tenant/{tenant_id}/webhooks/", tags=[_("Webhook")]) +@api.post("/tenant/{tenant_id}/webhooks/", tags=["Webhook"],auth=None) def create_webhook(request, tenant_id: str): """ 创建Webhook,TODO """ return {} -@api.put("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +@api.put("/tenant/{tenant_id}/webhooks/{id}/", tags=["Webhook"],auth=None) def update_webhook(request, tenant_id: str, id: str): """ 编辑Webhook,TODO """ return {} -@api.delete("/tenant/{tenant_id}/webhooks/{id}/", tags=[_("Webhook")]) +@api.delete("/tenant/{tenant_id}/webhooks/{id}/", tags=["Webhook"],auth=None) def delete_webhook(request, tenant_id: str, id: str): """ 删除Webhook,TODO """ return {} -@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=[_("Webhook")]) +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=["Webhook"],auth=None) def get_webhook_histories(request, tenant_id: str, webhook_id: str): """ 获取Webhook历史记录列表,TODO """ return [] -@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=["Webhook"],auth=None) def get_webhook_history(request, tenant_id: str, webhook_id: str, id:str): """ 获取Webhook历史记录,TODO """ return {} -@api.post("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=[_("Webhook")]) +@api.post("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/", tags=["Webhook"],auth=None) def create_webhook_history(request, tenant_id: str, webhook_id: str): """ 创建Webhook历史记录,TODO """ return {} -@api.put("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +@api.put("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=["Webhook"],auth=None) def update_webhook_history(request, tenant_id: str, webhook_id: str, id: str): """ 编辑Webhook历史记录,TODO """ return {} -@api.delete("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=[_("Webhook")]) +@api.delete("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/", tags=["Webhook"],auth=None) def delete_webhook_history(request, tenant_id: str, webhook_id: str, id: str): """ 删除Webhook历史记录,TODO """ return {} -@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/retry/", tags=[_("Webhook")]) +@api.get("/tenant/{tenant_id}/webhooks/{webhook_id}/histories/{id}/retry/", tags=["Webhook"],auth=None) def retry_webhook_history(request, tenant_id: str, webhook_id: str, id:str): """ 重试webhook历史记录,TODO """ diff --git a/arkid/core/actions.py b/arkid/core/actions.py index ff7bdd747..715ef894e 100644 --- a/arkid/core/actions.py +++ b/arkid/core/actions.py @@ -126,20 +126,6 @@ def __init__(self, *args, **kwargs): super().__init__(action_type=FrontActionType.OPEN_ACTION, *args, **kwargs) -class CancelAction(FrontAction): - """取消""" - - def __init__(self, *args, **kwargs): - self.name = _("取消") - super().__init__(action_type=FrontActionType.CANCEL_ACTION, *args, **kwargs) - - -class ResetAction(FrontAction): - def __init__(self, *args, **kwargs): - self.name = _("重置") - super().__init__(action_type=FrontActionType.RESET_ACTION, *args, **kwargs) - - class ImportAction(FrontAction): def __init__(self, *args, **kwargs): super().__init__(action_type=FrontActionType.IMPORT_ACTION, *args, **kwargs) From 2ce4e05c89fd91144c1816a344382b4b2d24c0c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 07:54:24 +0000 Subject: [PATCH 39/41] =?UTF-8?q?fix:=20=F0=9F=90=9B=20app=5Fgroup?= =?UTF-8?q?=E4=B8=AD=E5=AD=98=E5=9C=A8=E6=97=A0=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/views/app_group.py | 1 - 1 file changed, 1 deletion(-) diff --git a/api/v1/views/app_group.py b/api/v1/views/app_group.py index e2acb1258..8fcb5a49b 100644 --- a/api/v1/views/app_group.py +++ b/api/v1/views/app_group.py @@ -1,5 +1,4 @@ from typing import List -from attr import field from ninja import Field, ModelSchema, Query, Schema from requests import Response from arkid.core.api import api,operation From ad6a2d328803f483b12d1b2a9f5f0e7b578c47a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Thu, 28 Apr 2022 08:13:57 +0000 Subject: [PATCH 40/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pipfile | 1 + Pipfile.lock | 86 ++++++++++++++++++++++++-------------------- requirements-dev.txt | 13 +++---- requirements.txt | 9 ++--- 4 files changed, 61 insertions(+), 48 deletions(-) diff --git a/Pipfile b/Pipfile index 63763ed87..0c118a0a9 100644 --- a/Pipfile +++ b/Pipfile @@ -22,6 +22,7 @@ mkdocstrings = "*" mkdocs = "*" mkdocs-material = "*" pyjwt = "*" +django-cors-headers = "*" [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 275e87ce4..6e9463fab 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "507b95b335e8c86a1ba3a39f06e3ca0861f33f5f54706a10ee0e8bfd96767edb" + "sha256": "2f73388c25153cf171165440620730c277b4693303111e8aca781c6dc4b83704" }, "pipfile-spec": 6, "requires": { @@ -187,29 +187,31 @@ }, "cryptography": { "hashes": [ - "sha256:0a3bf09bb0b7a2c93ce7b98cb107e9170a90c51a0162a20af1c61c765b90e60b", - "sha256:1f64a62b3b75e4005df19d3b5235abd43fa6358d5516cfc43d87aeba8d08dd51", - "sha256:32db5cc49c73f39aac27574522cecd0a4bb7384e71198bc65a0d23f901e89bb7", - "sha256:4881d09298cd0b669bb15b9cfe6166f16fc1277b4ed0d04a22f3d6430cb30f1d", - "sha256:4e2dddd38a5ba733be6a025a1475a9f45e4e41139d1321f412c6b360b19070b6", - "sha256:53e0285b49fd0ab6e604f4c5d9c5ddd98de77018542e88366923f152dbeb3c29", - "sha256:70f8f4f7bb2ac9f340655cbac89d68c527af5bb4387522a8413e841e3e6628c9", - "sha256:7b2d54e787a884ffc6e187262823b6feb06c338084bbe80d45166a1cb1c6c5bf", - "sha256:7be666cc4599b415f320839e36367b273db8501127b38316f3b9f22f17a0b815", - "sha256:8241cac0aae90b82d6b5c443b853723bcc66963970c67e56e71a2609dc4b5eaf", - "sha256:82740818f2f240a5da8dfb8943b360e4f24022b093207160c77cadade47d7c85", - "sha256:8897b7b7ec077c819187a123174b645eb680c13df68354ed99f9b40a50898f77", - "sha256:c2c5250ff0d36fd58550252f54915776940e4e866f38f3a7866d92b32a654b86", - "sha256:ca9f686517ec2c4a4ce930207f75c00bf03d94e5063cbc00a1dc42531511b7eb", - "sha256:d2b3d199647468d410994dbeb8cec5816fb74feb9368aedf300af709ef507e3e", - "sha256:da73d095f8590ad437cd5e9faf6628a218aa7c387e1fdf67b888b47ba56a17f0", - "sha256:e167b6b710c7f7bc54e67ef593f8731e1f45aa35f8a8a7b72d6e42ec76afd4b3", - "sha256:ea634401ca02367c1567f012317502ef3437522e2fc44a3ea1844de028fa4b84", - "sha256:ec6597aa85ce03f3e507566b8bcdf9da2227ec86c4266bd5e6ab4d9e0cc8dab2", - "sha256:f64b232348ee82f13aac22856515ce0195837f6968aeaa94a3d0353ea2ec06a6" + "sha256:0234bdb18620ed16bf186f0591aea0bbc321ecaf59c859d5f5cbe7b646d8377e", + "sha256:183d6a540659c6a729c08971f09f3fb1044c89dd5af9d6f18da824a071f5445d", + "sha256:1af4f31870ef2180aba1c04f6d957461a570c8cabcc4b5ac7fabf2b4a0364ea0", + "sha256:2d3d8a69d262ba27923466194bef637150aef286b11b160e087992206ac32f0c", + "sha256:2dfd682771c04c7e85a4b4ea6aa1682a3fd6f4d9845468fa6ba512b80a560a8d", + "sha256:4c52cb32ea0b9798234823d37c93cab8004c574b2d224f048cd5829d0639387b", + "sha256:57273f69b334c6d30f4d27abc7fb9c919ef4c6193af64420572808302bb45768", + "sha256:5a761fc1ff0eae360a80656bea462c3163dfaa8093b2fa0f72af929217b14a97", + "sha256:5c2517a2c58213ee62b36ee9ece4a710179ddb07db90e31d7619e7ea472c9dc3", + "sha256:710b9041fb97cc576e288b5f96583578ed352dd60608a402045405c388522b94", + "sha256:8921428ca6403d7eb52ee0e728e8b02601060a5791f6d64c8a3a12b5722064af", + "sha256:bc54780dd8f7236874ac29fc155c5cf811f7d910e5f0575932a38bdaac3b5146", + "sha256:bf893131cd79dc8eaf4940b3aa2f4a68eba050471f5deacfaedea6aab04f574f", + "sha256:cab59c774125596fa72f1decc5805894313b40f370a7c75597e37f0211027944", + "sha256:d119feb387ce2df9bfb92e5785df9094325cfa974e2e6aa08c8e4a8b56786afe", + "sha256:d426093df7f00de859bad45d6a09fdab9b8e4c6e46ea897dd0a302b94c7f6871", + "sha256:d886b2c9f8d1ab0916673bc3c89dd04fc6e6591861872c9f08402b0ab2843b82", + "sha256:d97479d943d549d4a78f044b0620a7d349191ed40933ffabff1cc5875e20682c", + "sha256:db1b9516e3072e0342287e06779bec84118bd780f794c8c07bd5da142a526103", + "sha256:e86734f28656f6fd5993ab32bd2d2680c3b8341d6f875faf5212bc78715db2a4", + "sha256:ebdc9c4b3577bb76b0defebe4ef8b866da5228a1c53fbbf394b7677fe292fee9", + "sha256:eee79c6c16949ed817c8cf288e6e124c4b8996e3312d9e7884c71cf9bdda212e" ], "markers": "python_version >= '3.6'", - "version": "==36.0.2" + "version": "==37.0.0" }, "deprecated": { "hashes": [ @@ -227,6 +229,14 @@ "markers": "python_version >= '3.8'", "version": "==4.0.4" }, + "django-cors-headers": { + "hashes": [ + "sha256:a22be2befd4069c4fc174f11cf067351df5c061a3a5f94a01650b4e928b0372b", + "sha256:eb98389bf7a2afc5d374806af4a9149697e3a6955b5a2dc2bf049f7d33647456" + ], + "index": "pypi", + "version": "==3.11.0" + }, "django-ninja": { "hashes": [ "sha256:31a5c040a36c620deb4c20731c094540e3245a7b885a7f9d28e85098886595fc", @@ -255,7 +265,7 @@ "sha256:1208431ca90a8cca1a6b8af391bb53c1a2db74e5d1cef6ddced95d4b2062edc6", "sha256:ea4c597ebf37142f827b8f39299579e31685c31d3a438b59f469406afd0f2539" ], - "markers": "python_version < '3.10'", + "markers": "python_version >= '3.7'", "version": "==4.11.3" }, "jinja2": { @@ -362,11 +372,11 @@ }, "mkdocs-material": { "hashes": [ - "sha256:c177ff180b024bc061714c9483a8d26d36e1b9fdef4be8e70e243770416fe9d7", - "sha256:fbe39baa57c70fdbe9d1a24c6c2d0625e255e74f22b20aff43abb64157446f4d" + "sha256:4a3631ba22cff7ceca00c39465a8db5b2116fcd74f3abd82b801f7711cceb699", + "sha256:af6bbd608a54b8493cb5fa0d2f2cf29cde3bf348837ab718afb1be0a8bea6509" ], "index": "pypi", - "version": "==8.2.9" + "version": "==8.2.11" }, "mkdocs-material-extensions": { "hashes": [ @@ -630,7 +640,7 @@ "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0'", "version": "==1.26.9" }, "vine": { @@ -766,14 +776,6 @@ } }, "develop": { - "appnope": { - "hashes": [ - "sha256:02bd91c4de869fbb1e1c50aafc4098827a7a54ab2f39d9dcba6c9547ed920e24", - "sha256:265a455292d0bd8a72453494fa24df5a11eb18373a60c7c0430889f22548605e" - ], - "markers": "sys_platform == 'darwin'", - "version": "==0.1.3" - }, "astroid": { "hashes": [ "sha256:4e5ba10571e197785e312966ea5efb2f5783176d4c1a73fa922d474ae2be59f7", @@ -852,11 +854,11 @@ }, "identify": { "hashes": [ - "sha256:3f3244a559290e7d3deb9e9adc7b33594c1bc85a9dd82e0f1be519bf12a1ec17", - "sha256:5f06b14366bd1facb88b00540a1de05b69b310cbc2654db3c7e07fa3a4339323" + "sha256:3acfe15a96e4272b4ec5662ee3e231ceba976ef63fd9980ed2ce9cc415df393f", + "sha256:c83af514ea50bf2be2c4a3f2fb349442b59dc87284558ae9ff54191bff3541d2" ], "markers": "python_version >= '3.7'", - "version": "==2.4.12" + "version": "==2.5.0" }, "ipython": { "hashes": [ @@ -1072,6 +1074,14 @@ "markers": "python_version >= '3.6'", "version": "==6.0" }, + "setuptools": { + "hashes": [ + "sha256:26ead7d1f93efc0f8c804d9fafafbe4a44b179580a7105754b245155f9af05a8", + "sha256:47c7b0c0f8fc10eec4cf1e71c6fdadf8decaa74ffa087e68cd1c20db7ad6a592" + ], + "markers": "python_version >= '3.7'", + "version": "==62.1.0" + }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", diff --git a/requirements-dev.txt b/requirements-dev.txt index e4362f8fc..80d832ca2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,7 +10,6 @@ -i https://mirrors.aliyun.com/pypi/simple amqp==5.1.1; python_version >= '3.6' -appnope==0.1.3; sys_platform == 'darwin' asgiref==3.5.0; python_version >= '3.7' astroid==2.11.3; python_full_version >= '3.6.2' asttokens==2.0.5 @@ -29,19 +28,20 @@ click-didyoumean==0.3.0; python_full_version >= '3.6.2' and python_full_version click-plugins==1.1.1 click-repl==0.2.0 click==8.1.2; python_version >= '3.7' -cryptography==36.0.2; python_version >= '3.6' +cryptography==37.0.0; python_version >= '3.6' decorator==5.1.1; python_version >= '3.5' deprecated==1.2.13; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' dill==0.3.4; python_version >= '2.7' and python_version != '3.0' distlib==0.3.4 +django-cors-headers==3.11.0 django-ninja==0.17.0 django==4.0.4; python_version >= '3.8' executing==0.8.3 filelock==3.6.0; python_version >= '3.7' ghp-import==2.0.2 -identify==2.4.12; python_version >= '3.7' +identify==2.5.0; python_version >= '3.7' idna==3.3; python_version >= '3' -importlib-metadata==4.11.3; python_version < '3.10' +importlib-metadata==4.11.3; python_version >= '3.7' ipython==8.2.0 isort==5.10.1; python_version < '4.0' and python_full_version >= '3.6.1' jedi==0.18.1; python_version >= '3.6' @@ -56,7 +56,7 @@ mccabe==0.7.0; python_version >= '3.6' mergedeep==1.3.4; python_version >= '3.6' mkdocs-autorefs==0.4.1; python_version >= '3.7' mkdocs-material-extensions==1.0.3; python_version >= '3.6' -mkdocs-material==8.2.9 +mkdocs-material==8.2.11 mkdocs==1.3.0 mkdocstrings-python-legacy==0.2.2; python_version >= '3.7' mkdocstrings==0.18.1 @@ -87,6 +87,7 @@ pyyaml-env-tag==0.1; python_version >= '3.6' pyyaml==6.0; python_version >= '3.6' redis==4.2.2 requests==2.27.1 +setuptools==62.1.0; python_version >= '3.7' six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' sqlparse==0.4.2; python_version >= '3.5' stack-data==0.2.0 @@ -94,7 +95,7 @@ toml==0.10.2 tomli==2.0.1; python_version < '3.11' traitlets==5.1.1; python_version >= '3.7' typing-extensions==4.2.0; python_version >= '3.7' -urllib3==1.26.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4' +urllib3==1.26.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0' vine==5.0.0; python_version >= '3.6' virtualenv==20.14.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' watchdog==2.1.7; python_version >= '3.6' diff --git a/requirements.txt b/requirements.txt index 18b888121..5149dfd36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,13 +20,14 @@ click-didyoumean==0.3.0; python_full_version >= '3.6.2' and python_full_version click-plugins==1.1.1 click-repl==0.2.0 click==8.1.2; python_version >= '3.7' -cryptography==36.0.2; python_version >= '3.6' +cryptography==37.0.0; python_version >= '3.6' deprecated==1.2.13; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' +django-cors-headers==3.11.0 django-ninja==0.17.0 django==4.0.4; python_version >= '3.8' ghp-import==2.0.2 idna==3.3; python_version >= '3' -importlib-metadata==4.11.3; python_version < '3.10' +importlib-metadata==4.11.3; python_version >= '3.7' jinja2==3.1.1; python_version >= '3.7' jwcrypto==1.0 kombu==5.2.4; python_version >= '3.7' @@ -35,7 +36,7 @@ markupsafe==2.1.1; python_version >= '3.7' mergedeep==1.3.4; python_version >= '3.6' mkdocs-autorefs==0.4.1; python_version >= '3.7' mkdocs-material-extensions==1.0.3; python_version >= '3.6' -mkdocs-material==8.2.9 +mkdocs-material==8.2.11 mkdocs==1.3.0 mkdocstrings-python-legacy==0.2.2; python_version >= '3.7' mkdocstrings==0.18.1 @@ -60,7 +61,7 @@ six==1.16.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3 sqlparse==0.4.2; python_version >= '3.5' toml==0.10.2 typing-extensions==4.2.0; python_version >= '3.7' -urllib3==1.26.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4' +urllib3==1.26.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_full_version < '4.0.0' vine==5.0.0; python_version >= '3.6' watchdog==2.1.7; python_version >= '3.6' wcwidth==0.2.5 From 4622218e06d80305f6a02ead5b6e86641ae103bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=98=E5=B0=8F=E8=A5=BF?= Date: Fri, 29 Apr 2022 13:02:26 +0000 Subject: [PATCH 41/41] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20global=5Factions?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E7=B1=BB=E5=9E=8B=E4=B8=BAdict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/v1/pages/app_manage/app_group.py | 27 ++++++++++--------- api/v1/pages/app_manage/app_list.py | 14 +++++----- api/v1/pages/approve_manage/approve_action.py | 15 ++++++----- api/v1/pages/auth_manage/auth_factor.py | 15 ++++++----- api/v1/pages/auth_manage/auth_rules.py | 15 ++++++----- api/v1/pages/auth_manage/auto_auth.py | 15 ++++++----- api/v1/pages/auth_manage/third_auth.py | 15 ++++++----- api/v1/pages/charts_manage/bi_systems.py | 15 ++++++----- .../data_source_manage/permission_sync.py | 15 ++++++----- api/v1/pages/data_source_manage/scim_sync.py | 15 ++++++----- api/v1/pages/developer_manage/webhook.py | 24 +++++++++-------- api/v1/pages/log_manage/log_config.py | 9 ++++--- api/v1/pages/mine/grant_manage.py | 17 ++++++------ api/v1/pages/mine/profile.py | 9 ++++--- .../grant_manage/group_grant.py | 14 +++++----- .../grant_manage/user_grant.py | 14 +++++----- api/v1/pages/permission_manage/grant_rules.py | 15 ++++++----- .../permission_manage/permission_group.py | 27 ++++++++++--------- .../permission_manage/permission_list.py | 15 ++++++----- .../pages/platform_admin/extension_admin.py | 15 ++++++----- api/v1/pages/platform_admin/tenant_admin.py | 24 +++++++++-------- api/v1/pages/tenant_manage/center_arkid.py | 8 +++--- api/v1/pages/tenant_manage/child_manager.py | 15 ++++++----- .../pages/tenant_manage/extension_manage.py | 15 ++++++----- api/v1/pages/tenant_manage/tenant_config.py | 9 ++++--- api/v1/pages/user_manage/account_life.py | 15 ++++++----- api/v1/pages/user_manage/user_group.py | 27 ++++++++++--------- api/v1/pages/user_manage/user_list.py | 15 ++++++----- arkid/common/__init__.py | 4 +++ arkid/core/pages.py | 15 ++++++++--- 30 files changed, 254 insertions(+), 213 deletions(-) diff --git a/api/v1/pages/app_manage/app_group.py b/api/v1/pages/app_manage/app_group.py index 97a2f1d91..5f9bdff95 100644 --- a/api/v1/pages/app_manage/app_group.py +++ b/api/v1/pages/app_manage/app_group.py @@ -27,11 +27,11 @@ path='/api/v1/tenant/{tenant_id}/app_groups/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create':actions.CreateAction( path='/api/v1/tenant/{tenant_id}/app_groups/' ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -52,12 +52,12 @@ path='/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.OpenAction( + global_actions={ + "update":actions.OpenAction( name=_("添加应用"), page=edit_apps_page, ) - ], + }, local_actions=[ actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/app_groups/{app_group_id}/apps/{id}/", @@ -73,11 +73,11 @@ method=actions.FrontActionMethod.GET, ), select=True, - global_actions=[ - actions.ConfirmAction( + global_actions={ + 'confirm': actions.ConfirmAction( path="/tenant/{tenant_id}/app_groups/{app_group_id}/apps/" ), - ] + } ) @@ -86,8 +86,9 @@ path='/api/v1/tenant/{tenant_id}/app_groups/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/app_groups/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/app_groups/{id}/" + ), + } ) diff --git a/api/v1/pages/app_manage/app_list.py b/api/v1/pages/app_manage/app_list.py index e2cc8a3c4..e0116c56d 100644 --- a/api/v1/pages/app_manage/app_list.py +++ b/api/v1/pages/app_manage/app_list.py @@ -23,11 +23,11 @@ path='/api/v1/tenant/{tenant_id}/apps/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create':actions.CreateAction( path='/api/v1/tenant/{tenant_id}/apps/' ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -43,7 +43,9 @@ path='/api/v1/tenant/{tenant_id}/apps/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/apps/{id}/"), - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/apps/{id}/" + ), + } ) diff --git a/api/v1/pages/approve_manage/approve_action.py b/api/v1/pages/approve_manage/approve_action.py index c6c1fb2e4..8b2eaa54c 100644 --- a/api/v1/pages/approve_manage/approve_action.py +++ b/api/v1/pages/approve_manage/approve_action.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/approve_actions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/approve_actions/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/approve_actions/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/approve_actions/{id}/" + ), + } ) diff --git a/api/v1/pages/auth_manage/auth_factor.py b/api/v1/pages/auth_manage/auth_factor.py index 575d57b17..e74967b45 100644 --- a/api/v1/pages/auth_manage/auth_factor.py +++ b/api/v1/pages/auth_manage/auth_factor.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/auth_factors/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/auth_factors/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/auth_factors/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_factors/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auth_factors/{id}/" + ), + } ) diff --git a/api/v1/pages/auth_manage/auth_rules.py b/api/v1/pages/auth_manage/auth_rules.py index 88e271a0e..6393b2dd3 100644 --- a/api/v1/pages/auth_manage/auth_rules.py +++ b/api/v1/pages/auth_manage/auth_rules.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/auth_rules/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/auth_rules/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/auth_rules/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auth_rules/{id}/" + ), + } ) diff --git a/api/v1/pages/auth_manage/auto_auth.py b/api/v1/pages/auth_manage/auto_auth.py index 45afc554a..ba17650ab 100644 --- a/api/v1/pages/auth_manage/auto_auth.py +++ b/api/v1/pages/auth_manage/auto_auth.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/auto_auths/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/auto_auths/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/auto_auths/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/auto_auths/{id}/" + ), + } ) diff --git a/api/v1/pages/auth_manage/third_auth.py b/api/v1/pages/auth_manage/third_auth.py index 1090aea69..da8dc2129 100644 --- a/api/v1/pages/auth_manage/third_auth.py +++ b/api/v1/pages/auth_manage/third_auth.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/third_auths/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/third_auths/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/third_auths/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/third_auths/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/third_auths/{id}/" + ), + } ) diff --git a/api/v1/pages/charts_manage/bi_systems.py b/api/v1/pages/charts_manage/bi_systems.py index 66cdd71e4..9d56d09c4 100644 --- a/api/v1/pages/charts_manage/bi_systems.py +++ b/api/v1/pages/charts_manage/bi_systems.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/bi_systems/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/bi_systems/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/bi_systems/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/bi_systems/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/bi_systems/{id}/" + ), + } ) diff --git a/api/v1/pages/data_source_manage/permission_sync.py b/api/v1/pages/data_source_manage/permission_sync.py index 269136e0a..61a956ef3 100644 --- a/api/v1/pages/data_source_manage/permission_sync.py +++ b/api/v1/pages/data_source_manage/permission_sync.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/permission_syncs/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/permission_syncs/', ) - ], + }, local_actions=[ actions.DirectAction( name=_("同步"), @@ -49,10 +49,11 @@ path='/api/v1/tenant/{tenant_id}/permission_syncs/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_syncs/{id}/" + ), + } ) diff --git a/api/v1/pages/data_source_manage/scim_sync.py b/api/v1/pages/data_source_manage/scim_sync.py index a3b7ee0be..d0f6c5049 100644 --- a/api/v1/pages/data_source_manage/scim_sync.py +++ b/api/v1/pages/data_source_manage/scim_sync.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/scim_syncs/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/scim_syncs/', ) - ], + }, local_actions=[ actions.DirectAction( name=_("同步"), @@ -49,10 +49,11 @@ path='/api/v1/tenant/{tenant_id}/scim_syncs/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/scim_syncs/{id}/" + ), + } ) diff --git a/api/v1/pages/developer_manage/webhook.py b/api/v1/pages/developer_manage/webhook.py index f679ce73d..caed25200 100644 --- a/api/v1/pages/developer_manage/webhook.py +++ b/api/v1/pages/developer_manage/webhook.py @@ -29,11 +29,11 @@ path='/api/v1/tenant/{tenant_id}/webhooks/', method=actions.FrontActionMethod.GET, ), - global_actions = [ - actions.CreateAction( + global_actions = { + "create":actions.CreateAction( path=create_page, ) - ], + }, local_actions = [ actions.OpenAction( name=_("历史记录"), @@ -54,10 +54,11 @@ path='/api/v1/tenant/{tenant_id}/webhooks/{id}/', method=actions.FrontActionMethod.GET, ), - global_actions = [ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/{id}/"), - - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/webhooks/{id}/" + ), + } ) create_page.create_actions( @@ -66,10 +67,11 @@ path='/api/v1/tenant/{tenant_id}/webhooks/', method=actions.FrontActionMethod.POST ), - global_actions = [ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/webhooks/"), - - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/webhooks/" + ), + } ) history_page.create_actions( diff --git a/api/v1/pages/log_manage/log_config.py b/api/v1/pages/log_manage/log_config.py index 515da366b..68010ecca 100644 --- a/api/v1/pages/log_manage/log_config.py +++ b/api/v1/pages/log_manage/log_config.py @@ -18,8 +18,9 @@ path="/api/v1/tenant/{tenant_id}/log_config/", method=actions.FrontActionMethod.GET, ), - global_actions = [ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/log_config/"), - - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/log_config/" + ), + } ) \ No newline at end of file diff --git a/api/v1/pages/mine/grant_manage.py b/api/v1/pages/mine/grant_manage.py index 2c5d15edc..313e63b6b 100644 --- a/api/v1/pages/mine/grant_manage.py +++ b/api/v1/pages/mine/grant_manage.py @@ -32,12 +32,12 @@ path='/api/v1/mine/tenant/{tenant_id}/permissions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.OpenAction( - name=_("申请权限"), + global_actions={ + 'open': actions.OpenAction( + name=("申请权限"), page=permission_page ) - ] + } ) permission_page.create_actions( @@ -45,8 +45,9 @@ path='/api/v1/mine/tenant/{tenant_id}/all_permissions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/mine/tenant/{tenant_id}/permissions/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/mine/tenant/{tenant_id}/permissions/" + ), + } ) \ No newline at end of file diff --git a/api/v1/pages/mine/profile.py b/api/v1/pages/mine/profile.py index 7caed3bd3..b43ca0c40 100644 --- a/api/v1/pages/mine/profile.py +++ b/api/v1/pages/mine/profile.py @@ -21,8 +21,9 @@ path='/mine/tenant/{tenant_id}/profile/', method=actions.FrontActionMethod.GET ), - global_actions = [ - actions.ConfirmAction(path="/mine/tenant/{tenant_id}/profile/"), - - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/mine/tenant/{tenant_id}/profile/" + ), + } ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/group_grant.py b/api/v1/pages/permission_manage/grant_manage/group_grant.py index 0a454268a..c3c9c8c14 100644 --- a/api/v1/pages/permission_manage/grant_manage/group_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/group_grant.py @@ -35,12 +35,12 @@ path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/{id}/' ) ], - global_actions=[ - actions.OpenAction( - name=_("添加用户分组权限"), + global_actions={ + 'open': actions.OpenAction( + name=("添加用户分组权限"), page=update_group_permission_page ) - ] + } ) update_group_permission_page.create_actions( @@ -48,9 +48,9 @@ path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/all_permissions/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction( + global_actions={ + 'confirm':actions.ConfirmAction( path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/permissions/', ), - ] + } ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_manage/user_grant.py b/api/v1/pages/permission_manage/grant_manage/user_grant.py index a6779651a..187ed7e7b 100644 --- a/api/v1/pages/permission_manage/grant_manage/user_grant.py +++ b/api/v1/pages/permission_manage/grant_manage/user_grant.py @@ -35,12 +35,12 @@ path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/{id}/' ) ], - global_actions=[ - actions.OpenAction( - name=_("添加用户分组权限"), + global_actions={ + 'open': actions.OpenAction( + name=("添加用户分组权限"), page=update_user_permission_page ) - ] + } ) update_user_permission_page.create_actions( @@ -48,9 +48,9 @@ path='/api/v1/tenant/{tenant_id}/users/{user_id}/all_permissions/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction( + global_actions={ + 'confirm':actions.ConfirmAction( path='/api/v1/tenant/{tenant_id}/users/{user_id}/permissions/', ), - ] + } ) \ No newline at end of file diff --git a/api/v1/pages/permission_manage/grant_rules.py b/api/v1/pages/permission_manage/grant_rules.py index 4ce84aa61..0356bce1d 100644 --- a/api/v1/pages/permission_manage/grant_rules.py +++ b/api/v1/pages/permission_manage/grant_rules.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/permission_rules/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/permission_rules/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/permission_rules/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_rules/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_rules/{id}/" + ), + } ) diff --git a/api/v1/pages/permission_manage/permission_group.py b/api/v1/pages/permission_manage/permission_group.py index eb02ee709..2bd19aaba 100644 --- a/api/v1/pages/permission_manage/permission_group.py +++ b/api/v1/pages/permission_manage/permission_group.py @@ -29,11 +29,11 @@ path='/api/v1/tenant/{tenant_id}/permission_groups/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/permission_groups/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -54,12 +54,12 @@ path='/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.OpenAction( + global_actions={ + "update":actions.OpenAction( name=_("添加权限"), page=edit_permissions_page, ) - ], + }, local_actions=[ actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/{id}/", @@ -75,11 +75,11 @@ method=actions.FrontActionMethod.GET, ), select=True, - global_actions=[ - actions.ConfirmAction( + global_actions={ + 'confirm': actions.ConfirmAction( path="/tenant/{tenant_id}/permission_groups/{permission_group_id}/permissions/" ), - ] + } ) @@ -88,10 +88,11 @@ path='/api/v1/tenant/{tenant_id}/permission_groups/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permission_groups/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permission_groups/{id}/" + ), + } ) diff --git a/api/v1/pages/permission_manage/permission_list.py b/api/v1/pages/permission_manage/permission_list.py index e9a5bf06e..d5db8955e 100644 --- a/api/v1/pages/permission_manage/permission_list.py +++ b/api/v1/pages/permission_manage/permission_list.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/permissions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/permissions/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/permissions/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/permissions/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/permissions/{id}/" + ), + } ) diff --git a/api/v1/pages/platform_admin/extension_admin.py b/api/v1/pages/platform_admin/extension_admin.py index 2d2e0d471..9dedaef6e 100644 --- a/api/v1/pages/platform_admin/extension_admin.py +++ b/api/v1/pages/platform_admin/extension_admin.py @@ -24,11 +24,11 @@ path='/api/v1/extensions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/extensions/', ) - ], + }, local_actions=[ # 加载/卸载 插件 TODO actions.EditAction( @@ -45,10 +45,11 @@ path='/api/v1/extensions/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/extensions/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/extensions/{id}/" + ), + } ) diff --git a/api/v1/pages/platform_admin/tenant_admin.py b/api/v1/pages/platform_admin/tenant_admin.py index 2c456cb28..4fe5b4b45 100644 --- a/api/v1/pages/platform_admin/tenant_admin.py +++ b/api/v1/pages/platform_admin/tenant_admin.py @@ -35,10 +35,11 @@ path='/api/v1/platform_config/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/platform_config/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/platform_config/" + ), + } ) tenant_list_page.create_actions( @@ -46,11 +47,11 @@ path='/api/v1/tenants/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenants/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -66,10 +67,11 @@ path='/api/v1/tenants/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenants/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenants/{id}/" + ), + } ) diff --git a/api/v1/pages/tenant_manage/center_arkid.py b/api/v1/pages/tenant_manage/center_arkid.py index 772ec9514..a0dd4ffc6 100644 --- a/api/v1/pages/tenant_manage/center_arkid.py +++ b/api/v1/pages/tenant_manage/center_arkid.py @@ -20,7 +20,9 @@ path="/api/v1/tenant/{tenant_id}/center_arkid/", method=actions.FrontActionMethod.GET, ), - global_actions = [ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/center_arkid/"), - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/center_arkid/" + ), + } ) \ No newline at end of file diff --git a/api/v1/pages/tenant_manage/child_manager.py b/api/v1/pages/tenant_manage/child_manager.py index c1d9d9fd5..50c699b7d 100644 --- a/api/v1/pages/tenant_manage/child_manager.py +++ b/api/v1/pages/tenant_manage/child_manager.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/child_managers/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/child_managers/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/child_managers/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/child_managers/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/child_managers/{id}/" + ), + } ) diff --git a/api/v1/pages/tenant_manage/extension_manage.py b/api/v1/pages/tenant_manage/extension_manage.py index 40a7e0781..3073758df 100644 --- a/api/v1/pages/tenant_manage/extension_manage.py +++ b/api/v1/pages/tenant_manage/extension_manage.py @@ -25,11 +25,11 @@ path='/api/v1/tenant/{tenant_id}/extensions/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/extensions/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -45,10 +45,11 @@ path='/api/v1/tenant/{tenant_id}/extensions/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/extensions/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/extensions/{id}/" + ), + } ) diff --git a/api/v1/pages/tenant_manage/tenant_config.py b/api/v1/pages/tenant_manage/tenant_config.py index c762d5640..33262978f 100644 --- a/api/v1/pages/tenant_manage/tenant_config.py +++ b/api/v1/pages/tenant_manage/tenant_config.py @@ -18,8 +18,9 @@ path="/api/v1/tenant/{tenant_id}/tenant_config/", method=actions.FrontActionMethod.GET, ), - global_actions = [ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/tenant_config/"), - - ] + global_actions = { + "confirm": actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/tenant_config/" + ), + } ) \ No newline at end of file diff --git a/api/v1/pages/user_manage/account_life.py b/api/v1/pages/user_manage/account_life.py index f6992073b..16bce9859 100644 --- a/api/v1/pages/user_manage/account_life.py +++ b/api/v1/pages/user_manage/account_life.py @@ -24,11 +24,11 @@ path='/api/v1/tenant/{tenant_id}/account_lifes/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/account_lifes/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -44,10 +44,11 @@ path='/api/v1/tenant/{tenant_id}/account_lifes/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/account_lifes/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/account_lifes/{id}/" + ), + } ) diff --git a/api/v1/pages/user_manage/user_group.py b/api/v1/pages/user_manage/user_group.py index 571910bfe..6b5858ce6 100644 --- a/api/v1/pages/user_manage/user_group.py +++ b/api/v1/pages/user_manage/user_group.py @@ -29,11 +29,11 @@ path='/api/v1/tenant/{tenant_id}/user_groups/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/user_groups/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -54,12 +54,12 @@ path='/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.OpenAction( + global_actions={ + "update":actions.OpenAction( name=_("添加用户"), page=edit_users_page, ) - ], + }, local_actions=[ actions.DeleteAction( path="/api/v1/tenant/{tenant_id}/user_groups/{user_group_id}/users/{id}/", @@ -75,11 +75,11 @@ method=actions.FrontActionMethod.GET, ), select=True, - global_actions=[ - actions.ConfirmAction( + global_actions={ + 'confirm': actions.ConfirmAction( path="/tenant/{tenant_id}/user_groups/{user_group_id}/users/" ), - ] + } ) @@ -88,10 +88,11 @@ path='/api/v1/tenant/{tenant_id}/user_groups/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/user_groups/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/user_groups/{id}/" + ), + } ) diff --git a/api/v1/pages/user_manage/user_list.py b/api/v1/pages/user_manage/user_list.py index 6ddecf05e..5ba487fa0 100644 --- a/api/v1/pages/user_manage/user_list.py +++ b/api/v1/pages/user_manage/user_list.py @@ -25,11 +25,11 @@ path='/api/v1/tenant/{tenant_id}/users/', method=actions.FrontActionMethod.GET, ), - global_actions=[ - actions.CreateAction( + global_actions={ + 'create': actions.CreateAction( path='/api/v1/tenant/{tenant_id}/users/', ) - ], + }, local_actions=[ actions.EditAction( page=edit_page, @@ -45,10 +45,11 @@ path='/api/v1/tenant/{tenant_id}/users/{id}/', method=actions.FrontActionMethod.GET ), - global_actions=[ - actions.ConfirmAction(path="/api/v1/tenant/{tenant_id}/users/{id}/"), - - ] + global_actions={ + 'confirm': actions.ConfirmAction( + path="/api/v1/tenant/{tenant_id}/users/{id}/" + ), + } ) diff --git a/arkid/common/__init__.py b/arkid/common/__init__.py index b8a6b42c5..3d31e8b90 100644 --- a/arkid/common/__init__.py +++ b/arkid/common/__init__.py @@ -11,6 +11,10 @@ def dict(self): _data[key] = [ item.dict() if isinstance(item,DeepSN) else item for item in val ] + elif isinstance(val,dict): + _data[key] = {} + for k,v in val.items(): + _data[key][k] = v.dict() if isinstance(v,DeepSN) else v else: _data[key] = val return _data \ No newline at end of file diff --git a/arkid/core/pages.py b/arkid/core/pages.py index 6a9f26feb..74ec3dbb0 100644 --- a/arkid/core/pages.py +++ b/arkid/core/pages.py @@ -104,11 +104,18 @@ def add_global_actions(self, actions): if not actions: return - if not isinstance(actions, tuple) or not isinstance(actions, list): - actions = list(actions) + # if not isinstance(actions, tuple) or not isinstance(actions, list): + # actions = list(actions) + if not hasattr(self, "global_action"): - self.global_action = [] - self.global_action.extend(actions) + self.global_action = {} + + if not isinstance(actions,dict): + actions = { + gen_tag():actions + } + + self.global_action.update(actions) def add_local_actions(self, actions): """ 添加表单动作