- Added upstream objects

- Renamed host templates to nginx templates
- Generate upstream templates
- Better nginx error reporting when reloading
- Use tparse for golang test reporting
This commit is contained in:
Jamie Curnow
2023-01-04 15:36:56 +10:00
parent b3ae2f4dbb
commit 5e5f0de0e2
82 changed files with 2209 additions and 294 deletions

View File

@ -6,7 +6,7 @@ export * from "./useDNSProviders";
export * from "./useDNSProvidersAcmesh";
export * from "./useHealth";
export * from "./useHosts";
export * from "./useHostTemplates";
export * from "./useNginxTemplates";
export * from "./useSettings";
export * from "./useUser";
export * from "./useUsers";

View File

@ -1,18 +1,18 @@
import {
getHostTemplates,
HostTemplatesResponse,
getNginxTemplates,
NginxTemplatesResponse,
tableSortToAPI,
tableFiltersToAPI,
} from "api/npm";
import { useQuery } from "react-query";
const fetchHostTemplates = (
const fetchNginxTemplates = (
offset = 0,
limit = 10,
sortBy?: any,
filters?: any,
) => {
return getHostTemplates(
return getNginxTemplates(
offset,
limit,
tableSortToAPI(sortBy),
@ -20,16 +20,16 @@ const fetchHostTemplates = (
);
};
const useHostTemplates = (
const useNginxTemplates = (
offset = 0,
limit = 10,
sortBy?: any,
filters?: any,
options = {},
) => {
return useQuery<HostTemplatesResponse, Error>(
["hosts", { offset, limit, sortBy, filters }],
() => fetchHostTemplates(offset, limit, sortBy, filters),
return useQuery<NginxTemplatesResponse, Error>(
["nginx-templates", { offset, limit, sortBy, filters }],
() => fetchNginxTemplates(offset, limit, sortBy, filters),
{
keepPreviousData: true,
staleTime: 15 * 1000, // 15 seconds
@ -38,4 +38,4 @@ const useHostTemplates = (
);
};
export { fetchHostTemplates, useHostTemplates };
export { fetchNginxTemplates, useNginxTemplates };