From 4295aec49274efc70980c25be91f8e4138575895 Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 14 Jan 2020 10:53:46 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E7=B3=BB=E7=BB=9F=E7=94=A8=E6=88=B7?= =?UTF-8?q?(mysql)=E5=BC=80=E6=94=BE=E5=91=BD=E4=BB=A4=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/templates/assets/_system_user.html | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/apps/assets/templates/assets/_system_user.html b/apps/assets/templates/assets/_system_user.html index c3cba50e7..d941bf20a 100644 --- a/apps/assets/templates/assets/_system_user.html +++ b/apps/assets/templates/assets/_system_user.html @@ -88,6 +88,7 @@ var auto_generate_key = '#'+'{{ form.auto_generate_key.id_for_label }}'; var password_id = '#' + '{{ form.password.id_for_label }}'; var private_key_id = '#' + '{{ form.private_key.id_for_label }}'; var auto_push_id = '#' + '{{ form.auto_push.id_for_label }}'; +var command_filter_block_id = '#command-filter-block'; var sudo_id = '#' + '{{ form.sudo.id_for_label }}'; var shell_id = '#' + '{{ form.shell.id_for_label }}'; @@ -101,17 +102,27 @@ function autoLoginModeProtocol() { $(private_key_id).closest('.form-group').addClass('hidden'); $(password_id).closest('.form-group').removeClass('hidden'); $(auto_push_id).closest('.form-group').removeClass('hidden'); - $('#command-filter-block').addClass('hidden'); + $(command_filter_block_id).addClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } - else if (['vnc', 'mysql'].indexOf(protocol) !== -1) { + else if (protocol === 'vnc') { $('.auth-fields').removeClass('hidden'); $(auto_generate_key).closest('.form-group').addClass('hidden'); $(private_key_id).closest('.form-group').addClass('hidden'); $(password_id).closest('.form-group').removeClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').addClass('hidden'); + $(command_filter_block_id).addClass('hidden'); + $(sudo_id).closest('.form-group').addClass('hidden'); + $(shell_id).closest('.form-group').addClass('hidden'); + } + else if (protocol === 'mysql'){ + $('.auth-fields').removeClass('hidden'); + $(auto_generate_key).closest('.form-group').addClass('hidden'); + $(private_key_id).closest('.form-group').addClass('hidden'); + $(password_id).closest('.form-group').removeClass('hidden'); + $(auto_push_id).closest('.form-group').addClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } @@ -121,7 +132,7 @@ function autoLoginModeProtocol() { $(private_key_id).closest('.form-group').addClass('hidden'); $(password_id).closest('.form-group').removeClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').removeClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } @@ -131,7 +142,7 @@ function autoLoginModeProtocol() { $(private_key_id).closest('.form-group').removeClass('hidden'); $(password_id).closest('.form-group').removeClass('hidden'); $(auto_push_id).closest('.form-group').removeClass('hidden'); - $('#command-filter-block').removeClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').removeClass('hidden'); $(shell_id).closest('.form-group').removeClass('hidden'); } @@ -147,17 +158,27 @@ function manualLoginModeProtocol() { $(password_id).closest('.form-group').addClass('hidden'); $(private_key_id).closest('.form-group').addClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').addClass('hidden'); + $(command_filter_block_id).addClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } - else if (['vnc', 'mysql'].indexOf(protocol) !== -1) { + else if (protocol === 'vnc'){ $('.auth-fields').addClass('hidden'); $(auto_generate_key).closest('.form-group').addClass('hidden'); $(password_id).closest('.form-group').addClass('hidden'); $(private_key_id).closest('.form-group').addClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').addClass('hidden'); + $(command_filter_block_id).addClass('hidden'); + $(sudo_id).closest('.form-group').addClass('hidden'); + $(shell_id).closest('.form-group').addClass('hidden'); + } + else if (protocol === 'mysql'){ + $('.auth-fields').addClass('hidden'); + $(auto_generate_key).closest('.form-group').addClass('hidden'); + $(password_id).closest('.form-group').addClass('hidden'); + $(private_key_id).closest('.form-group').addClass('hidden'); + $(auto_push_id).closest('.form-group').addClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } @@ -167,7 +188,7 @@ function manualLoginModeProtocol() { $(password_id).closest('.form-group').addClass('hidden'); $(private_key_id).closest('.form-group').addClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').removeClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').addClass('hidden'); $(shell_id).closest('.form-group').addClass('hidden'); } @@ -177,7 +198,7 @@ function manualLoginModeProtocol() { $(password_id).closest('.form-group').addClass('hidden'); $(private_key_id).closest('.form-group').addClass('hidden'); $(auto_push_id).closest('.form-group').addClass('hidden'); - $('#command-filter-block').removeClass('hidden'); + $(command_filter_block_id).removeClass('hidden'); $(sudo_id).closest('.form-group').removeClass('hidden'); $(shell_id).closest('.form-group').removeClass('hidden'); }