-
Notifications
You must be signed in to change notification settings - Fork 3
Sortable static tables #174
base: master
Are you sure you want to change the base?
Conversation
The no-JavaScript groups page now has server-side sortable column headers (clickable links carrying whitelisted sort parameters, so an attacker-supplied sort key can never reach the query) and a filter form for user name, group name substring and the finished-groups day window. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The servers page lists every server in a single table, so sorting needs no server round-trip. Clicking a column header now reorders the rows via a small vanilla-JS click-to-sort (no dependencies): data rows live in <tbody>, the totals stay in <tfoot>, and the human-readable memory columns carry a raw "data-sort" value so e.g. "2.0 GiB" sorts above "512.0 MiB". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
a1724ea to
8a40b16
Compare
|
Feel free to test on http://afk.molgen.mpg.de/mxq/mxq4/. |
|
I don't understand the PR text. "The group tables are rendered on the server. The server table is rendered client side. You have to click on the column head. There is no indicator that it’s sortable." Can't make head and tail of this. What does the PR do? |
I guess server was ambiguous with the server running the cgi script, and server meaning cluster node.
Sorry about this. I mostly ignore merge/pull request descriptions, as they are not copied to the merge commit. Hopefully, I fixed it, and the commit messages itself are more informative. |
| @@ -678,11 +735,23 @@ sub group_table { | |||
| unknown | |||
| ); | |||
|
|
|||
| my $sth=$dbh->prepare('SELECT '.join(',',@cols).' FROM mxq_group WHERE '.$sql_clause.' AND (group_jobs_running>0 OR group_jobs_inq>0) ORDER BY group_id DESC'); | |||
| my %active_allowed=map {$_=>$_} qw( | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my %active_allowed = map {$_ => 1} @cols; ?
-
avoid duplication of @cols
-
use more sensible whitespace (I confess, I set the bad example in the surrounding code)
-
%active_allowed is only evaluated with
existsso the value doesn't matter. We can use an optimized constant instead of a string which needs allocation for the value. -
unested! (I'm on mobile)
-
same next line
|
It's to much to review on a small screen. However, if it works, I'm okay with that. Nothing prevents us from improving the code in future changes, so I don't want to send other minor comments. Thanks, good idea. If you want, just merge and copy the produced cgi script to the afk server without going through releases. |
Currently the column tables on the Web pages cannot be sorted or filtered.
section groups
Clicking on the column header, the request is sent to the cgi, querying the data base and creating the HTML page.
section servers
As always all cluster nodes are shown on the page, sorting is implemented via JavaScript (example below sorts via max. time ):
You have to click on the column head. There is no indicator that it’s sortable.