mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	some bugfixing
This commit is contained in:
		| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| $common_output[] = ' | $common_output[] = ' | ||||||
| <div class="table-responsive"> | <div class="table-responsive"> | ||||||
|     <table id="stp-ports" class="table table-condensed table-hover table-striped"> |     <table id="stp-ports" class="table table-condensed table-hover"> | ||||||
|         <thead> |         <thead> | ||||||
|             <tr> |             <tr> | ||||||
|                 <th data-column-id="port">Port</th> |                 <th data-column-id="port">Port</th> | ||||||
| @@ -14,16 +14,17 @@ $common_output[] = ' | |||||||
|                 <th data-column-id="designatedCost">Designated cost</th> |                 <th data-column-id="designatedCost">Designated cost</th> | ||||||
|                 <th data-column-id="designatedBridge">Designated bridge</th> |                 <th data-column-id="designatedBridge">Designated bridge</th> | ||||||
|                 <th data-column-id="designatedPort">Designated port</th> |                 <th data-column-id="designatedPort">Designated port</th> | ||||||
|                 <th data-column-id="forwardTransitions">Fwd trasitions</th> |                 <th data-column-id="forwardTransitions">Forward transitions</th> | ||||||
|             </tr> |             </tr> | ||||||
|         </thead> |         </thead> | ||||||
|     <table> |     </table> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
|  |  | ||||||
| var grid = $("#stp-ports").bootgrid( {  | var grid = $("#stp-ports").bootgrid( {  | ||||||
|     ajax: true, |     ajax: true, | ||||||
|  |     templates: {search: ""}, | ||||||
|     post: function ()  |     post: function ()  | ||||||
|     { |     { | ||||||
|         return { |         return { | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| <?php | <?php | ||||||
|  |  | ||||||
|  | echo '<table class="table table-condensed table-striped table-hover">'; | ||||||
| $stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id'])); | $stp_raw = dbFetchRow('SELECT * FROM `stp` WHERE `device_id` = ?', array($device['device_id'])); | ||||||
| $stp = array ( | $stp = array ( | ||||||
|     'Root bridge'                 => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No', |     'Root bridge'                 => ($stp_raw['rootBridge'] == 1) ? 'Yes' : 'No', | ||||||
| @@ -22,8 +23,9 @@ $stp = array ( | |||||||
| foreach (array_keys($stp) as $key) { | foreach (array_keys($stp) as $key) { | ||||||
|     echo " |     echo " | ||||||
|       <tr> |       <tr> | ||||||
|         <td width=280 class=list-large>$key</td> |         <td>$key</td> | ||||||
|         <td class=box-desc>$stp[$key]</td> |         <td>$stp[$key]</td> | ||||||
|       </tr> |       </tr> | ||||||
|     "; |     "; | ||||||
| } | } | ||||||
|  | echo '</table>'; | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ $param[] = $device_id; | |||||||
|  |  | ||||||
| $sql = " FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?"; | $sql = " FROM `ports_stp` `ps` JOIN `ports` `p` ON `ps`.`port_id`=`p`.`port_id` WHERE `ps`.`device_id` = ?"; | ||||||
|  |  | ||||||
| $count_sql = "SELECT COUNT(ports_stp_id) $sql"; | $count_sql = "SELECT COUNT(*) $sql"; | ||||||
| $total     = dbFetchCell($count_sql, $param); | $total     = dbFetchCell($count_sql, $param); | ||||||
| if (empty($total)) { | if (empty($total)) { | ||||||
|         $total = 0; |         $total = 0; | ||||||
|   | |||||||
| @@ -35,14 +35,8 @@ unset($sep); | |||||||
|  |  | ||||||
| print_optionbar_end(); | print_optionbar_end(); | ||||||
|  |  | ||||||
| echo '<table border="0" cellspacing="0" cellpadding="5" width="100%">'; |  | ||||||
|  |  | ||||||
| if ($vars['view'] == 'basic') { | if ($vars['view'] == 'basic') { | ||||||
|     //$i = '1'; |  | ||||||
|     foreach (dbFetchRows("SELECT * FROM `stp` WHERE `device_id` = ? ORDER BY 'stp_id'", array($device['device_id'])) as $stp) { |  | ||||||
|     include 'includes/print-stp.inc.php'; |     include 'includes/print-stp.inc.php'; | ||||||
|     //    $i++; |  | ||||||
|     } |  | ||||||
| }     | }     | ||||||
|  |  | ||||||
| if ($vars['view'] == 'ports') { | if ($vars['view'] == 'ports') { | ||||||
| @@ -50,6 +44,4 @@ if ($vars['view'] == 'ports') { | |||||||
|     echo implode('',$common_output); |     echo implode('',$common_output); | ||||||
| } | } | ||||||
|  |  | ||||||
| echo '</table>'; |  | ||||||
|  |  | ||||||
| $pagetitle[] = 'STP'; | $pagetitle[] = 'STP'; | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								sql-schema/095.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								sql-schema/095.sql
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | CREATE TABLE IF NOT EXISTS `ports_stp` (`port_stp_id` int(11) NOT NULL,`device_id` int(11) NOT NULL,`port_id` int(11) NOT NULL,`priority` tinyint(3) unsigned NOT NULL,`state` varchar(11) NOT NULL,`enable` varchar(8) NOT NULL,`pathCost` int(10) unsigned NOT NULL,`designatedRoot` varchar(32) NOT NULL,`designatedCost` smallint(5) unsigned NOT NULL,`designatedBridge` varchar(32) NOT NULL,`designatedPort` mediumint(9) NOT NULL,`forwardTransitions` int(10) unsigned NOT NULL) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | ||||||
|  | ALTER TABLE `ports_stp` ADD PRIMARY KEY (`port_stp_id`), ADD UNIQUE KEY `device_id` (`device_id`,`port_id`); | ||||||
|  | ALTER TABLE `ports_stp` MODIFY `port_stp_id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1; | ||||||
		Reference in New Issue
	
	Block a user