Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager

This commit is contained in:
Jamie Curnow
2022-05-12 08:47:31 +10:00
parent 4db34f5894
commit 2110ecc382
830 changed files with 38168 additions and 36635 deletions

View File

@@ -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;
}