From patchwork Tue Nov 10 12:37:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo-Andres Hofmann X-Patchwork-Id: 3653 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4CVnSG0GYWz3why for ; Tue, 10 Nov 2020 12:37:18 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4CVnSF0QPgz11f; Tue, 10 Nov 2020 12:37:17 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4CVnSD6cPpz2xmj; Tue, 10 Nov 2020 12:37:16 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4CVnSC2wBwz2xVW for ; Tue, 10 Nov 2020 12:37:15 +0000 (UTC) Received: from mirfac.uberspace.de (mirfac.uberspace.de [185.26.156.40]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4CVnSB34TQz8F for ; Tue, 10 Nov 2020 12:37:14 +0000 (UTC) Received: (qmail 14104 invoked from network); 10 Nov 2020 12:37:13 -0000 Received: from localhost (HELO suhail.uberspace.de) (127.0.0.1) by mirfac.uberspace.de with SMTP; 10 Nov 2020 12:37:13 -0000 Received: (qmail 19753 invoked from network); 10 Nov 2020 12:37:11 -0000 Received: from localhost (HELO Leo-Laptop.local) (127.0.0.1) by suhail.uberspace.de with SMTP; 10 Nov 2020 12:37:11 -0000 Date: Tue, 10 Nov 2020 13:37:14 +0100 From: Leo-Andres Hofmann To: development@lists.ipfire.org; Subject: [PATCH] zoneconf.cgi: Improve the usability of the zone configuration by marking assigned NICs in the zone color. The highlighting is initially applied to the static HTML output, and JavaScript is used to dynamically follow changes made by the user. Message-ID: <06299a2d-c302-4712-8a2a-6842ccb3b24b@Leo-Laptop.local> X-Mailer: TortoiseGit MIME-Version: 1.0 ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=none; spf=softfail (mail01.ipfire.org: 185.26.156.40 is neither permitted nor denied by domain of hofmann@leo-andres.de) smtp.mailfrom=hofmann@leo-andres.de ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1605011834; a=rsa-sha256; cv=none; b=wK8MkXhHmkGLL4x8zwQ05qkHD7voGdHj196q2LkvYseizjhFww5czEbWpAszX7wcuOHmhP TmarP6XEDM5v0GwLkLtKzfEogWbGsaxj5OY+orlzVBVymM17N3Xcz/h/v1gPbBaQyhMWSM HfyWaKCc/k4RiyQaBWh7J8MJjMWm+MwJqeAVk4Pw5xMTliXI93xXD8asi/AvHW+/AUH/jg c7sw+OMHmfZRikKCwcxyU4Bw72FgnYPy1Vcpy5KGsM8AMClctGXrz1S50QqyB9gAGMm8yd /sBaK7VmPzggmrTKLydc5tOz+Wkv8AcWgBfcdISDSdK7Mk+gWkBi2SFmGSFUkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1605011834; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=CfMccPfZx6b88Ms5rccDiiw0AAkvMYag87wIwRuqR/o=; b=qPshdHLqAYncBFpKD7nPUMIQbi9fNR2hBnzSnZaPbqHob/ryKBCdqebfgbZ+PLSrOb6Ebq hUfTsNj/NrmKt9EWApIEm+HnARokLEw+Zlg3i1w7VmuSFhNPlrc5Yg1BuhE/93141xM2Bx DpCf09+CG35Feb/GZPYyfvG4joFjSnf0atBo7O19jRb/7mBLmMAgTFDBAA9ICyuzET4Kln VYF7Jow1epGX27oIQqMM4f1rPx/MBzEPaAWG+weWmrABcB52xyxgWb2hgAt0Msk9mhMMVG /y54KNuehlRx5KZVCXx4h388yjticT6T9G9MnihIM0XO1zRQJ656gJMKpFO/YA== X-Rspamd-Server: mail01.haj.ipfire.org X-Spamd-Result: default: False [2.29 / 11.00]; ARC_NA(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; R_MISSING_CHARSET(2.50)[]; IP_REPUTATION_HAM(-0.01)[asn: 205766(0.00), country: DE(-0.00), ip: 185.26.156.40(0.00)]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_ONE(0.00)[1]; LONG_SUBJ(1.87)[249]; RCVD_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[leo-andres.de]; NEURAL_HAM(-0.98)[-0.977]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:205766, ipnet:185.26.156.0/24, country:DE]; RCVD_TLS_LAST(0.00)[]; BAYES_HAM(-3.00)[99.99%]; FORGED_RECIPIENTS(2.00)[m:development@lists.ipfire.org; ,s:development@lists.ipfire.org] X-Rspamd-Queue-Id: 4CVnSB34TQz8F Authentication-Results: mail01.ipfire.org; dkim=none; dmarc=none; spf=softfail (mail01.ipfire.org: 185.26.156.40 is neither permitted nor denied by domain of hofmann@leo-andres.de) smtp.mailfrom=hofmann@leo-andres.de X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Discussion: https://lists.ipfire.org/pipermail/development/2020-October/008567.html Signed-off-by: Leo-Andres Hofmann --- html/cgi-bin/zoneconf.cgi | 89 +++++++++++++++++++++++++++++---------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/html/cgi-bin/zoneconf.cgi b/html/cgi-bin/zoneconf.cgi index d99a3e611..2501901c4 100644 --- a/html/cgi-bin/zoneconf.cgi +++ b/html/cgi-bin/zoneconf.cgi @@ -26,7 +26,7 @@ require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; require "${General::swroot}/header.pl"; -my $css = < table { width: 100%; @@ -64,19 +64,19 @@ my $css = < + + END ; @@ -162,7 +200,7 @@ foreach (@nics) { } } -&Header::openpage($Lang::tr{"zoneconf title"}, 1, $css); +&Header::openpage($Lang::tr{"zoneconf title"}, 1, $extraHead); &Header::openbigbox('100%', 'center'); ### Evaluate POST parameters ### @@ -312,8 +350,8 @@ if ($cgiparams{"ACTION"} eq $Lang::tr{"save"}) { print < - - + END ; @@ -332,7 +370,7 @@ foreach (@zones) { my $red_restricted = ($uc eq "RED" && ! ($red_type eq "STATIC" || $red_type eq "DHCP")); if ($red_restricted) { - print ""; + print "\t\t\n"; next; # We're done here } @@ -350,7 +388,7 @@ foreach (@zones) { } print <$uc
+
"; +print "\t\n"; my $slightlygrey = ""; @@ -370,12 +408,13 @@ foreach (@nics) { my $nic = $_->[1]; my $wlan = $_->[2]; - print ""; + print "\t\n\t\t\n"; # Iterate through all zones and check if the current NIC is assigned to it foreach (@zones) { my $uc = uc $_; my $dev_name = $ethsettings{"${uc}_DEV"}; + my $highlight = ""; if ($dev_name eq "") { # Again, skip the zone if it is not activated next; @@ -391,9 +430,10 @@ foreach (@nics) { if ($mac eq $ethsettings{"${uc}_MACADDR"}) { $checked = "checked"; + $highlight = $_; } - print ""; + print "\t\t\n"; next; # We're done here } } @@ -430,21 +470,26 @@ foreach (@nics) { $access_selected{"NONE"} = ($access_selected{"NATIVE"} eq "") && ($access_selected{"VLAN"} eq "") ? "selected" : ""; my $vlan_disabled = ($wlan) ? "disabled" : ""; + + # If the interface is assigned, hightlight table cell + if ($access_selected{"NONE"} eq "") { + $highlight = $_; + } print < - - - + END ; } - print ""; + print "\t\n"; if ($slightlygrey) { $slightlygrey = "";
+
$uc ($red_type)$uc ($red_type)$uc
$nic
$mac
$nic
$mac
+ + +