From 4ca6d0f13929848f1906bbf7d5dc9f79867077c2 Mon Sep 17 00:00:00 2001 From: mouday Date: Sat, 2 Nov 2024 12:50:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=99=AE=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BD=91=E7=AB=99=E7=9B=91=E6=B5=8B=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain_admin/api/log_monitor_api.py | 6 +++--- domain_admin/api/monitor_api.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/domain_admin/api/log_monitor_api.py b/domain_admin/api/log_monitor_api.py index b7ca0c8ba8..aa479541df 100644 --- a/domain_admin/api/log_monitor_api.py +++ b/domain_admin/api/log_monitor_api.py @@ -12,7 +12,7 @@ from domain_admin.service import auth_service -@auth_service.permission(role=RoleEnum.ADMIN) +@auth_service.permission(role=RoleEnum.USER) def get_log_monitor_list(): """ :return: @@ -52,7 +52,7 @@ def get_log_monitor_list(): } -@auth_service.permission(role=RoleEnum.ADMIN) +@auth_service.permission(role=RoleEnum.USER) def clear_log_monitor(): """ :return: @@ -64,7 +64,7 @@ def clear_log_monitor(): ).execute() -@auth_service.permission(role=RoleEnum.ADMIN) +@auth_service.permission(role=RoleEnum.USER) def clear_all_log_monitor(): """ :return: diff --git a/domain_admin/api/monitor_api.py b/domain_admin/api/monitor_api.py index 389276147e..ad48bf08d2 100644 --- a/domain_admin/api/monitor_api.py +++ b/domain_admin/api/monitor_api.py @@ -11,6 +11,7 @@ from peewee import SQL, fn from playhouse.shortcuts import model_to_dict +from domain_admin.enums.monitor_type_enum import MonitorTypeEnum from domain_admin.enums.operation_enum import OperationEnum from domain_admin.enums.role_enum import RoleEnum from domain_admin.enums.time_unit_enum import TimeUnitEnum @@ -140,6 +141,11 @@ def remove_monitor_by_id(): MonitorModel.delete_by_id(monitor_row.id) + # remote log + LogMonitorModel.delete().where( + LogMonitorModel.monitor_id == monitor_row.id, + LogMonitorModel.monitor_type == MonitorTypeEnum.HTTP + ).execute() @auth_service.permission(role=RoleEnum.USER) @operation_service.operation_log_decorator( @@ -162,6 +168,12 @@ def delete_monitor_by_ids(): MonitorModel.user_id == current_user_id ).execute() + # remote log + LogMonitorModel.delete().where( + LogMonitorModel.monitor_id.in_(monitor_ids), + LogMonitorModel.monitor_type == MonitorTypeEnum.HTTP + ).execute() + @auth_service.permission(role=RoleEnum.USER) def get_monitor_by_id():