diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po index 524d6d076..fa1799a13 100644 --- a/apps/locale/zh/LC_MESSAGES/django.po +++ b/apps/locale/zh/LC_MESSAGES/django.po @@ -5018,7 +5018,7 @@ msgstr "离线" #: terminal/const.py:81 terminal/const.py:82 terminal/const.py:83 #: terminal/const.py:84 terminal/const.py:85 msgid "DB Client" -msgstr "客户端" +msgstr "数据库客户端" #: terminal/exceptions.py:8 msgid "Bulk create not support" diff --git a/apps/terminal/connect_methods.py b/apps/terminal/connect_methods.py index db5dd4238..70e842e26 100644 --- a/apps/terminal/connect_methods.py +++ b/apps/terminal/connect_methods.py @@ -2,6 +2,7 @@ # from collections import defaultdict +from django.conf import settings from django.db.models import TextChoices from django.utils.translation import ugettext_lazy as _ @@ -78,6 +79,10 @@ class NativeClient(TextChoices): return protocol return None + @classmethod + def xpack_methods(cls): + return [cls.sqlplus, cls.mstsc] + @classmethod def get_methods(cls, os='windows'): clients_map = cls.get_native_clients() @@ -87,6 +92,8 @@ class NativeClient(TextChoices): if isinstance(_clients, dict): _clients = _clients.get(os, _clients['default']) for client in _clients: + if not settings.XPACK_ENABLED and client in cls.xpack_methods(): + continue methods[protocol].append({ 'value': client.value, 'label': client.label, @@ -121,8 +128,10 @@ class AppletMethod: from .models import Applet, AppletHost methods = defaultdict(list) - has_applet_hosts = AppletHost.objects.all().exists() + if not settings.XPACK_ENABLED: + return methods + has_applet_hosts = AppletHost.objects.all().exists() applets = Applet.objects.filter(is_active=True) for applet in applets: for protocol in applet.protocols: