mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-24 21:08:30 +00:00
pref: 修改 activity log (#9571)
* pref: 修改 activity log * perf: 优化 acitivity * pref: 修改 activity * fix: 修复一些运行问题 * fix: app.py 中添加 tasks import * fix: 添加 activity_callback * fix: 添加 execute_account_backup_plan activity_callback * fix: 添加 activity_callback -> gather_asset_accounts * fix: 对 celery 任务添加 activity_callback 回调 * fix: 修改翻译 --------- Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: jiangweidong <weidong.jiang@fit2cloud.com> Co-authored-by: Bai <baijiangjie@gmail.com>
This commit is contained in:
@@ -80,6 +80,10 @@ class BaseAutomation(PeriodTaskModelMixin, JMSOrgBaseModel):
|
||||
def executed_amount(self):
|
||||
return self.executions.count()
|
||||
|
||||
@property
|
||||
def latest_execution(self):
|
||||
return self.executions.first()
|
||||
|
||||
def execute(self, trigger=Trigger.manual):
|
||||
try:
|
||||
eid = current_task.request.id
|
||||
@@ -125,12 +129,16 @@ class AutomationExecution(OrgModelMixin):
|
||||
def manager_type(self):
|
||||
return self.snapshot['type']
|
||||
|
||||
def get_all_assets(self):
|
||||
def get_all_asset_ids(self):
|
||||
node_ids = self.snapshot['nodes']
|
||||
asset_ids = self.snapshot['assets']
|
||||
nodes = Node.objects.filter(id__in=node_ids)
|
||||
node_asset_ids = Node.get_nodes_all_assets(*nodes).values_list('id', flat=True)
|
||||
asset_ids = set(list(asset_ids) + list(node_asset_ids))
|
||||
return asset_ids
|
||||
|
||||
def get_all_assets(self):
|
||||
asset_ids = self.get_all_asset_ids()
|
||||
return Asset.objects.filter(id__in=asset_ids)
|
||||
|
||||
def all_assets_group_by_platform(self):
|
||||
|
Reference in New Issue
Block a user