- 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:
@ -14,7 +14,7 @@ const CertificateAuthorities = lazy(
|
||||
const Dashboard = lazy(() => import("pages/Dashboard"));
|
||||
const DNSProviders = lazy(() => import("pages/DNSProviders"));
|
||||
const Hosts = lazy(() => import("pages/Hosts"));
|
||||
const HostTemplates = lazy(() => import("pages/HostTemplates"));
|
||||
const NginxTemplates = lazy(() => import("pages/NginxTemplates"));
|
||||
const Login = lazy(() => import("pages/Login"));
|
||||
const GeneralSettings = lazy(() => import("pages/Settings"));
|
||||
const Setup = lazy(() => import("pages/Setup"));
|
||||
@ -66,8 +66,8 @@ function Router() {
|
||||
<Route path="/access-lists" element={<AccessLists />} />
|
||||
<Route path="/users" element={<Users />} />
|
||||
<Route
|
||||
path="/settings/host-templates"
|
||||
element={<HostTemplates />}
|
||||
path="/settings/nginx-templates"
|
||||
element={<NginxTemplates />}
|
||||
/>
|
||||
<Route path="/settings/general" element={<GeneralSettings />} />
|
||||
<Route path="/" element={<Dashboard />} />
|
||||
|
@ -1,16 +1,16 @@
|
||||
import * as api from "./base";
|
||||
import { HostTemplatesResponse } from "./responseTypes";
|
||||
import { NginxTemplatesResponse } from "./responseTypes";
|
||||
|
||||
export async function getHostTemplates(
|
||||
export async function getNginxTemplates(
|
||||
offset = 0,
|
||||
limit = 10,
|
||||
sort?: string,
|
||||
filters?: { [key: string]: string },
|
||||
abortController?: AbortController,
|
||||
): Promise<HostTemplatesResponse> {
|
||||
): Promise<NginxTemplatesResponse> {
|
||||
const { result } = await api.get(
|
||||
{
|
||||
url: "host-templates",
|
||||
url: "nginx-templates",
|
||||
params: { limit, offset, sort, ...filters },
|
||||
},
|
||||
abortController,
|
@ -9,7 +9,7 @@ export * from "./getDNSProviders";
|
||||
export * from "./getDNSProvidersAcmesh";
|
||||
export * from "./getHealth";
|
||||
export * from "./getHosts";
|
||||
export * from "./getHostTemplates";
|
||||
export * from "./getNginxTemplates";
|
||||
export * from "./getSettings";
|
||||
export * from "./getToken";
|
||||
export * from "./getUser";
|
||||
|
@ -94,7 +94,7 @@ export interface Host {
|
||||
modifiedOn: number;
|
||||
userId: number;
|
||||
type: string;
|
||||
hostTemplateId: number;
|
||||
nginxTemplateId: number;
|
||||
listenInterface: number;
|
||||
domainNames: string[];
|
||||
upstreamId: number;
|
||||
@ -108,16 +108,15 @@ export interface Host {
|
||||
hstsEnabled: boolean;
|
||||
hstsSubdomains: boolean;
|
||||
paths: string;
|
||||
upstreamOptions: string;
|
||||
advancedConfig: string;
|
||||
isDisabled: boolean;
|
||||
}
|
||||
|
||||
export interface HostTemplate {
|
||||
export interface NginxTemplate {
|
||||
id: number;
|
||||
createdOn: number;
|
||||
modifiedOn: number;
|
||||
userId: number;
|
||||
hostType: string;
|
||||
type: string;
|
||||
template: string;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
CertificateAuthority,
|
||||
DNSProvider,
|
||||
Host,
|
||||
HostTemplate,
|
||||
NginxTemplate,
|
||||
Setting,
|
||||
Sort,
|
||||
User,
|
||||
@ -53,6 +53,6 @@ export interface HostsResponse extends BaseResponse {
|
||||
items: Host[];
|
||||
}
|
||||
|
||||
export interface HostTemplatesResponse extends BaseResponse {
|
||||
items: HostTemplate[];
|
||||
export interface NginxTemplatesResponse extends BaseResponse {
|
||||
items: NginxTemplate[];
|
||||
}
|
||||
|
@ -51,7 +51,16 @@ const navItems: NavItem[] = [
|
||||
{
|
||||
label: intl.formatMessage({ id: "hosts.title" }),
|
||||
icon: <Icon as={FiMonitor} />,
|
||||
to: "/hosts",
|
||||
subItems: [
|
||||
{
|
||||
label: intl.formatMessage({ id: "hosts.title" }),
|
||||
to: "/hosts",
|
||||
},
|
||||
{
|
||||
label: intl.formatMessage({ id: "upstreams.title" }),
|
||||
to: "/upstreams",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: intl.formatMessage({ id: "access-lists.title" }),
|
||||
@ -95,8 +104,8 @@ const navItems: NavItem[] = [
|
||||
to: "/settings/general",
|
||||
},
|
||||
{
|
||||
label: intl.formatMessage({ id: "host-templates.title" }),
|
||||
to: "/settings/host-templates",
|
||||
label: intl.formatMessage({ id: "nginx-templates.title" }),
|
||||
to: "/settings/nginx-templates",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -212,13 +212,13 @@ function PermissionSelector({
|
||||
</Stack>
|
||||
<Stack direction={{ base: "column", md: "row" }}>
|
||||
<Flex flex={1}>
|
||||
{intl.formatMessage({ id: "host-templates.title" })}
|
||||
{intl.formatMessage({ id: "nginx-templates.title" })}
|
||||
</Flex>
|
||||
<Flex flex={1}>
|
||||
<Select
|
||||
defaultValue={getDefaultValue("host-templates")}
|
||||
defaultValue={getDefaultValue("nginx-templates")}
|
||||
onChange={onSelectChange}
|
||||
name="host-templates"
|
||||
name="nginx-templates"
|
||||
size="sm"
|
||||
variant="filled"
|
||||
disabled={!selected}>
|
||||
|
@ -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";
|
||||
|
@ -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 };
|
@ -113,8 +113,8 @@
|
||||
"create-host": {
|
||||
"defaultMessage": "Host erstellen"
|
||||
},
|
||||
"create-host-template": {
|
||||
"defaultMessage": "Hostvorlage erstellen"
|
||||
"create-nginx-template": {
|
||||
"defaultMessage": "Nginxvorlage erstellen"
|
||||
},
|
||||
"create-host-title": {
|
||||
"defaultMessage": "Es gibt keine Proxy-Hosts"
|
||||
@ -230,8 +230,8 @@
|
||||
"general-settings.title": {
|
||||
"defaultMessage": "Allgemeine Einstellungen"
|
||||
},
|
||||
"host-templates.title": {
|
||||
"defaultMessage": "Host-Vorlagen"
|
||||
"nginx-templates.title": {
|
||||
"defaultMessage": "nginx-Vorlagen"
|
||||
},
|
||||
"hosts.title": {
|
||||
"defaultMessage": "Gastgeber"
|
||||
|
@ -182,11 +182,11 @@
|
||||
"capability.full-admin": {
|
||||
"defaultMessage": "Full Admin"
|
||||
},
|
||||
"capability.host-templates.manage": {
|
||||
"defaultMessage": "Manage Host Templates"
|
||||
"capability.nginx-templates.manage": {
|
||||
"defaultMessage": "Manage Nginx Templates"
|
||||
},
|
||||
"capability.host-templates.view": {
|
||||
"defaultMessage": "View Host Templates"
|
||||
"capability.nginx-templates.view": {
|
||||
"defaultMessage": "View Nginx Templates"
|
||||
},
|
||||
"capability.hosts.manage": {
|
||||
"defaultMessage": "Manage Hosts"
|
||||
@ -287,8 +287,8 @@
|
||||
"create-host": {
|
||||
"defaultMessage": "Create Host"
|
||||
},
|
||||
"create-host-template": {
|
||||
"defaultMessage": "Create Host Template"
|
||||
"create-nginx-template": {
|
||||
"defaultMessage": "Create Nginx Template"
|
||||
},
|
||||
"create-host-title": {
|
||||
"defaultMessage": "There are no Proxy Hosts"
|
||||
@ -404,8 +404,8 @@
|
||||
"general-settings.title": {
|
||||
"defaultMessage": "General Settings"
|
||||
},
|
||||
"host-templates.title": {
|
||||
"defaultMessage": "Host Templates"
|
||||
"nginx-templates.title": {
|
||||
"defaultMessage": "Nginx Templates"
|
||||
},
|
||||
"host-type.dead": {
|
||||
"defaultMessage": "404 Host"
|
||||
@ -419,6 +419,9 @@
|
||||
"host-type.stream": {
|
||||
"defaultMessage": "Stream"
|
||||
},
|
||||
"host-type.upstream": {
|
||||
"defaultMessage": "Upstream"
|
||||
},
|
||||
"hosts.title": {
|
||||
"defaultMessage": "Hosts"
|
||||
},
|
||||
@ -527,6 +530,9 @@
|
||||
"unhealthy.title": {
|
||||
"defaultMessage": "Nginx Proxy Manager is unhealthy"
|
||||
},
|
||||
"upstreams.title": {
|
||||
"defaultMessage": "Upstreams"
|
||||
},
|
||||
"user.capabilities": {
|
||||
"defaultMessage": "Capabilities"
|
||||
},
|
||||
|
@ -113,7 +113,7 @@
|
||||
"create-host": {
|
||||
"defaultMessage": "هاست ایجاد کنید"
|
||||
},
|
||||
"create-host-template": {
|
||||
"create-nginx-template": {
|
||||
"defaultMessage": "قالب هاست ایجاد کنید"
|
||||
},
|
||||
"create-host-title": {
|
||||
@ -230,7 +230,7 @@
|
||||
"general-settings.title": {
|
||||
"defaultMessage": "تنظیمات عمومی"
|
||||
},
|
||||
"host-templates.title": {
|
||||
"nginx-templates.title": {
|
||||
"defaultMessage": "قالب های میزبان"
|
||||
},
|
||||
"hosts.title": {
|
||||
|
@ -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 };
|
@ -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;
|
Reference in New Issue
Block a user