summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/widgets
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-01-12 16:19:27 +0545
committerRenato Botelho <renato@netgate.com>2017-01-13 18:59:49 -0200
commit64f1fef3d6244f22c309d2cc13d394f1110c023c (patch)
treee3650c9233c68d9481a3579eda41dc2698f6faeb /src/usr/local/www/widgets
parent0f8edf14df0ce01404978cf3afbfc216d61e502e (diff)
downloadpfsense-64f1fef3d6244f22c309d2cc13d394f1110c023c.zip
pfsense-64f1fef3d6244f22c309d2cc13d394f1110c023c.tar.gz
Add filter to Interfaces Widget
(cherry picked from commit 35310a493f19d6758747cbc8e9961c2ca3395246)
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r--src/usr/local/www/widgets/widgets/interfaces.widget.php87
1 files changed, 85 insertions, 2 deletions
diff --git a/src/usr/local/www/widgets/widgets/interfaces.widget.php b/src/usr/local/www/widgets/widgets/interfaces.widget.php
index 2e53e47..00121a0 100644
--- a/src/usr/local/www/widgets/widgets/interfaces.widget.php
+++ b/src/usr/local/www/widgets/widgets/interfaces.widget.php
@@ -60,11 +60,38 @@ require_once("functions.inc");
require_once("/usr/local/www/widgets/include/interfaces.inc");
$ifdescrs = get_configured_interface_with_descr();
+
+if ($_POST) {
+
+ $validNames = array();
+
+ foreach ($ifdescrs as $ifdescr => $ifname) {
+ array_push($validNames, $ifdescr);
+ }
+
+ if (is_array($_POST['show'])) {
+ $user_settings['widgets']['interfaces']['iffilter'] = implode(',', array_diff($validNames, $_POST['show']));
+ } else {
+ $user_settings['widgets']['interfaces']['iffilter'] = "";
+ }
+
+ save_widget_settings($_SESSION['Username'], $user_settings["widgets"], gettext("Saved Interfaces Filter via Dashboard."));
+ header("Location: /index.php");
+}
+
?>
-<table class="table table-striped table-hover">
+<div class="table-responsive">
+ <table class="table table-striped table-hover table-condensed">
+ <tbody>
<?php
+$skipinterfaces = explode(",", $user_settings['widgets']['interfaces']['iffilter']);
+
foreach ($ifdescrs as $ifdescr => $ifname):
+ if (in_array($ifdescr, $skipinterfaces)) {
+ continue;
+ }
+
$ifinfo = get_interface_info($ifdescr);
if ($ifinfo['pppoelink'] || $ifinfo['pptplink'] || $ifinfo['l2tplink']) {
/* PPP link (non-cell) - looks like a modem */
@@ -129,4 +156,60 @@ foreach ($ifdescrs as $ifdescr => $ifname):
<?php
endforeach;
?>
-</table>
+ </tbody>
+ </table>
+</div>
+<!-- close the body we're wrapped in and add a configuration-panel -->
+</div><div id="widget-<?=$widgetname?>_panel-footer" class="panel-footer collapse">
+
+<form action="/widgets/widgets/interfaces.widget.php" method="post" class="form-horizontal">
+ <div class="panel panel-default col-sm-10">
+ <div class="panel-body">
+ <div class="table responsive">
+ <table class="table table-striped table-hover table-condensed">
+ <thead>
+ <tr>
+ <th><?=gettext("Interface")?></th>
+ <th><?=gettext("Show")?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ $skipinterfaces = explode(",", $user_settings['widgets']['interfaces']['iffilter']);
+ $idx = 0;
+
+ foreach ($ifdescrs as $ifdescr => $ifname):
+?>
+ <tr>
+ <td><?=$ifname?></td>
+ <td class="col-sm-2"><input id="show[]" name ="show[]" value="<?=$ifdescr?>" type="checkbox" <?=(!in_array($ifdescr, $skipinterfaces) ? 'checked':'')?>></td>
+ </tr>
+<?php
+ endforeach;
+?>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <div class="col-sm-offset-3 col-sm-6">
+ <button type="submit" class="btn btn-primary"><i class="fa fa-save icon-embed-btn"></i><?=gettext('Save')?></button>
+ <button id="showallinterfaces" type="button" class="btn btn-info"><i class="fa fa-undo icon-embed-btn"></i><?=gettext('All')?></button>
+ </div>
+ </div>
+</form>
+
+<script>
+//<![CDATA[
+ events.push(function(){
+ $("#showallinterfaces").click(function() {
+ $("[id^=show]").each(function() {
+ $(this).prop("checked", true);
+ });
+ });
+
+ });
+//]]>
+</script>
OpenPOWER on IntegriCloud