- 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

@ -26,20 +26,20 @@ const rowActions = [
},
];
export interface HostTemplatesTableProps {
export interface NginxTemplatesTableProps {
data: any;
pagination: TablePagination;
sortBy: TableSortBy[];
filters: TableFilter[];
onTableEvent: any;
}
function HostTemplatesTable({
function NginxTemplatesTable({
data,
pagination,
onTableEvent,
sortBy,
filters,
}: HostTemplatesTableProps) {
}: NginxTemplatesTableProps) {
const [columns, tableData] = useMemo(() => {
const columns: any[] = [
{
@ -56,8 +56,8 @@ function HostTemplatesTable({
Filter: TextFilter,
},
{
Header: intl.formatMessage({ id: "column.host-type" }),
accessor: "hostType",
Header: intl.formatMessage({ id: "column.type" }),
accessor: "type",
Cell: HostTypeFormatter(),
sortable: true,
Filter: TextFilter,
@ -145,4 +145,4 @@ function HostTemplatesTable({
return <TableLayout pagination={pagination} {...tableInstance} />;
}
export { HostTemplatesTable };
export { NginxTemplatesTable };

View File

@ -2,10 +2,10 @@ import { useEffect, useReducer, useState } from "react";
import { Alert, AlertIcon, Heading, HStack } from "@chakra-ui/react";
import { PrettyButton, SpinnerPage, tableEventReducer } from "components";
import { useHostTemplates } from "hooks";
import { useNginxTemplates } from "hooks";
import { intl } from "locale";
import { HostTemplatesTable } from "./HostTemplatesTable";
import { NginxTemplatesTable } from "./NginxTemplatesTable";
const initialState = {
offset: 0,
@ -19,14 +19,14 @@ const initialState = {
filters: [],
};
function HostTemplates() {
function NginxTemplates() {
const [{ offset, limit, sortBy, filters }, dispatch] = useReducer(
tableEventReducer,
initialState,
);
const [tableData, setTableData] = useState(null);
const { isFetching, isLoading, error, data } = useHostTemplates(
const { isFetching, isLoading, error, data } = useNginxTemplates(
offset,
limit,
sortBy,
@ -60,13 +60,13 @@ function HostTemplates() {
<>
<HStack mx={6} my={4} justifyContent="space-between">
<Heading mb={2}>
{intl.formatMessage({ id: "host-templates.title" })}
{intl.formatMessage({ id: "nginx-templates.title" })}
</Heading>
<PrettyButton size="sm">
{intl.formatMessage({ id: "create-host-template" })}
{intl.formatMessage({ id: "create-nginx-template" })}
</PrettyButton>
</HStack>
<HostTemplatesTable
<NginxTemplatesTable
data={data?.items || []}
pagination={pagination}
sortBy={sortBy}
@ -77,4 +77,4 @@ function HostTemplates() {
);
}
export default HostTemplates;
export default NginxTemplates;