Commit 899a75ff authored by Franco Fichtner's avatar Franco Fichtner

firmware: sort upgrade packages, needs more work for other types

GUI sorting for now should be new, update, reinstall, remove.  Later
all those types ought to be merged into a single list with backwards-
compatible behaviour.  First of many neat firmware improvements on
our way to 16.7.  :)

(cherry picked from commit 8770689a)
parent 4cf51bc6
......@@ -97,6 +97,18 @@ class FirmwareController extends ApiControllerBase
$response = array('status' => 'unknown', 'status_msg' => gettext('Current status is unknown.'));
}
/* XXX array isn't flat, need to refactor this */
if (isset($response['upgrade_packages'])) {
$sorted = array();
foreach ($response['upgrade_packages'] as $key => $value) {
$sorted[$value['name']] = $value;
}
uksort($sorted, function ($a, $b) {
return strnatcmp($a, $b);
});
$response['upgrade_packages'] = $sorted;
}
return $response;
}
......
......@@ -57,7 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
// show upgrade list
$("#updatelist").html("<tr><th>{{ lang._('Package Name') }}</th>" +
"<th>{{ lang._('Current Version') }}</th><th>{{ lang._('New Version') }}</th></tr>");
$.each(['upgrade_packages','new_packages','reinstall_packages'], function(type_idx,type_name){
$.each(['new_packages', 'upgrade_packages', 'reinstall_packages'], function(type_idx,type_name){
if ( data[type_name] != undefined ) {
$.each(data[type_name],function(index,row){
if (type_name == "new_packages") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment