Dashboard UI: subdomain checkbox, drop proxy path/host
Follow the backend to the subdomain-only model:
- Service editor + create form: replace the Proxy path / Proxy host text fields
with a single "Expose" checkbox (writes proxy: { caddy: {} } or removes proxy).
- ServiceSummary/DeploymentSummary type: proxy_path/proxy_host → subdomain.
- ServiceCard / ServiceDetail: show the subdomain, linking to
<subdomain>.<domain> via a new subdomainUrl() helper (domain derived from the
dashboard's own host; null on a bare host / off mode).
This commit is contained in:
@@ -47,3 +47,16 @@ export function behaviorLabel(behavior: string): string {
|
||||
export function stackLabel(stack: string): string {
|
||||
return STACK_LABELS[stack] ?? stack
|
||||
}
|
||||
|
||||
/**
|
||||
* Full URL for a service exposed at <subdomain>.<gateway.domain>. The domain is
|
||||
* derived from the dashboard's own host (it is served at castle-app.<domain>), so
|
||||
* this returns null when the dashboard is on a bare host (off mode, no subdomains).
|
||||
*/
|
||||
export function subdomainUrl(subdomain: string): string | null {
|
||||
if (typeof window === "undefined") return null
|
||||
const { protocol, hostname } = window.location
|
||||
const labels = hostname.split(".")
|
||||
if (labels.length <= 2) return null
|
||||
return `${protocol}//${subdomain}.${labels.slice(1).join(".")}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user