Client search (#303)
This commit is contained in:
		
							parent
							
								
									cc285c5c20
								
							
						
					
					
						commit
						40a0ba859e
					
				|  | @ -46,17 +46,17 @@ | ||||||
|             </ul> |             </ul> | ||||||
| 
 | 
 | ||||||
|             <!-- SEARCH FORM --> |             <!-- SEARCH FORM --> | ||||||
| <!--            <form class="form-inline ml-3">--> |             <form class="form-inline ml-3" style="display: none" id="search-form"> | ||||||
| <!--                <div class="input-group input-group-sm">--> |                 <div class="input-group input-group-sm"> | ||||||
| <!--                    <input class="form-control form-control-navbar" type="search" placeholder="Search"--> |                     <input class="form-control form-control-navbar" placeholder="Search" | ||||||
| <!--                        aria-label="Search">--> |                         aria-label="Search" id="search-input"> | ||||||
| <!--                    <div class="input-group-append">--> |                     <div class="input-group-append"> | ||||||
| <!--                        <button class="btn btn-navbar" type="submit">--> |                         <button class="btn-navbar" type="submit" disabled> | ||||||
| <!--                            <i class="fas fa-search"></i>--> |                             <i class="fas fa-search"></i> | ||||||
| <!--                        </button>--> |                         </button> | ||||||
| <!--                    </div>--> |                     </div> | ||||||
| <!--                </div>--> |                 </div> | ||||||
| <!--            </form>--> |             </form> | ||||||
| 
 | 
 | ||||||
|             <!-- Right navbar links --> |             <!-- Right navbar links --> | ||||||
|             <div class="navbar-nav ml-auto"> |             <div class="navbar-nav ml-auto"> | ||||||
|  |  | ||||||
|  | @ -252,6 +252,28 @@ Wireguard Clients | ||||||
|             populateClientList(); |             populateClientList(); | ||||||
|         }) |         }) | ||||||
| 
 | 
 | ||||||
|  |         // show search bar and override :contains to be case-insensitive | ||||||
|  |         $(document).ready(function () { | ||||||
|  |             $("#search-form").show(); | ||||||
|  |             jQuery.expr[':'].contains = function(a, i, m) { | ||||||
|  |                 return jQuery(a).text().toUpperCase() | ||||||
|  |                     .indexOf(m[3].toUpperCase()) >= 0; | ||||||
|  |             }; | ||||||
|  |         }) | ||||||
|  | 
 | ||||||
|  |         // hide all clients and display only the ones that meet the search criteria (name, email, IP) | ||||||
|  |         $('#search-input').keyup(function () { | ||||||
|  |             var query = $(this).val(); | ||||||
|  |             $('.col-lg-4').hide(); | ||||||
|  |             $(".info-box-text").each(function() { | ||||||
|  |                 if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0) | ||||||
|  |                 { | ||||||
|  |                     $(this).filter(':contains("' + query + '")').parent().parent().parent().show(); | ||||||
|  |                 } | ||||||
|  |                 }) | ||||||
|  |             $(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show(); | ||||||
|  |         }) | ||||||
|  | 
 | ||||||
|         // modal_pause_client modal event |         // modal_pause_client modal event | ||||||
|         $("#modal_pause_client").on('show.bs.modal', function (event) { |         $("#modal_pause_client").on('show.bs.modal', function (event) { | ||||||
|             const button = $(event.relatedTarget); |             const button = $(event.relatedTarget); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue