Skip to content

Commit

Permalink
fixed proxies list not displaying correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
yusing committed Jan 4, 2025
1 parent 7b18f09 commit 17cd9c0
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
"editor.defaultFormatter": "trunk.io"
},
"[typescriptreact]": {
"editor.defaultFormatter": "trunk.io"
Expand Down
1 change: 1 addition & 0 deletions types/entry/homepage_item.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export interface HomepageItem {
show: boolean;
name: string;
alias: string;
icon: string;
url: string;
category: string;
Expand Down
1 change: 1 addition & 0 deletions types/entry/raw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { HomepageItem } from "./homepage_item";
import { LoadBalanceConfig } from "./loadbalance_config";

export interface Raw {
alias: string;
scheme: string;
host: string;
port: string;
Expand Down
25 changes: 0 additions & 25 deletions types/entry/reveser_proxy.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
import { HealthCheckConfig } from "./healthcheck_config";
import { IdleWatcherConfig } from "./idlewatcher_config";
import { LoadBalanceConfig } from "./loadbalance_config";
import { Raw } from "./raw";

/*
type ReverseProxyEntry struct { // real model after validation
Raw *RawEntry `json:"raw"`
Alias fields.Alias `json:"alias"`
Scheme fields.Scheme `json:"scheme"`
URL net.URL `json:"url"`
NoTLSVerify bool `json:"no_tls_verify,omitempty"`
PathPatterns fields.PathPatterns `json:"path_patterns,omitempty"`
HealthCheck *health.HealthCheckConfig `json:"healthcheck,omitempty"`
LoadBalance *loadbalancer.Config `json:"load_balance,omitempty"`
Middlewares docker.NestedLabelMap `json:"middlewares,omitempty"`
Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`
}
*/

export interface ReverseProxy {
raw: Raw;
alias: string;
scheme: string;
url: string;
path_patterns?: string[];
healthcheck?: HealthCheckConfig;
load_balance?: LoadBalanceConfig;
middlewares?: Record<string, Record<string, any>>;
idlewatcher?: IdleWatcherConfig;
}
32 changes: 1 addition & 31 deletions types/entry/stream.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
/*
type StreamEntry struct {
Raw *RawEntry `json:"raw"`
Alias fields.Alias `json:"alias"`
Scheme fields.StreamScheme `json:"scheme"`
URL net.URL `json:"url,omitempty"`
Host fields.Host `json:"host,omitempty"`
Port fields.StreamPort `json:"port,omitempty"`
HealthCheck *health.HealthCheckConfig `json:"healthcheck,omitempty"`
Idlewatcher *idlewatcher.Config `json:"idlewatcher,omitempty"`
}
type StreamScheme struct {
ListeningScheme Scheme `json:"listening"`
ProxyScheme Scheme `json:"proxy"`
}
type StreamPort struct {
ListeningPort Port `json:"listening"`
ProxyPort Port `json:"proxy"`
}
*/

import { HealthCheckConfig } from "./healthcheck_config";
import { IdleWatcherConfig } from "./idlewatcher_config";
import { Raw } from "./raw";

Expand All @@ -41,11 +13,9 @@ export interface StreamPort {

export interface StreamEntry {
raw: Raw;
alias: string;
scheme: StreamScheme;
url: string;
host: string;
listen_url: string;
port: StreamPort;
healthcheck?: HealthCheckConfig;
idlewatcher?: IdleWatcherConfig;
}
10 changes: 4 additions & 6 deletions types/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function getReverseProxies(signal: AbortSignal) {
reverseProxies.push({
container: "",
alias: v.name,
load_balancer: route.alias,
load_balancer: route.raw.alias,
url: v.url,
status: v.status,
uptime: v.uptimeStr,
Expand All @@ -45,7 +45,7 @@ export async function getReverseProxies(signal: AbortSignal) {
} else {
reverseProxies.push({
container: route.idlewatcher?.container_name ?? "",
alias: route.alias,
alias: route.raw.alias,
load_balancer: "",
url: route.health?.url ?? route.url ?? "",
status: route.health?.status ?? "unknown",
Expand Down Expand Up @@ -76,11 +76,9 @@ export async function getStreams(signal: AbortSignal) {
for (const route of Object.values(model)) {
streams.push({
container: route.idlewatcher?.container_name ?? "",
alias: route.alias,
alias: route.raw.alias,
listening: `${route.scheme.listening}://:${route.port.listening}`,
target:
route.health?.url ??
`${route.scheme.proxy}://${route.host}:${route.port.proxy}`,
target: route.health?.url ?? route.url,
status: route.health?.status ?? "unknown",
uptime: route.health?.uptimeStr ?? "",
});
Expand Down
1 change: 0 additions & 1 deletion types/stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default function Stats() {
};

socket.onmessage = (event) => {
// log.debug("stats ws message", event);
setStats(JSON.parse(event.data.toString()));
};

Expand Down

0 comments on commit 17cd9c0

Please sign in to comment.