| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  | <?php | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |  * LibreNMS | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-03-14 21:17:08 +01:00
										 |  |  |  * Copyright (c) 2018 Søren Friis Rosiak <sorenrosiak@gmail.com> | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |  * This program is free software: you can redistribute it and/or modify it | 
					
						
							|  |  |  |  * under the terms of the GNU General Public License as published by the | 
					
						
							|  |  |  |  * Free Software Foundation, either version 3 of the License, or (at your | 
					
						
							|  |  |  |  * option) any later version.  Please see LICENSE.txt at the top level of | 
					
						
							|  |  |  |  * the source code distribution for details. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | $pagetitle[] = 'Oxidized'; | 
					
						
							|  |  |  | ?>
 | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  | <div class="col-xs-12"> | 
					
						
							|  |  |  |     <h2>Oxidized</h2> | 
					
						
							|  |  |  |     <div class="panel-heading"> | 
					
						
							|  |  |  |         <ul class="nav nav-tabs"> | 
					
						
							|  |  |  |             <li class="active"><a href="#list" data-toggle="tab">Node List</a></li> | 
					
						
							|  |  |  |             <li><a href="#search" data-toggle="tab">Config Search</a></li> | 
					
						
							| 
									
										
										
										
											2018-01-11 13:21:05 +00:00
										 |  |  |             <li><a href="<?php echo generate_url(array('page' => 'tools', 'tool' => 'oxidized-cfg-check')); ?>">Oxidized config validation</a></li> | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |         </ul> | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |     </div> | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |     <div class="panel with-nav-tabs panel-default"> | 
					
						
							|  |  |  |         <div class="panel-body"> | 
					
						
							|  |  |  |             <div class="tab-content"> | 
					
						
							|  |  |  |                 <div class="tab-pane fade in active" id="list"> | 
					
						
							|  |  |  |                     <div class="table-responsive"> | 
					
						
							| 
									
										
										
										
											2018-03-14 21:17:08 +01:00
										 |  |  |                         <button type='submit' class='btn btn-success btn-sm' name='btn-reload-nodes' id='btn-reload-nodes'><i class='fa fa-refresh'></i> Reload node list</button> | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |                         <table id="oxidized-nodes" class="table table-hover table-condensed table-striped"> | 
					
						
							|  |  |  |                             <thead> | 
					
						
							|  |  |  |                             <tr> | 
					
						
							|  |  |  |                                 <th data-column-id="hostname" data-order="desc">Hostname</th> | 
					
						
							| 
									
										
										
										
											2019-04-09 11:37:46 -05:00
										 |  |  |                                 <th data-column-id="sysname" data-visible=" <?php echo (!Config::get('force_ip_to_sysname')  ? 'true' : 'false') ?>">SysName</th> | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |                                 <th data-column-id="last_status">Last Status</th> | 
					
						
							|  |  |  |                                 <th data-column-id="last_update">Last Update</th> | 
					
						
							|  |  |  |                                 <th data-column-id="model">Model</th> | 
					
						
							|  |  |  |                                 <th data-column-id="group">Group</th> | 
					
						
							| 
									
										
										
										
											2018-09-05 02:09:27 +02:00
										 |  |  |                                 <th data-column-id="actions"></th> | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |                             </tr> | 
					
						
							|  |  |  |                             </thead> | 
					
						
							|  |  |  |                             <tbody> | 
					
						
							|  |  |  |                             <?php get_oxidized_nodes_list();?>
 | 
					
						
							|  |  |  |                             </tbody> | 
					
						
							|  |  |  |                         </table> | 
					
						
							|  |  |  |                     </div> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |                 <div class="tab-pane fade" id="search"> | 
					
						
							|  |  |  |                     <form class="form-horizontal" action="" method="post"> | 
					
						
							|  |  |  |                         <br/> | 
					
						
							|  |  |  |                         <div class="input-group"> | 
					
						
							|  |  |  |                             <input type="text" class="form-control" id="input-parameter" | 
					
						
							|  |  |  |                                    placeholder="service password-encryption etc."> | 
					
						
							|  |  |  |                             <span class="input-group-btn"> | 
					
						
							|  |  |  |                                 <button type="submit" name="btn-search" id="btn-search" class="btn btn-primary">Search</button> | 
					
						
							|  |  |  |                             </span> | 
					
						
							|  |  |  |                         </div> | 
					
						
							|  |  |  |                     </form> | 
					
						
							|  |  |  |                     <br/> | 
					
						
							|  |  |  |                     <div id="search-output" class="alert alert-success" style="display: none;"></div> | 
					
						
							|  |  |  |                     <br/> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |             </div> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | </div> | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  | <script> | 
					
						
							| 
									
										
										
										
											2018-09-05 02:09:27 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |     $("[name='btn-search']").on('click', function (event) { | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |         event.preventDefault(); | 
					
						
							|  |  |  |         var $this = $(this); | 
					
						
							|  |  |  |         var search_in_conf_textbox = $("#input-parameter").val(); | 
					
						
							|  |  |  |         $.ajax({ | 
					
						
							|  |  |  |             type: 'POST', | 
					
						
							|  |  |  |             url: 'ajax_form.php', | 
					
						
							|  |  |  |             data: { | 
					
						
							| 
									
										
										
										
											2017-01-10 14:46:20 +00:00
										 |  |  |                 type: "search-oxidized-config", | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |                 search_in_conf_textbox: search_in_conf_textbox | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             dataType: "json", | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |             success: function (data) { | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |                 $('#search-output').empty(); | 
					
						
							|  |  |  |                 $("#search-output").show(); | 
					
						
							|  |  |  |                 if (data.output) | 
					
						
							|  |  |  |                     $('#search-output').append('Config appears on the folllowing device(s):<br />'); | 
					
						
							| 
									
										
										
										
											2017-05-05 22:16:39 +01:00
										 |  |  |                     $.each(data.output, function (row, value) { | 
					
						
							|  |  |  |                         $('#search-output').append(value['full_name'] + '<br />'); | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |                 }); | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2017-02-27 23:32:13 +01:00
										 |  |  |             error: function () { | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  |                 toastr.error('Error'); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2018-03-14 21:17:08 +01:00
										 |  |  |     $("[name='btn-reload-nodes']").on('click', function (event) { | 
					
						
							|  |  |  |         $.ajax({ | 
					
						
							|  |  |  |             type: 'POST', | 
					
						
							|  |  |  |             url: 'ajax_form.php', | 
					
						
							|  |  |  |             data: { type: "reload-oxidized-nodes-list" }, | 
					
						
							|  |  |  |             dataType: "json", | 
					
						
							|  |  |  |             success: function (data) { | 
					
						
							|  |  |  |                 if(data['status'] == 'ok') { | 
					
						
							|  |  |  |                     toastr.success(data['message']); | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     toastr.error(data['message']); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             error:function(){ | 
					
						
							|  |  |  |                 toastr.error('An error occured while reloading the Oxidized nodes list'); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |     }); | 
					
						
							| 
									
										
										
										
											2017-01-09 21:09:02 +02:00
										 |  |  | </script> |