_decodeProperties($_smarty_tpl, array ( 'version' => '4.3.1', 'unifunc' => 'content_694411cd9a16a5_15764470', 'has_nocache_code' => false, 'file_dependency' => array ( '0a52be33c1eedc5833cca9edb209cb9489c25a1a' => array ( 0 => '/var/www/html/yatmack/ui/ui/routers.tpl', 1 => 1757848876, 2 => 'file', ), ), 'includes' => array ( 'file:sections/header.tpl' => 1, 'file:pagination.tpl' => 1, 'file:sections/footer.tpl' => 1, ), ),false)) { function content_694411cd9a16a5_15764470 (Smarty_Internal_Template $_smarty_tpl) { $_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); ?>

 
smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['d']->value, 'ds'); $_smarty_tpl->tpl_vars['ds']->do_else = true; if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['ds']->value) { $_smarty_tpl->tpl_vars['ds']->do_else = false; ?> tpl_vars['ds']->value['enabled'] != 1) {?>class="danger" title="disabled" > smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
ID
tpl_vars['ds']->value['name'];?> tpl_vars['ds']->value['ip_address'];?> Loading... Loading... Loading... Loading... tpl_vars['ds']->value['id'];?>
_subTemplateRender("file:pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); ?>
_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false); ?> > $(document).ready(function() { // Get all router IDs var routerIds = []; $('.router-uptime, .router-used-memory, .router-total-memory, .router-cpu-load, .router-status').each(function() { var routerId = $(this).data('router-id'); if (routerId && routerIds.indexOf(routerId) === -1) { routerIds.push(routerId); } }); // Option 1: Load all router data in parallel with individual timeouts (current implementation) var loadPromises = routerIds.map(function(routerId) { return new Promise(function(resolve, reject) { $.ajax({ url: 'tpl_vars['_url']->value;?> routers/get_resources', data: { router_id: routerId }, dataType: 'json', timeout: 8000, // 8 second timeout per router success: function(resources) { var result = {}; result.routerId = routerId; result.resources = resources; resolve(result); }, error: function(xhr, status, error) { var errorType = status === 'timeout' ? 'timeout' : 'error'; var result = {}; result.routerId = routerId; result.error = errorType; result.resources = null; resolve(result); } }); }); }); // Process all results when they complete Promise.all(loadPromises).then(function(results) { results.forEach(function(result) { var routerId = result.routerId; var resources = result.resources; var error = result.error; // Find all elements for this router var row = $('[data-router-id="' + routerId + '"]').first().closest('tr'); if (error) { // Handle error state row.find('.router-uptime').html('' + (error === 'timeout' ? 'Timeout' : 'Error') + ''); row.find('.router-used-memory').html('' + (error === 'timeout' ? 'Timeout' : 'Error') + ''); row.find('.router-cpu-load').html('' + (error === 'timeout' ? 'Timeout' : 'Error') + ''); row.find('.router-status').html('' + (error === 'timeout' ? 'Timeout' : 'Error') + ''); } else if (resources) { // Update all fields for this router row.find('.router-uptime').html(resources.uptime || 'N/A'); row.find('.router-used-memory').html(resources.freeMemory || 'N/A'); row.find('.router-cpu-load').html(resources.cpuLoad || 'N/A'); // Update router status var statusElement = row.find('.router-status'); if (resources.status === 'Online') { statusElement.html('Online'); } else { statusElement.html('Offline'); } } else { // No data available row.find('.router-uptime').html('N/A'); row.find('.router-used-memory').html('N/A'); row.find('.router-cpu-load').html('N/A'); row.find('.router-status').html('Offline'); } }); }); // Option 2: Alternative bulk loading approach (commented out - uncomment to use) /* $.ajax({ url: 'tpl_vars['_url']->value;?> routers/get_all_resources', dataType: 'json', timeout: 15000, // 15 second timeout for bulk request success: function(allResources) { Object.keys(allResources).forEach(function(routerId) { var resources = allResources[routerId]; var row = $('[data-router-id="' + routerId + '"]').first().closest('tr'); if (resources) { row.find('.router-uptime').html(resources.uptime || 'N/A'); row.find('.router-used-memory').html(resources.freeMemory || 'N/A'); row.find('.router-cpu-load').html(resources.cpuLoad || 'N/A'); var statusElement = row.find('.router-status'); if (resources.status === 'Online') { statusElement.html('Online'); } else { statusElement.html('Offline'); } } else { row.find('.router-uptime').html('N/A'); row.find('.router-used-memory').html('N/A'); row.find('.router-cpu-load').html('N/A'); row.find('.router-status').html('Offline'); } }); }, error: function(xhr, status, error) { console.error('Bulk loading failed:', error); // Fallback to individual loading $('.router-uptime, .router-used-memory, .router-cpu-load, .router-status').html('Error'); } }); */ // Reboot router $('.btn-reboot').on('click', function() { var routerId = $(this).data('router-id'); if (confirm('Are you sure you want to reboot this router?')) { $.ajax({ url: 'tpl_vars['_url']->value;?> routers/reboot', data: { router_id: routerId }, dataType: 'json', success: function(response) { if (response.status === 'Rebooting') { alert(response.message); } else { alert('Error: ' + response.message); } }, error: function(xhr, status, error) { console.error(xhr.responseText); alert('Failed to send reboot command. Please try again.'); } }); } }); }); >