From 4b87ccb3c100cdc6f5cd3c95f70228f541750c2b Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 25 Nov 2024 15:44:16 +0200 Subject: [PATCH] Fix to put editable options on the top of the list #2319 --- mysql/list_vars.cgi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mysql/list_vars.cgi b/mysql/list_vars.cgi index fb559639c..c4cb269b3 100755 --- a/mysql/list_vars.cgi +++ b/mysql/list_vars.cgi @@ -28,6 +28,14 @@ if (@{$d->{'data'}}) { print &ui_columns_start([ "", $text{'vars_name'}, $text{'vars_value'} ], 100, 0, \@tds); + @{$d->{'data'}} = sort { + # Editing now (highest priority) + ($d{$b->[0]} <=> $d{$a->[0]}) || + # Can edit (second priority) + ($canedit{$b->[0]} <=> $canedit{$a->[0]}) || + # Natural sort for equal priority + $a->[0] cmp $b->[0] + } @{$d->{'data'}}; foreach $v (@{$d->{'data'}}) { if (!$canedit{$v->[0]}) { # Cannot edit, so just show value