1
0
mirror of https://github.com/jumpserver/jumpserver.git synced 2025-05-07 15:47:02 +00:00

perf: update automation report

This commit is contained in:
fit2bot 2025-03-17 10:31:49 +08:00 committed by GitHub
parent 7bac1b42e4
commit b7820c6a5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 44 additions and 31 deletions
apps
accounts
assets/automations/base
common/management/commands/services/services
i18n/lina

View File

@ -63,8 +63,8 @@ class CheckAccountExecutionViewSet(AutomationExecutionViewSet):
if not asset_id:
return Response(status=400, data={"asset_id": "This field is required."})
get_object_or_404(Asset, pk=asset_id)
name = "Check asset risk: {}".format(asset_id)
asset = get_object_or_404(Asset, pk=asset_id)
name = "Check asset risk: {}".format(asset.name)
execution = AutomationExecution()
execution.snapshot = {
"assets": [asset_id],

View File

@ -14,6 +14,11 @@
</div>
<div class="container-section collapsible-content" id="basic-info-content">
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Date start' %}</span>
<span class="item-value">{{ execution.date_start | date:"Y/m/d H:i:s" }}</span>
@ -43,12 +48,7 @@
<span class="item-label">{% trans 'Asset not support count' %}</span>
<span class="item-value">{{ summary.error_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Time using' %}</span>
<span class="item-value">{{ execution.duration }}s</span>

View File

@ -14,6 +14,11 @@
</div>
<div class="container-section collapsible-content" id="basic-info-content">
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.snapshot.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Date start' %}</span>
<span class="item-value">{{ execution.date_start | date:"Y/m/d H:i:s" }}</span>
@ -31,27 +36,30 @@
<div class="item">
<span class="item-label">{% trans 'Weak password' %}</span>
<span class="item-value">{{ summary.weak_password | default:0 }}</span>
<span class="item-value{% if summary.weak_password > 0 %} red{% endif %}">
{{ summary.weak_password | default:0 }}
</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Leaked password' %}</span>
<span class="item-value">{{ summary.leaked_password | default:0 }}</span>
<span class="item-value {% if summary.leaked_password > 0 %} red {% endif %}">
{{ summary.leaked_password | default:0 }}
</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Repeated password' %}</span>
<span class="item-value">{{ summary.repeated_password | default:0 }}</span>
<span class="item-value {% if summary.repeated_password > 0 %} red {% endif %}">
{{ summary.repeated_password | default:0 }}
</span>
</div>
<div class="item">
<span class="item-label">{% trans 'No secret' %}</span>
<span class="item-value">{{ summary.no_secret | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
<span class="item-value {% if summary.no_secret > 0 %} red {% endif %}">
{{ summary.no_secret | default:0 }}
</span>
</div>
<div class="item">
@ -205,6 +213,9 @@
font: 500 14px/22px 'PingFang SC';
}
.container-section .item .item-value.red {
color: red;
}
.custom-table {
margin-bottom: 0;
@ -254,6 +265,7 @@
color: #2e7d32;
}
.lost-accounts .section-header span {
background: #fbe9e7;
color: #d84315;

View File

@ -12,6 +12,11 @@
</div>
<div class="container-section collapsible-content" id="basic-info-content">
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Date start' %}</span>
<span class="item-value">{{ execution.date_start | date:"Y/m/d H:i:s" }}</span>
@ -42,11 +47,6 @@
<span class="item-value">{{ summary.error_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Time using' %}</span>
<span class="item-value">{{ execution.duration }}s</span>

View File

@ -13,6 +13,11 @@
</div>
<div class="container-section collapsible-content" id="basic-info-content">
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Date start' %}</span>
<span class="item-value">{{ execution.date_start | date:"Y/m/d H:i:s" }}</span>
@ -42,12 +47,7 @@
<span class="item-label">{% trans 'Asset not support count' %}</span>
<span class="item-value">{{ summary.error_assets | default:0 }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Task name' %}</span>
<span class="item-value">{{ execution.automation.name }}</span>
</div>
<div class="item">
<span class="item-label">{% trans 'Time using' %}</span>
<span class="item-value">{{ execution.duration }}s</span>

View File

@ -116,7 +116,7 @@ class BaseManager:
automation.save(update_fields=['last_execution_date'])
def update_execution(self):
self.duration = time.time() - self.time_start
self.duration = round(time.time() - self.time_start, 2)
self.execution.date_finished = timezone.now()
self.execution.duration = self.duration
self.execution.summary = self.summary

View File

@ -14,7 +14,8 @@ class CeleryBaseService(BaseService):
print('\n- Start Celery as Distributed Task Queue: {}'.format(self.queue.capitalize()))
ansible_config_path = os.path.join(settings.APPS_DIR, 'libs', 'ansible', 'ansible.cfg')
ansible_modules_path = os.path.join(settings.APPS_DIR, 'libs', 'ansible', 'modules')
os.environ.setdefault('LC_ALL', 'C.UTF-8')
os.environ.setdefault('LC_ALL', 'en_US.UTF-8')
os.environ.setdefault('LANG', 'en_US.UTF-8')
os.environ.setdefault('PYTHONOPTIMIZE', '1')
os.environ.setdefault('ANSIBLE_FORCE_COLOR', 'True')
os.environ.setdefault('ANSIBLE_CONFIG', ansible_config_path)

View File

@ -1465,7 +1465,7 @@
"View": "View",
"ViewMore": "View more",
"ViewPerm": "View",
"ViewSecret": "View ciphertext",
"ViewSecret": "View secret",
"VirtualAccountDetail": "Virtual account details",
"VirtualAccountHelpMsg": "Virtual accounts are specialized accounts with specific purposes when connecting assets.",
"VirtualAccountUpdate": "Virtual account update",