From 7ff39259af62d18a5c4d43b9e97d3486675a9661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=B9=BF?= Date: Fri, 21 Dec 2018 14:57:42 +0800 Subject: [PATCH 1/2] Required opt (#2246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Update] 修改心跳偶人时间 * [Update] 去掉required的label * [Update] 修改默认心跳时间 * [Update] 去掉默认的placeholder * [Update] 修改utils --- apps/assets/forms/asset.py | 9 +-------- apps/assets/forms/domain.py | 4 ---- apps/assets/forms/user.py | 5 ----- .../templates/common/command_storage_create.html | 1 - .../templates/common/replay_storage_create.html | 1 - apps/jumpserver/conf.py | 2 +- apps/jumpserver/settings.py | 3 ++- apps/perms/utils.py | 3 +-- apps/static/css/jumpserver.css | 5 ++++- apps/users/forms.py | 14 -------------- 10 files changed, 9 insertions(+), 38 deletions(-) diff --git a/apps/assets/forms/asset.py b/apps/assets/forms/asset.py index 1ec2ea24f..0a6b2f093 100644 --- a/apps/assets/forms/asset.py +++ b/apps/assets/forms/asset.py @@ -41,9 +41,6 @@ class AssetCreateForm(OrgModelForm): 'nodes': _("Node"), } help_texts = { - 'hostname': '* required', - 'ip': '* required', - 'port': '* required', 'admin_user': _( 'root or other NOPASSWD sudo privilege user existed in asset,' 'If asset is windows or other set any one, more see admin user left menu' @@ -80,10 +77,6 @@ class AssetUpdateForm(OrgModelForm): 'nodes': _("Node"), } help_texts = { - 'hostname': '* required', - 'ip': '* required', - 'port': '* required', - 'cluster': '* required', 'admin_user': _( 'root or other NOPASSWD sudo privilege user existed in asset,' 'If asset is windows or other set any one, more see admin user left menu' @@ -95,7 +88,7 @@ class AssetUpdateForm(OrgModelForm): class AssetBulkUpdateForm(OrgModelForm): assets = forms.ModelMultipleChoiceField( - required=True, help_text='* required', + required=True, label=_('Select assets'), queryset=Asset.objects.all(), widget=forms.SelectMultiple( attrs={ diff --git a/apps/assets/forms/domain.py b/apps/assets/forms/domain.py index 3c733bcc4..635796c97 100644 --- a/apps/assets/forms/domain.py +++ b/apps/assets/forms/domain.py @@ -61,7 +61,3 @@ class GatewayForm(PasswordAndKeyAuthForm, OrgModelForm): 'name': forms.TextInput(attrs={'placeholder': _('Name')}), 'username': forms.TextInput(attrs={'placeholder': _('Username')}), } - help_texts = { - 'name': '* required', - 'username': '* required', - } diff --git a/apps/assets/forms/user.py b/apps/assets/forms/user.py index 81138eab5..575d3e59c 100644 --- a/apps/assets/forms/user.py +++ b/apps/assets/forms/user.py @@ -80,10 +80,6 @@ class AdminUserForm(PasswordAndKeyAuthForm): 'name': forms.TextInput(attrs={'placeholder': _('Name')}), 'username': forms.TextInput(attrs={'placeholder': _('Username')}), } - help_texts = { - 'name': '* required', - 'username': '* required', - } class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm): @@ -150,7 +146,6 @@ class SystemUserForm(OrgModelForm, PasswordAndKeyAuthForm): }), } help_texts = { - 'name': '* required', 'auto_push': _('Auto push system user to asset'), 'priority': _('1-100, High level will be using login asset as default, ' 'if user was granted more than 2 system user'), diff --git a/apps/common/templates/common/command_storage_create.html b/apps/common/templates/common/command_storage_create.html index a3a83f2e7..671b11c94 100644 --- a/apps/common/templates/common/command_storage_create.html +++ b/apps/common/templates/common/command_storage_create.html @@ -41,7 +41,6 @@
-
* required
diff --git a/apps/common/templates/common/replay_storage_create.html b/apps/common/templates/common/replay_storage_create.html index 8b2ab8596..af56c210d 100644 --- a/apps/common/templates/common/replay_storage_create.html +++ b/apps/common/templates/common/replay_storage_create.html @@ -44,7 +44,6 @@
-
* required
diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index d9eeb48cf..61fd84249 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -316,7 +316,7 @@ defaults = { 'EMAIL_SUFFIX': 'jumpserver.org', 'TERMINAL_PASSWORD_AUTH': True, 'TERMINAL_PUBLIC_KEY_AUTH': True, - 'TERMINAL_HEARTBEAT_INTERVAL': 5, + 'TERMINAL_HEARTBEAT_INTERVAL': 20, 'TERMINAL_ASSET_LIST_SORT_BY': 'hostname', 'TERMINAL_ASSET_LIST_PAGE_SIZE': 'auto', 'TERMINAL_SESSION_KEEP_DURATION': 9999, diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 167de3180..ca3d5afa3 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -499,8 +499,9 @@ BOOTSTRAP3 = { # Field class to use in horizontal forms 'horizontal_field_class': 'col-md-9', # Set placeholder attributes to label if no placeholder is provided - 'set_placeholder': True, + 'set_placeholder': False, 'success_css_class': '', + 'required_css_class': 'required', } TOKEN_EXPIRATION = CONFIG.TOKEN_EXPIRATION diff --git a/apps/perms/utils.py b/apps/perms/utils.py index ef8e3d09a..45ec6e039 100644 --- a/apps/perms/utils.py +++ b/apps/perms/utils.py @@ -18,8 +18,7 @@ class GenerateTree: "asset_instance": set("system_user") } """ - self.__all_nodes = Node.objects.all() - self.__node_asset_map = defaultdict(set) + self.__all_nodes = list(Node.objects.all()) self.nodes = defaultdict(dict) def add_asset(self, asset, system_users): diff --git a/apps/static/css/jumpserver.css b/apps/static/css/jumpserver.css index 2a6f06e8c..c979678e0 100644 --- a/apps/static/css/jumpserver.css +++ b/apps/static/css/jumpserver.css @@ -438,4 +438,7 @@ div.dataTables_wrapper div.dataTables_filter { white-space: nowrap; } - +.form-group .required .control-label:after { + content:"*"; + color:red; +} diff --git a/apps/users/forms.py b/apps/users/forms.py index fb492412f..521bc13ae 100644 --- a/apps/users/forms.py +++ b/apps/users/forms.py @@ -63,11 +63,6 @@ class UserCreateUpdateForm(OrgModelForm): 'username', 'name', 'email', 'groups', 'wechat', 'phone', 'role', 'date_expired', 'comment', 'otp_level' ] - help_texts = { - 'username': '* required', - 'name': '* required', - 'email': '* required', - } widgets = { 'otp_level': forms.RadioSelect(), 'groups': forms.SelectMultiple( @@ -141,11 +136,6 @@ class UserProfileForm(forms.ModelForm): 'username', 'name', 'email', 'wechat', 'phone', ] - help_texts = { - 'username': '* required', - 'name': '* required', - 'email': '* required', - } UserProfileForm.verbose_name = _("Profile") @@ -263,7 +253,6 @@ UserPublicKeyForm.verbose_name = _("Public key") class UserBulkUpdateForm(OrgModelForm): users = forms.ModelMultipleChoiceField( required=True, - help_text='* required', label=_('Select users'), queryset=User.objects.all(), widget=forms.SelectMultiple( @@ -346,9 +335,6 @@ class UserGroupForm(OrgModelForm): fields = [ 'name', 'users', 'comment', ] - help_texts = { - 'name': '* required' - } class FileForm(forms.Form): From ac9178cb9399a22d75056180dd8c7bb65bb3349d Mon Sep 17 00:00:00 2001 From: BaiJiangJie <32935519+BaiJiangJie@users.noreply.github.com> Date: Fri, 21 Dec 2018 14:59:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0deb=5Frequirem?= =?UTF-8?q?ents=E4=BE=9D=E8=B5=96=20(#2239)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements/deb_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/deb_requirements.txt b/requirements/deb_requirements.txt index 07b3441c4..f32a217e6 100644 --- a/requirements/deb_requirements.txt +++ b/requirements/deb_requirements.txt @@ -1 +1 @@ -libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk python-dev openssl libssl-dev libldap2-dev libsasl2-dev sqlite libkrb5-dev sshpass +libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk python-dev openssl libssl-dev libldap2-dev libsasl2-dev sqlite libkrb5-dev sshpass libmysqlclient-dev