فهرست منبع

switch show/hide logs by the 'showLog' flag

Yuki Takei 8 سال پیش
والد
کامیت
93d1640845
2فایلهای تغییر یافته به همراه16 افزوده شده و 11 حذف شده
  1. 1 1
      lib/views/admin/widget/passport/ldap.html
  2. 15 10
      lib/views/widget/passport/ldap-association-tester.html

+ 1 - 1
lib/views/admin/widget/passport/ldap.html

@@ -310,7 +310,7 @@
 
       <div class="modal-body">
 
-        {% include '../../../widget/passport/ldap-association-tester.html' %}
+        {% include '../../../widget/passport/ldap-association-tester.html' with { showLog: true } %}
 
       </div><!-- /.modal-body -->
 

+ 15 - 10
lib/views/widget/passport/ldap-association-tester.html

@@ -17,10 +17,12 @@
 
   </fieldset>
 
+  {% if showLog %}
   <fieldset>
     <h5>Logs</h5>
     <textarea id="taLogs" class="col-xs-12" rows="4" readonly></textarea>
   </fieldset>
+  {% endif %}
 
   <fieldset class="mt-4">
     <button type="button" class="btn btn-default col-xs-offset-5 col-xs-2" onclick="testLdapCredentials()">{{ t('Test') }}</button>
@@ -74,16 +76,19 @@
             showMessage($id, data.message, data.status);
           }
 
-          if (data.err) {
-            addLogs($id, data.err);
-          }
-          if (data.ldapConfiguration) {
-            const prettified = JSON.stringify(data.ldapConfiguration.server, undefined, 4);
-            addLogs($id, `LDAP Configuration : ${prettified}`);
-          }
-          if (data.ldapAccountInfo) {
-            const prettified = JSON.stringify(data.ldapAccountInfo, undefined, 4);
-            addLogs($id, `Retrieved LDAP Account : ${prettified}`);
+          // add logs
+          if ('true' === '{{showLog}}') {
+            if (data.err) {
+              addLogs($id, data.err);
+            }
+            if (data.ldapConfiguration) {
+              const prettified = JSON.stringify(data.ldapConfiguration.server, undefined, 4);
+              addLogs($id, `LDAP Configuration : ${prettified}`);
+            }
+            if (data.ldapAccountInfo) {
+              const prettified = JSON.stringify(data.ldapAccountInfo, undefined, 4);
+              addLogs($id, `Retrieved LDAP Account : ${prettified}`);
+            }
           }
         })
         .fail(function() {