Basis for Upstreams UI

This commit is contained in:
Jamie Curnow
2023-01-10 11:46:40 +10:00
parent 7ea64c46e9
commit 560f3d9b29
13 changed files with 411 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import * as api from "./base";
import { UpstreamsResponse } from "./responseTypes";
export async function getUpstreams(
offset = 0,
limit = 10,
sort?: string,
filters?: { [key: string]: string },
abortController?: AbortController,
): Promise<UpstreamsResponse> {
const { result } = await api.get(
{
url: "upstreams",
params: { limit, offset, sort, expand: "user", ...filters },
},
abortController,
);
return result;
}

View File

@@ -12,6 +12,7 @@ export * from "./getHosts";
export * from "./getNginxTemplates";
export * from "./getSettings";
export * from "./getToken";
export * from "./getUpstreams";
export * from "./getUser";
export * from "./getUsers";
export * from "./helpers";

View File

@@ -120,3 +120,28 @@ export interface NginxTemplate {
type: string;
template: string;
}
export interface Upstream {
// todo
id: number;
createdOn: number;
modifiedOn: number;
userId: number;
type: string;
nginxTemplateId: number;
listenInterface: number;
domainNames: string[];
upstreamId: number;
certificateId: number;
accessListId: number;
sslForced: boolean;
cachingEnabled: boolean;
blockExploits: boolean;
allowWebsocketUpgrade: boolean;
http2Support: boolean;
hstsEnabled: boolean;
hstsSubdomains: boolean;
paths: string;
advancedConfig: string;
isDisabled: boolean;
}

View File

@@ -7,6 +7,7 @@ import {
Setting,
Sort,
User,
Upstream,
} from "./models";
export interface BaseResponse {
@@ -56,3 +57,7 @@ export interface HostsResponse extends BaseResponse {
export interface NginxTemplatesResponse extends BaseResponse {
items: NginxTemplate[];
}
export interface UpstreamsResponse extends BaseResponse {
items: Upstream[];
}