-
-
- {
- const val = e.target.value.trim();
- if (val && val !== service.backend.address) {
- updateMutation.mutate({
- domain: service.domain,
- updates: { backend: { ...service.backend, address: val } },
- });
- }
- }}
- />
-
+ {!hasRoutes(service) && (
+
+
+ {
+ const val = e.target.value.trim();
+ if (val && val !== service.backend.address) {
+ updateMutation.mutate({
+ domain: service.domain,
+ updates: { backend: { ...service.backend, address: val } },
+ });
+ }
+ }}
+ />
+
+ )}
updateMutation.mutate({
- domain: service.domain,
- updates: {
- tls: v ? 'terminate' : 'passthrough',
- backend: { ...service.backend, type: v ? 'http' : 'tcp-passthrough' },
- },
- })}
+ onCheckedChange={v => {
+ if (hasRoutes(service)) {
+ updateMutation.mutate({
+ domain: service.domain,
+ updates: { tls: v ? 'terminate' : 'passthrough' },
+ });
+ } else {
+ updateMutation.mutate({
+ domain: service.domain,
+ updates: {
+ tls: v ? 'terminate' : 'passthrough',
+ backend: { ...service.backend, type: v ? 'http' : 'tcp-passthrough' },
+ },
+ });
+ }
+ }}
disabled={updateMutation.isPending}
/>
+ {/* Routes detail */}
+ {hasRoutes(service) && (
+
+
+ {service.routes!.map((route, i) => (
+
+
+
+ {route.paths?.length ? route.paths.join(', ') : '/*'}
+
+ {
+ const val = e.target.value.trim();
+ if (val && val !== route.backend.address) {
+ const updatedRoutes = [...service.routes!];
+ updatedRoutes[i] = { ...route, backend: { ...route.backend, address: val } };
+ servicesApi.register({ ...service, backend: undefined as any, routes: updatedRoutes } as any)
+ .then(() => queryClient.invalidateQueries({ queryKey: ['services'] }));
+ }
+ }}
+ />
+
+
+ {route.headers && Object.keys(route.headers.response ?? {}).length > 0 && (
+
+
+ Response headers
+
+ {Object.entries(route.headers.response!).map(([k, v]) => (
+
+ {k}: {v}
+
+ ))}
+
+ )}
+
+ {route.headers && Object.keys(route.headers.request ?? {}).length > 0 && (
+
+
+ Request headers
+
+ {Object.entries(route.headers.request!).map(([k, v]) => (
+
+ {k}: {v}
+
+ ))}
+
+ )}
+
+ {route.ipAllow && route.ipAllow.length > 0 && (
+
+
+ IP allow: {route.ipAllow.join(', ')}
+
+
+ )}
+
+ ))}
+
+ )}
+
+ {/* TLS cert info */}
+ {!isPassthrough && (() => {
+ const cert = findCert(service.domain, certStatus?.certs ?? []);
+ if (!cert) {
+ const provisionDomain = service.subdomains ? `*.${service.domain}` : service.domain;
+ return (
+