From e4e35fcdd04ad128ab5c4a69b5459504caab5915 Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sat, 26 Dec 2015 19:40:50 +0100 Subject: haproxy-devel, widget updated for better refresh configuration handling + prepare 2.3 --- config/haproxy-devel/pkg/haproxy_gui.inc | 20 ++++ config/haproxy-devel/www/haproxy_listeners.php | 3 +- config/haproxy-devel/www/haproxy_pools.php | 2 +- .../www/widgets/widgets/haproxy.widget.php | 128 +++++++++++---------- 4 files changed, 91 insertions(+), 62 deletions(-) diff --git a/config/haproxy-devel/pkg/haproxy_gui.inc b/config/haproxy-devel/pkg/haproxy_gui.inc index 5392e87a..8fbc0dd0 100644 --- a/config/haproxy-devel/pkg/haproxy_gui.inc +++ b/config/haproxy-devel/pkg/haproxy_gui.inc @@ -47,6 +47,26 @@ $haproxy_icons = array( 'stats' => array( "faicon" => "fa-tasks", "icon" => "icon_log_s.gif", + "iconsize" => 11), + 'stop' => array( + "faicon" => "fa-stop-circle-o", + "icon" => "icon_service_stop.gif", + "iconsize" => 17), + 'start' => array( + "faicon" => "fa-play-circle", + "icon" => "icon_service_start.gif", + "iconsize" => 17), + 'up' => array( + "faicon" => "fa-check-circle", + "icon" => "icon_interface_up.gif", + "iconsize" => 11), + 'down' => array( + "faicon" => "fa-times-circle", + "icon" => "icon_interface_down.gif", + "iconsize" => 11), + 'resolvedns' => array( + "faicon" => "fa-info ", + "icon" => "icon_log.gif", "iconsize" => 11) ); diff --git a/config/haproxy-devel/www/haproxy_listeners.php b/config/haproxy-devel/www/haproxy_listeners.php index e3dc7120..35d9ba54 100644 --- a/config/haproxy-devel/www/haproxy_listeners.php +++ b/config/haproxy-devel/www/haproxy_listeners.php @@ -86,7 +86,8 @@ if ($_GET['act'] == "del") { if (isset($a_frontend[$id])) { if (!$input_errors) { unset($a_frontend[$id]); - write_config(); + $changedesc .= " Frontend delete"; + write_config($changedesc); touch($d_haproxyconfdirty_path); } header("Location: haproxy_listeners.php"); diff --git a/config/haproxy-devel/www/haproxy_pools.php b/config/haproxy-devel/www/haproxy_pools.php index ca449246..ef1768db 100644 --- a/config/haproxy-devel/www/haproxy_pools.php +++ b/config/haproxy-devel/www/haproxy_pools.php @@ -58,7 +58,7 @@ if ($_POST) { if ($_GET['act'] == "del") { if (isset($a_pools[$_GET['id']])) { unset($a_pools[$_GET['id']]); - write_config(); + write_config("Services: HAProxy: Backend delete"); touch($d_haproxyconfdirty_path); } header("Location: haproxy_pools.php"); diff --git a/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php b/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php index 5d664e81..92fd9025 100644 --- a/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php +++ b/config/haproxy-devel/www/widgets/widgets/haproxy.widget.php @@ -30,10 +30,15 @@ Some mods made from pfBlocker widget to make this for HAProxy on Pfsense Copyleft 2012 by jvorhees */ + +$nocsrf = true; + require_once("guiconfig.inc"); require_once("pfsense-utils.inc"); require_once("functions.inc"); require_once("haproxy_socketinfo.inc"); +require_once("haproxy_gui.inc"); + $first_time = false; if (!is_array($config["widgets"]["haproxy"])) { $first_time = true; @@ -59,7 +64,7 @@ if ($_POST) { foreach($simplefields as $fieldname) $a_config[$fieldname] = $_POST[$fieldname]; - write_config("Updated traffic graph settings via dashboard."); + write_config("Services: HAProxy: Widget: Updated settings via dashboard."); header("Location: /"); exit(0); } @@ -77,13 +82,13 @@ $show_frontends = $a_config['haproxy_widget_showfrontends']=='yes'; $show_clients = $a_config['haproxy_widget_showclients']=='yes'; $show_clients_traffic = $a_config['haproxy_widget_showclienttraffic']=='yes'; -$out=""; -$in=""; -$running=""; -$stopped=""; -$log=""; -$start=""; -$stop=""; +$out = haproxyicon("down", ""); +$in = haproxyicon("up", ""); +$running = haproxyicon("enabled", ""); +$stopped = haproxyicon("disabled", ""); +$log = haproxyicon("resolvedns", ""); +$start = haproxyicon("start","Enable this backend/server"); +$stop = haproxyicon("stop","Disable this backend/server"); $clients=array(); $clientstraffic=array(); @@ -98,35 +103,11 @@ if ($show_clients == "YES") { } if (!$getupdatestatus) { ?> - -
+
"; #Frontends if ($show_frontends == "YES") { print "FrontEnd(s)"; @@ -236,7 +217,17 @@ if (!$getupdatestatus) { echo "
"; ?> - + - '; +} else { + echo '