Skip to content

Commit

Permalink
Merge pull request #7629 from jumpserver/dev
Browse files Browse the repository at this point in the history
v2.19.0-rc3
  • Loading branch information
BaiJiangJie committed Feb 17, 2022
2 parents 7be76fe + b088362 commit 18c388f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
17 changes: 11 additions & 6 deletions apps/assets/task_handlers/backup/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ def get_header_fields(cls, serializer: serializers.Serializer):
return header_fields

@classmethod
def create_row(cls, account, serializer_cls):
def create_row(cls, account, serializer_cls, header_fields=None):
serializer = serializer_cls(account)
if not header_fields:
header_fields = cls.get_header_fields(serializer)
data = cls.unpack_data(serializer.data)
header_fields = cls.get_header_fields(serializer)
row_dict = {}
for field, header_name in header_fields.items():
row_dict[header_name] = data[field]
Expand All @@ -74,12 +75,16 @@ def get_filename(plan_name):
def create_df(cls):
df_dict = defaultdict(list)
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:
account.load_auth()
row = cls.create_row(account, AccountSecretSerializer)
row = cls.create_row(account, AccountSecretSerializer, header_fields)
df_dict[sheet_name].append(row)

for k, v in df_dict.items():
df_dict[k] = pd.DataFrame(v)

Expand All @@ -98,7 +103,7 @@ def get_filename(plan_name):
@classmethod
def create_df(cls):
df_dict = defaultdict(list)
accounts = Account.get_queryset()
accounts = Account.get_queryset().select_related('systemuser')
for account in accounts:
account.load_auth()
app_type = account.type
Expand Down
4 changes: 2 additions & 2 deletions apps/locale/zh/LC_MESSAGES/django.mo
Git LFS file not shown
2 changes: 1 addition & 1 deletion apps/locale/zh/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -1955,7 +1955,7 @@ msgstr "异地登录提醒"

#: authentication/notifications.py:52
msgid "binding reminder"
msgstr "定时提醒"
msgstr "绑定提醒"

#: authentication/templates/authentication/_access_key_modal.html:6
msgid "API key list"
Expand Down
3 changes: 2 additions & 1 deletion apps/ops/notifications.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext
from django.template.loader import render_to_string

from notifications.notifications import SystemMessage
Expand All @@ -19,7 +20,7 @@ def __init__(self, terms_with_errors):
self.terms_with_errors = terms_with_errors

def get_html_msg(self) -> dict:
subject = _("Terminal health check warning")
subject = gettext("Terminal health check warning")
context = {
'terms_with_errors': self.terms_with_errors
}
Expand Down

0 comments on commit 18c388f

Please sign in to comment.