Przeglądaj źródła

Hide / show allowed ips box on demenad

Jaap Marcus 5 lat temu
rodzic
commit
fead09202b

+ 8 - 1
web/js/pages/edit_server.js

@@ -6,4 +6,11 @@ $('#backup_type').change(function (){
        $('#backup_bucket').hide();
        $('#backup_sftp').show();
    }
-});
+});
+$('#api').change(function (){
+       if(this.value == 'yes'){
+           $('#security_ip').show();
+       }else{
+           $('#security_ip').hide();
+       }
+    });

+ 8 - 3
web/templates/admin/edit_server.html

@@ -955,7 +955,7 @@
                                     </table>
                                 </td>
                             </tr>
-<tr>
+                            <tr>
                                 <td class="vst-text input-label step-top advanced-options">
                                     <a href="javascript:elementHideShow('security');" class="vst-text">
                                         <i class="fas fa-key"></i><b><?php print _('Security');?> <img src="/images/arrow.png"></b>
@@ -964,7 +964,7 @@
                             </tr>
                             <tr>
                                 <td class="vst-text input-label step-left">
-                                    <table style="<?php if (empty($v_security_adv)) echo 'display:none';?> ;" id="security">
+                                    <table style="<?php if (empty($v_security_adv)) echo 'display:none;';?>" id="security">
                                         <tr>
                                             <td class="vst-text input-label">
                                                 <?php print _('Enable API access');?>
@@ -972,13 +972,16 @@
                                         </tr>
                                         <tr>
                                             <td>
-                                                <select class="vst-list" name="v_api">
+                                                <select class="vst-list" name="v_api" id="api">
                                                     <option value='yes'><?php print _('yes'); ?></option>
                                                     <option value='no' <?php if($_SESSION['API'] == 'no') echo 'selected' ?> ><?php print _('no'); ?></option>
                                                 </select>
                                                 <br><br>
                                             </td>
                                         </tr>
+                                        <tr>
+                                            <td>
+                                        <table id="security_ip" style="<?php if ($_SESSION['API'] == "no") echo 'display:none;';?>">
                                         <tr>
                                             <td class="vst-text input-label">
                                                 <?php print _('Allowed IP Addresses for API');?> <span class="optional" style="float:right">1 IP address per line</span>
@@ -994,6 +997,8 @@
                                                 <br><br>
                                             </td>
                                         </tr>
+                                        </table>
+                                            </td></tr>
                                         <tr>
                                             <td class="vst-text input-label">
                                                 <?php print _('Login screen style');?>