Trying to get these forms to work

This commit is contained in:
Owen
2026-05-26 21:20:34 -07:00
parent e19b6ebc82
commit cb90672573
11 changed files with 282 additions and 144 deletions

View File

@@ -1,16 +1,16 @@
export type SiteResourceDestinationInput = {
mode: "host" | "cidr" | "http";
destination: string;
httpHttpsPort: number | null;
destinationPort: number | null;
scheme: "http" | "https" | null;
};
export function resolveHttpHttpsDisplayPort(
mode: "http",
httpHttpsPort: number | null
destinationPort: number | null
): number {
if (httpHttpsPort != null) {
return httpHttpsPort;
if (destinationPort != null) {
return destinationPort;
}
return 80;
}
@@ -18,11 +18,11 @@ export function resolveHttpHttpsDisplayPort(
export function formatSiteResourceDestinationDisplay(
row: SiteResourceDestinationInput
): string {
const { mode, destination, httpHttpsPort, scheme } = row;
const { mode, destination, destinationPort, scheme } = row;
if (mode !== "http") {
return destination;
}
const port = resolveHttpHttpsDisplayPort(mode, httpHttpsPort);
const port = resolveHttpHttpsDisplayPort(mode, destinationPort);
const downstreamScheme = scheme ?? "http";
const hostPart =
destination.includes(":") && !destination.startsWith("[")