mirror of
https://github.com/Alvin-Zilverstand/nginx-proxy-manager.git
synced 2026-11-29 01:17:52 +01:00
Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager
This commit is contained in:
1 parent
4db34f5894
commit
2110ecc382
830 files changed
+38168
-36635
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { decamelize } from "humps";
|
||||
|
||||
/**
|
||||
* This will convert a react-table sort object into
|
||||
* a string that the backend api likes:
|
||||
* name.asc,id.desc
|
||||
*/
|
||||
export function tableSortToAPI(sortBy: any): string | undefined {
|
||||
if (sortBy?.length > 0) {
|
||||
const strs: string[] = [];
|
||||
sortBy.map((item: any) => {
|
||||
strs.push(decamelize(item.id) + "." + (item.desc ? "desc" : "asc"));
|
||||
return undefined;
|
||||
});
|
||||
return strs.join(",");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will convert a react-table filters object into
|
||||
* a string that the backend api likes:
|
||||
* name:contains=jam
|
||||
*/
|
||||
export function tableFiltersToAPI(filters: any): { [key: string]: string } {
|
||||
const items: { [key: string]: string } = {};
|
||||
if (filters?.length > 0) {
|
||||
filters.map((item: any) => {
|
||||
items[`${decamelize(item.id)}:${item.value.modifier}`] = item.value.value;
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
Reference in new issue
Block a user