mirror of https://github.com/jumpserver/jumpserver
fix: report
parent
24bd7b7e1a
commit
d9d034488f
|
@ -7,6 +7,7 @@ from django.db.models.functions import Concat
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
|
from accounts.const import Source
|
||||||
from accounts.models import Account, AccountTemplate
|
from accounts.models import Account, AccountTemplate
|
||||||
from assets.const import Connectivity
|
from assets.const import Connectivity
|
||||||
from common.permissions import IsValidLicense
|
from common.permissions import IsValidLicense
|
||||||
|
@ -58,7 +59,7 @@ class AccountStatisticApi(DateRangeMixin, APIView):
|
||||||
stats['template_total'] = self.template_qs.count()
|
stats['template_total'] = self.template_qs.count()
|
||||||
|
|
||||||
source_pie_data = [
|
source_pie_data = [
|
||||||
{'name': str(source), 'value': total}
|
{'name': str(Source(source).label), 'value': total}
|
||||||
for source, total in
|
for source, total in
|
||||||
qs.values('source').annotate(
|
qs.values('source').annotate(
|
||||||
total=Count(1)
|
total=Count(1)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
|
||||||
from accounts.const import AutomationTypes
|
from accounts.const import AutomationTypes
|
||||||
|
@ -63,7 +64,10 @@ class AccountAutomationApi(DateRangeMixin, APIView):
|
||||||
|
|
||||||
metrics = {}
|
metrics = {}
|
||||||
for tp, values in tp_map.items():
|
for tp, values in tp_map.items():
|
||||||
_tp = AutomationTypes(tp).label
|
if tp == AutomationTypes.change_secret:
|
||||||
|
_tp = _('Account change secret')
|
||||||
|
else:
|
||||||
|
_tp = AutomationTypes(tp).label
|
||||||
metrics[str(_tp)] = values
|
metrics[str(_tp)] = values
|
||||||
|
|
||||||
return metrics
|
return metrics
|
||||||
|
|
Loading…
Reference in New Issue