mirror of https://github.com/jumpserver/jumpserver
commit
18c388f3a5
|
@ -52,10 +52,11 @@ class BaseAccountHandler:
|
||||||
return header_fields
|
return header_fields
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_row(cls, account, serializer_cls):
|
def create_row(cls, account, serializer_cls, header_fields=None):
|
||||||
serializer = serializer_cls(account)
|
serializer = serializer_cls(account)
|
||||||
data = cls.unpack_data(serializer.data)
|
if not header_fields:
|
||||||
header_fields = cls.get_header_fields(serializer)
|
header_fields = cls.get_header_fields(serializer)
|
||||||
|
data = cls.unpack_data(serializer.data)
|
||||||
row_dict = {}
|
row_dict = {}
|
||||||
for field, header_name in header_fields.items():
|
for field, header_name in header_fields.items():
|
||||||
row_dict[header_name] = data[field]
|
row_dict[header_name] = data[field]
|
||||||
|
@ -74,12 +75,16 @@ class AssetAccountHandler(BaseAccountHandler):
|
||||||
def create_df(cls):
|
def create_df(cls):
|
||||||
df_dict = defaultdict(list)
|
df_dict = defaultdict(list)
|
||||||
sheet_name = AuthBook._meta.verbose_name
|
sheet_name = AuthBook._meta.verbose_name
|
||||||
accounts = AuthBook.get_queryset()
|
|
||||||
|
accounts = AuthBook.get_queryset().select_related('systemuser')
|
||||||
|
if not accounts.first():
|
||||||
|
return df_dict
|
||||||
|
|
||||||
|
header_fields = cls.get_header_fields(AccountSecretSerializer(accounts.first()))
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
account.load_auth()
|
account.load_auth()
|
||||||
row = cls.create_row(account, AccountSecretSerializer)
|
row = cls.create_row(account, AccountSecretSerializer, header_fields)
|
||||||
df_dict[sheet_name].append(row)
|
df_dict[sheet_name].append(row)
|
||||||
|
|
||||||
for k, v in df_dict.items():
|
for k, v in df_dict.items():
|
||||||
df_dict[k] = pd.DataFrame(v)
|
df_dict[k] = pd.DataFrame(v)
|
||||||
|
|
||||||
|
@ -98,7 +103,7 @@ class AppAccountHandler(BaseAccountHandler):
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_df(cls):
|
def create_df(cls):
|
||||||
df_dict = defaultdict(list)
|
df_dict = defaultdict(list)
|
||||||
accounts = Account.get_queryset()
|
accounts = Account.get_queryset().select_related('systemuser')
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
account.load_auth()
|
account.load_auth()
|
||||||
app_type = account.type
|
app_type = account.type
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:8a421482ff4103a9c3ca895b29e739c2cef0dc10a4f9914bfe7226fa3c45cac4
|
oid sha256:67a04954f2a6c1da8c2f40307166a87ba1088e858422378eb638a1d1aafc5a89
|
||||||
size 97592
|
size 97595
|
||||||
|
|
|
@ -1955,7 +1955,7 @@ msgstr "异地登录提醒"
|
||||||
|
|
||||||
#: authentication/notifications.py:52
|
#: authentication/notifications.py:52
|
||||||
msgid "binding reminder"
|
msgid "binding reminder"
|
||||||
msgstr "定时提醒"
|
msgstr "绑定提醒"
|
||||||
|
|
||||||
#: authentication/templates/authentication/_access_key_modal.html:6
|
#: authentication/templates/authentication/_access_key_modal.html:6
|
||||||
msgid "API key list"
|
msgid "API key list"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
from django.utils.translation import gettext
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
|
|
||||||
from notifications.notifications import SystemMessage
|
from notifications.notifications import SystemMessage
|
||||||
|
@ -19,7 +20,7 @@ class ServerPerformanceMessage(SystemMessage):
|
||||||
self.terms_with_errors = terms_with_errors
|
self.terms_with_errors = terms_with_errors
|
||||||
|
|
||||||
def get_html_msg(self) -> dict:
|
def get_html_msg(self) -> dict:
|
||||||
subject = _("Terminal health check warning")
|
subject = gettext("Terminal health check warning")
|
||||||
context = {
|
context = {
|
||||||
'terms_with_errors': self.terms_with_errors
|
'terms_with_errors': self.terms_with_errors
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue