diff options
author | Renato Botelho <renato@netgate.com> | 2015-11-24 07:43:18 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-11-24 07:43:18 -0200 |
commit | 3da670d25bb6122aef4c894e63fe5a3bd35dcac8 (patch) | |
tree | 79b1fb260e1a03f3fb82aa0c23c7208b49ca2a55 /src/usr/local/www/widgets | |
parent | 9528bc24c027adf88cefe7d9eb5d9b7503d45626 (diff) | |
download | pfsense-3da670d25bb6122aef4c894e63fe5a3bd35dcac8.zip pfsense-3da670d25bb6122aef4c894e63fe5a3bd35dcac8.tar.gz |
Move get_pkg_info() call to ajax request to make widget more responsive
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r-- | src/usr/local/www/widgets/widgets/installed_packages.widget.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php index a74da93..5f7e29a 100644 --- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -66,12 +66,20 @@ require_once("functions.inc"); require_once("/usr/local/www/widgets/include/installed_packages.inc"); require_once("pkg-utils.inc"); -$package_list = get_pkg_info(); -$installed_packages = array_filter($package_list, function($v) { - return (isset($v['installed']) || isset($v['broken'])); -}); - if($_REQUEST && $_REQUEST['ajax']) { + $package_list = get_pkg_info(); + $installed_packages = array_filter($package_list, function($v) { + return (isset($v['installed']) || isset($v['broken'])); + }); + + if (empty($installed_packages)) { + print("<div class=\"alert alert-warning\" role=\"alert\">\n"); + print(" <strong>No packages installed.</strong>\n"); + print(" You can install packages <a href=\"pkg_mgr.php\" class=\"alert-link\">here</a>.\n"); + print("</div>\n"); + exit; + } + print("<thead>\n"); print( "<tr>\n"); print( "<th>" . gettext("Name") . "</th>\n"); @@ -163,19 +171,13 @@ if($_REQUEST && $_REQUEST['ajax']) { exit; } +?> -if (empty($installed_packages)): ?> -<div class="alert alert-warning" role="alert"> - <strong>No packages installed.</strong> - You can install packages <a href="pkg_mgr.php" class="alert-link">here</a>. -</div> -<?php else: ?> <div class="table-responsive"> <table id="pkgtbl" class="table table-striped table-hover table-condensed"> <tr><td><?=gettext("Retrieving package data")?> <i class="fa fa-cog fa-spin"</i></td></tr> </table> </div> -<?php endif; ?> <div style="text-align: center;"> <?=gettext("Packages may be added/managed here: ")?> <a href="pkg_mgr_installed.php">System ->Packages</a> @@ -206,4 +208,4 @@ if (empty($installed_packages)): ?> get_pkg_stats(); }); //]]> -</script>
\ No newline at end of file +</script> |