Add ip sort functionality to dhcp config panel datatable
parent
9c5803e340
commit
e2788d75a1
|
@ -1,5 +1,5 @@
|
|||
import { expose } from "comlink";
|
||||
import { stringCompare } from "../../common/string/compare";
|
||||
import { stringCompare, ipCompare } from "../../common/string/compare";
|
||||
import { stripDiacritics } from "../../common/string/strip-diacritics";
|
||||
import type {
|
||||
ClonedDataTableColumnData,
|
||||
|
@ -57,7 +57,9 @@ const sortData = (
|
|||
if (column.type === "numeric") {
|
||||
valA = isNaN(valA) ? undefined : Number(valA);
|
||||
valB = isNaN(valB) ? undefined : Number(valB);
|
||||
} else if (typeof valA === "string" && typeof valB === "string") {
|
||||
} else if (column.type === "ip") {
|
||||
return sort * ipCompare(valA, valB);
|
||||
} else if (typeof valA === "string" && typeof valB === "string") {
|
||||
return sort * stringCompare(valA, valB, language);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ export class DHCPConfigPanel extends SubscribeMixin(LitElement) {
|
|||
title: localize("ui.panel.config.dhcp.ip_address"),
|
||||
filterable: true,
|
||||
sortable: true,
|
||||
type: "ip",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue