phpsysinfo / phpsysinfo

phpSysInfo: a customizable PHP script that displays information about your system nicely
http://phpsysinfo.github.io/phpsysinfo
GNU General Public License v2.0
1.38k stars 234 forks source link

Make 'network usage' and 'temperature' lists sortable #220

Closed Stamgastje closed 6 years ago

Stamgastje commented 6 years ago

Would it be possible to make the 'NETWORK USAGE' and 'TEMPERATURE' lists sortable? Currently, the lists are in a somewhat random order (e.g.: eth1 - lo - eth2 - eth0).

As a quick hack, I sorted the two arrays:

--- class.System.inc.php.orig 2018-02-25 17:14:00.191164441 +0100 +++ class.System.inc.php 2018-02-25 17:56:09.030072368 +0100 @@ -744,6 +744,7 @@ */ public function getNetDevices() { + asort($this->_netDevices); return $this->_netDevices; }

--- class.MBInfo.inc.php.orig 2018-02-12 20:18:15.000000000 +0100 +++ class.MBInfo.inc.php 2018-02-25 17:46:39.476520810 +0100 @@ -114,6 +114,7 @@ */ public function getMbTemp() { + asort($this->_mbTemp); return $this->_mbTemp; }

Better would be if the lists are sortable like some of the other lists (e.g. 'MOUNTED FILESYSTEMS').

namiltd commented 6 years ago

If the network usage was sortable, I could not implement the info tree. Temperatures and other sensors are often grouped and sorting can mixed them up.

Stamgastje commented 6 years ago

And what about a fixed sorting (like in my hack above), to be enabled via a new parameter in phpsysinfo.ini?

namiltd commented 6 years ago

Done https://github.com/phpsysinfo/phpsysinfo/commit/8367db64204ef17073bc4eab2ab058fcc62950a6. New options SORT_NETWORK_INTERFACES_LIST and SORT_SENSORS_LIST added. Check out the version from Github tree: https://codeload.github.com/phpsysinfo/phpsysinfo/zip/master.

Stamgastje commented 6 years ago

Appreciated, thanks!

namiltd commented 6 years ago

After the fix: https://github.com/phpsysinfo/phpsysinfo/commit/b6c73a44b2fcf5ea94eb5beff63db87b2a4fe3fb, the names are sorted naturally.

Stamgastje commented 6 years ago

Is that commit really correct...?

Seems like a copy-paste error as all modified lines sort $this->_netDevices (instead of $this->_mbFan / $this->_mbTemp / $this->_mbVolt / $this->_mbPower / $this->_mbCurrent / $this->_mbOther).

namiltd commented 6 years ago

Corrected: https://github.com/phpsysinfo/phpsysinfo/commit/23ec17eafe73afce6b84846f7a5fec1267829513. Thank You for the info.