Show the certs elsewhere when required

This commit is contained in:
Owen
2026-04-29 11:34:10 -07:00
parent b8ca0499af
commit 1eac7741a5
3 changed files with 102 additions and 65 deletions

View File

@@ -399,11 +399,10 @@ function AuthPageSettings({
</div> </div>
)} )}
{env.flags.usePangolinDns && {build !== "oss" && (build === "enterprise" ||
(build === "enterprise" || !isPaidUser(
!isPaidUser( tierMatrix.loginPageDomain
tierMatrix.loginPageDomain )) &&
)) &&
loginPage?.domainId && loginPage?.domainId &&
loginPage?.fullDomain && loginPage?.fullDomain &&
!hasUnsavedChanges && ( !hasUnsavedChanges && (

View File

@@ -138,7 +138,8 @@ export default function CertificateStatus({
})} })}
> >
<span className="inline-flex items-center gap-1"> <span className="inline-flex items-center gap-1">
{cert.status.charAt(0).toUpperCase() + cert.status.slice(1)} {cert.status.charAt(0).toUpperCase() +
cert.status.slice(1)}
<RotateCw <RotateCw
className={`h-3 w-3 ${refreshing ? "animate-spin" : ""}`} className={`h-3 w-3 ${refreshing ? "animate-spin" : ""}`}
/> />
@@ -147,8 +148,12 @@ export default function CertificateStatus({
) : ( ) : (
<span className={`text-sm ${getStatusColor(cert.status)}`}> <span className={`text-sm ${getStatusColor(cert.status)}`}>
<span className="inline-flex items-center gap-1"> <span className="inline-flex items-center gap-1">
{cert.status.charAt(0).toUpperCase() + cert.status.slice(1)} {cert.status.charAt(0).toUpperCase() +
{shouldShowRefreshButton(cert.status, cert.updatedAt) && ( cert.status.slice(1)}
{shouldShowRefreshButton(
cert.status,
cert.updatedAt
) && (
<Button <Button
size="icon" size="icon"
variant="ghost" variant="ghost"

View File

@@ -55,6 +55,7 @@ import { MachinesSelector } from "./machines-selector";
import DomainPicker from "@app/components/DomainPicker"; import DomainPicker from "@app/components/DomainPicker";
import { SwitchInput } from "@app/components/SwitchInput"; import { SwitchInput } from "@app/components/SwitchInput";
import CertificateStatus from "@app/components/CertificateStatus"; import CertificateStatus from "@app/components/CertificateStatus";
import { build } from "@server/build";
// --- Helpers (shared) --- // --- Helpers (shared) ---
@@ -156,7 +157,7 @@ export type InternalResourceData = {
const tagSchema = z.object({ id: z.string(), text: z.string() }); const tagSchema = z.object({ id: z.string(), text: z.string() });
function buildSelectedSitesForResource( function buildSelectedSitesForResource(
resource: InternalResourceData, resource: InternalResourceData
): Selectedsite[] { ): Selectedsite[] {
return resource.siteIds.map((siteId, idx) => ({ return resource.siteIds.map((siteId, idx) => ({
name: resource.siteNames[idx] ?? "", name: resource.siteNames[idx] ?? "",
@@ -609,9 +610,7 @@ export function InternalResourceForm({
users: [], users: [],
clients: [] clients: []
}); });
setSelectedSites( setSelectedSites(buildSelectedSitesForResource(resource));
buildSelectedSitesForResource(resource)
);
setTcpPortMode( setTcpPortMode(
getPortModeFromString(resource.tcpPortRangeString) getPortModeFromString(resource.tcpPortRangeString)
); );
@@ -800,7 +799,9 @@ export function InternalResourceForm({
); );
field.onChange( field.onChange(
sites.map( sites.map(
(s) => (
s
) =>
s.siteId s.siteId
) )
); );
@@ -822,15 +823,21 @@ export function InternalResourceForm({
[ [
{ {
value: "host", value: "host",
label: t(modeHostKey) label: t(
modeHostKey
)
}, },
{ {
value: "cidr", value: "cidr",
label: t(modeCidrKey) label: t(
modeCidrKey
)
}, },
{ {
value: "http", value: "http",
label: t(modeHttpKey) label: t(
modeHttpKey
)
} }
]; ];
return ( return (
@@ -839,7 +846,9 @@ export function InternalResourceForm({
{t(modeLabelKey)} {t(modeLabelKey)}
</FormLabel> </FormLabel>
<OptionSelect<InternalResourceMode> <OptionSelect<InternalResourceMode>
options={modeOptions} options={
modeOptions
}
value={field.value} value={field.value}
onChange={ onChange={
field.onChange field.onChange
@@ -899,7 +908,9 @@ export function InternalResourceForm({
field.value ?? field.value ??
"http" "http"
} }
disabled={httpSectionDisabled} disabled={
httpSectionDisabled
}
> >
<FormControl> <FormControl>
<SelectTrigger className="w-full"> <SelectTrigger className="w-full">
@@ -940,7 +951,10 @@ export function InternalResourceForm({
<Input <Input
{...field} {...field}
className="w-full" className="w-full"
disabled={isHttpMode && httpSectionDisabled} disabled={
isHttpMode &&
httpSectionDisabled
}
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
@@ -996,7 +1010,9 @@ export function InternalResourceForm({
field.value ?? field.value ??
"" ""
} }
disabled={httpSectionDisabled} disabled={
httpSectionDisabled
}
onChange={(e) => { onChange={(e) => {
const raw = const raw =
e.target e.target
@@ -1031,7 +1047,9 @@ export function InternalResourceForm({
</div> </div>
{isHttpMode && ( {isHttpMode && (
<PaidFeaturesAlert tiers={tierMatrix.httpPrivateResources} /> <PaidFeaturesAlert
tiers={tierMatrix.httpPrivateResources}
/>
)} )}
{isHttpMode ? ( {isHttpMode ? (
@@ -1044,55 +1062,61 @@ export function InternalResourceForm({
{t(httpConfigurationDescriptionKey)} {t(httpConfigurationDescriptionKey)}
</div> </div>
</div> </div>
<div className={httpSectionDisabled ? "pointer-events-none opacity-50" : undefined}> <div
<DomainPicker className={
key={ httpSectionDisabled
variant === "edit" && siteResourceId ? "pointer-events-none opacity-50"
? `http-domain-${siteResourceId}` : undefined
: "http-domain-create"
} }
orgId={orgId} >
cols={2} <DomainPicker
hideFreeDomain key={
defaultSubdomain={ variant === "edit" && siteResourceId
httpConfigSubdomain ?? undefined ? `http-domain-${siteResourceId}`
} : "http-domain-create"
defaultDomainId={ }
httpConfigDomainId ?? undefined orgId={orgId}
} cols={2}
defaultFullDomain={ hideFreeDomain
httpConfigFullDomain ?? undefined defaultSubdomain={
} httpConfigSubdomain ?? undefined
onDomainChange={(res) => { }
if (res === null) { defaultDomainId={
httpConfigDomainId ?? undefined
}
defaultFullDomain={
httpConfigFullDomain ?? undefined
}
onDomainChange={(res) => {
if (res === null) {
form.setValue(
"httpConfigSubdomain",
null
);
form.setValue(
"httpConfigDomainId",
null
);
form.setValue(
"httpConfigFullDomain",
null
);
return;
}
form.setValue( form.setValue(
"httpConfigSubdomain", "httpConfigSubdomain",
null res.subdomain ?? null
); );
form.setValue( form.setValue(
"httpConfigDomainId", "httpConfigDomainId",
null res.domainId
); );
form.setValue( form.setValue(
"httpConfigFullDomain", "httpConfigFullDomain",
null res.fullDomain
); );
return; }}
} />
form.setValue(
"httpConfigSubdomain",
res.subdomain ?? null
);
form.setValue(
"httpConfigDomainId",
res.domainId
);
form.setValue(
"httpConfigFullDomain",
res.fullDomain
);
}}
/>
</div> </div>
<div className="flex items-start justify-between gap-4"> <div className="flex items-start justify-between gap-4">
<FormField <FormField
@@ -1103,7 +1127,9 @@ export function InternalResourceForm({
<FormControl> <FormControl>
<SwitchInput <SwitchInput
id="internal-resource-ssl" id="internal-resource-ssl"
label={t(enableSslLabelKey)} label={t(
enableSslLabelKey
)}
description={t( description={t(
enableSslDescriptionKey enableSslDescriptionKey
)} )}
@@ -1111,7 +1137,9 @@ export function InternalResourceForm({
onCheckedChange={ onCheckedChange={
field.onChange field.onChange
} }
disabled={httpSectionDisabled} disabled={
httpSectionDisabled
}
/> />
</FormControl> </FormControl>
</FormItem> </FormItem>
@@ -1120,8 +1148,11 @@ export function InternalResourceForm({
{variant === "edit" && {variant === "edit" &&
resource?.domainId && resource?.domainId &&
httpConfigFullDomain && httpConfigFullDomain &&
httpConfigDomainId === resource.domainId && httpConfigDomainId ===
httpConfigFullDomain === resource.fullDomain && resource.domainId &&
httpConfigFullDomain ===
resource.fullDomain &&
build != "oss" &&
form.watch("ssl") && ( form.watch("ssl") && (
<div className="flex items-center gap-1 pt-1"> <div className="flex items-center gap-1 pt-1">
<span className="text-sm font-medium text-muted-foreground"> <span className="text-sm font-medium text-muted-foreground">
@@ -1130,7 +1161,9 @@ export function InternalResourceForm({
<CertificateStatus <CertificateStatus
orgId={resource.orgId} orgId={resource.orgId}
domainId={resource.domainId} domainId={resource.domainId}
fullDomain={httpConfigFullDomain} fullDomain={
httpConfigFullDomain
}
autoFetch={true} autoFetch={true}
showLabel={false} showLabel={false}
polling={true} polling={true}