From 9dc1f14ccb20968fd1c2c37a1765db223197c059 Mon Sep 17 00:00:00 2001 From: glaszig Date: Sun, 30 May 2021 19:46:10 -0300 Subject: [PATCH] separate connected from known from nearby wifi stations in ui --- ajax/networking/wifi_stations.php | 6 +- app/css/custom.php | 11 +++ app/css/hackernews.css | 12 ++- app/css/lightsout.css | 13 ++- includes/wifi_functions.php | 3 + templates/configure_client.php | 4 +- templates/wifi_stations.php | 127 +++++++--------------------- templates/wifi_stations/network.php | 83 ++++++++++++++++++ 8 files changed, 157 insertions(+), 102 deletions(-) create mode 100644 templates/wifi_stations/network.php diff --git a/ajax/networking/wifi_stations.php b/ajax/networking/wifi_stations.php index 37d662ff..aca5bc89 100644 --- a/ajax/networking/wifi_stations.php +++ b/ajax/networking/wifi_stations.php @@ -15,4 +15,8 @@ nearbyWifiStations($networks, !isset($_REQUEST["refresh"])); connectedWifiStations($networks); sortNetworksByRSSI($networks); -echo renderTemplate('wifi_stations', compact('networks'), true); +$connected = array_filter($networks, function($n) { return $n['connected']; } ); +$known = array_filter($networks, function($n) { return !$n['connected'] && $n['configured']; } ); +$nearby = array_filter($networks, function($n) { return !$n['configured']; } ); + +echo renderTemplate('wifi_stations', compact('networks', 'connected', 'known', 'nearby'), true); diff --git a/app/css/custom.php b/app/css/custom.php index 273a9629..167b4473 100644 --- a/app/css/custom.php +++ b/app/css/custom.php @@ -16,6 +16,10 @@ body { color: #212529; } +.h-underlined { + border-bottom: 1px solid #343434; +} + .page-header { margin: 20px 0 20px; } @@ -193,6 +197,13 @@ pre.unstyled { .js-reload-wifi-stations { min-width: 10rem; } +.card-deck--wifi-stations { + justify-content: space-between; +} +.card-deck--wifi-stations .card { + flex: 0 46%; + margin-bottom: .75rem; +} .sidebar.toggled .nav-item .nav-link span { display: none; diff --git a/app/css/hackernews.css b/app/css/hackernews.css index 6d065e80..d7c1695f 100644 --- a/app/css/hackernews.css +++ b/app/css/hackernews.css @@ -8,7 +8,6 @@ License: GNU General Public License v3.0 html * { font-family: Verdana, Geneva, sans-serif; - font-size: 0.9rem; color: #828282; } @@ -34,6 +33,10 @@ h5.card-title { color: #212529; } +.h-underlined { + border-bottom: 1px solid #343434; +} + .card, .modal-dialog { border-radius: 1px; border-color: #ff6600; @@ -226,6 +229,13 @@ pre.unstyled { .js-reload-wifi-stations { min-width: 10rem; } +.card-deck--wifi-stations { + justify-content: space-between; +} +.card-deck--wifi-stations .card { + flex: 0 46%; + margin-bottom: .75rem; +} .sidebar.toggled .nav-item .nav-link { text-align: center; diff --git a/app/css/lightsout.css b/app/css/lightsout.css index 92123da4..ea213711 100644 --- a/app/css/lightsout.css +++ b/app/css/lightsout.css @@ -8,7 +8,6 @@ License: GNU General Public License v3.0 html * { font-family: Helvetica,Arial,sans-serif; - font-size: 1.0rem; color: #afafaf; } @@ -24,6 +23,10 @@ h5.card-title { font-size: 1.2rem; } +.h-underlined { + border-bottom: 1px solid #343434; +} + .page-header { padding: 0 20px; border-left: .01rem solid #d2d2d2; @@ -427,6 +430,14 @@ pre { width: 100%; } +.card-deck--wifi-stations { + justify-content: space-between; +} +.card-deck--wifi-stations .card { + flex: 0 46%; + margin-bottom: .75rem; +} + .toggle-off.btn { padding-left: 1.2rem; font-size: 0.9rem!important; diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 411c1cff..b7b543df 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -18,6 +18,7 @@ function knownWifiStations(&$networks) switch (strtolower($lineArr[0])) { case 'ssid': $ssid = trim($lineArr[1], '"'); + $network['ssid'] = $ssid; break; case 'psk': if (array_key_exists('passphrase', $network)) { @@ -83,6 +84,8 @@ function nearbyWifiStations(&$networks, $cached = true) continue; } + $networks[$ssid]['ssid'] = $ssid; + // If network is saved if (array_key_exists($ssid, $networks)) { $networks[$ssid]['visible'] = true; diff --git a/templates/configure_client.php b/templates/configure_client.php index 21a23a75..21a3e2a0 100755 --- a/templates/configure_client.php +++ b/templates/configure_client.php @@ -24,10 +24,10 @@ -
+ -
+
diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index f12c9f54..56bf0a71 100755 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -1,4 +1,4 @@ - +

@@ -12,103 +12,36 @@
- + + -
- $network) : ?> -
-
-
- - -
-
-
- - - - - - - -
+ +

+
+ + + + +
+ -
-
- - - - X - -
- -
-
- = -200) { - echo htmlspecialchars($network['RSSI'], ENT_QUOTES); - echo "dB ("; - if ($network['RSSI'] >= -50) { - echo 100; - } elseif ($network['RSSI'] <= -100) { - echo 0; - } else { - echo 2*($network['RSSI'] + 100); - } - echo "%)"; - } else { - echo " not found "; - } - ?> -
- - - - - - -
-
- -
-
-
- - - - -
- -
- -
-
- -
- - " id="update" name="update" data-toggle="modal" data-target="#configureClientModal" /> - - - " id="update" name="update" data-toggle="modal" data-target="#configureClientModal" /> - - " name="delete" data-toggle="modal" data-target="#configureClientModal" /> -
-
-
-
- - -
+ +

+
+ + + + +
+ + +

+
+ + + + +
+ diff --git a/templates/wifi_stations/network.php b/templates/wifi_stations/network.php new file mode 100644 index 00000000..e0a9684c --- /dev/null +++ b/templates/wifi_stations/network.php @@ -0,0 +1,83 @@ +
+
+ + +
+ +
+
+ + + + + + + +
+ +
+
+ + + + X + +
+ +
+
+ = -200) { + echo htmlspecialchars($network['RSSI'], ENT_QUOTES); + echo "dB ("; + if ($network['RSSI'] >= -50) { + echo 100; + } elseif ($network['RSSI'] <= -100) { + echo 0; + } else { + echo 2*($network['RSSI'] + 100); + } + echo "%)"; + } else { + echo " not found "; + } + ?> +
+ + + + + + +
+
+ +
+
+
+ + + + +
+ +
+ +
+
+ +
+ + " id="update" name="update" data-toggle="modal" data-target="#configureClientModal" /> + + + " id="update" name="update" data-toggle="modal" data-target="#configureClientModal" /> + + " name="delete" data-toggle="modal" data-target="#configureClientModal" /> +
+
+