mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-24 15:00:25 +02:00
minor ui adjustments
This commit is contained in:
1 parent
b022e138d4
commit
7984e586a8
10 files changed
+58
-60
No files matched your search
@@ -30,32 +30,25 @@ export function pageSQLConsole(route) {
|
||||
const isAsc = !!pageData.sort?.asc;
|
||||
|
||||
const sorted = pageData.result?.rows?.toSorted((rowA, rowB) => {
|
||||
const valA = rowA[pageData.sort.index];
|
||||
const valB = rowB[pageData.sort.index];
|
||||
let valA = rowA[pageData.sort.index];
|
||||
let valB = rowB[pageData.sort.index];
|
||||
|
||||
if (isAsc) {
|
||||
if (valA == valB) {
|
||||
return 0;
|
||||
}
|
||||
if (valA == null) {
|
||||
return -1;
|
||||
}
|
||||
if (valB == null) {
|
||||
return 1;
|
||||
}
|
||||
return valA.localeCompare(valB);
|
||||
// swap
|
||||
if (!isAsc) {
|
||||
valA = rowB[pageData.sort.index];
|
||||
valB = rowA[pageData.sort.index];
|
||||
}
|
||||
|
||||
if (valA == valB) {
|
||||
return 0;
|
||||
}
|
||||
if (valA == null) {
|
||||
return 1;
|
||||
}
|
||||
if (valB == null) {
|
||||
return -1;
|
||||
}
|
||||
return valB.localeCompare(valA);
|
||||
if (valB == null) {
|
||||
return 1;
|
||||
}
|
||||
return valA.localeCompare(valB);
|
||||
}) || [];
|
||||
|
||||
return pageData.maxRows >= sorted.length ? sorted : sorted.slice(0, pageData.maxRows);
|
||||
|
||||
Reference in new issue
Block a user