From cdb3b8bea33c831bc4dd3a227b56732e92894de3 Mon Sep 17 00:00:00 2001 From: MickaelK Date: Tue, 24 Jun 2025 22:20:39 +1000 Subject: [PATCH] fix (table): improve ux for sam/bam tables --- config/mime.json | 2 ++ public/assets/pages/viewerpage/application_table.js | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/mime.json b/config/mime.json index 5ab1da23..f54e7235 100644 --- a/config/mime.json +++ b/config/mime.json @@ -21,6 +21,7 @@ "avi": "video/x-msvideo", "avif": "image/avif", "avro": "application/vnd.apache.avro", + "bam": "application/x-bam", "bin": "application/octet-stream", "bmp": "image/x-ms-bmp", "bz2": "application/x-bz2", @@ -215,6 +216,7 @@ "rtf2": "text/rtf", "run": "application/x-makeself", "rw2": "image/x-panasonic-rw2", + "sam": "application/x-sam", "sea": "application/x-sea", "sew": "image/x-sew", "sgi": "image/x-sgi", diff --git a/public/assets/pages/viewerpage/application_table.js b/public/assets/pages/viewerpage/application_table.js index 3f6541f1..bbe417cf 100644 --- a/public/assets/pages/viewerpage/application_table.js +++ b/public/assets/pages/viewerpage/application_table.js @@ -238,8 +238,12 @@ function resizeLastColumnIfNeeded({ $target, $childs, padding = 0 }) { function sortBy(rows, ascending, key) { const o = ascending ? 1 : -1; return rows.sort((a, b) => { - if (a[key] === b[key]) return 0; - else if (a[key] < b[key]) return -o; - return o; + let diff = a[key] - b[key]; + if (isNaN(diff)) { + if (a[key] === b[key]) diff = 0; + else if (a[key] < b[key]) diff = -1; + else diff = 1; + } + return o*diff; }); }