Merge branch 'dev' into msg-delivery

This commit is contained in:
Owen
2025-12-24 11:33:41 -05:00
3 changed files with 26 additions and 17 deletions

View File

@@ -111,32 +111,30 @@ export const RuleSchema = z
.refine( .refine(
(rule) => { (rule) => {
if (rule.match === "country") { if (rule.match === "country") {
// Check if it's a valid 2-letter country code // Check if it's a valid 2-letter country code or "ALL"
return /^[A-Z]{2}$/.test(rule.value); return /^[A-Z]{2}$/.test(rule.value) || rule.value === "ALL";
} }
return true; return true;
}, },
{ {
path: ["value"], path: ["value"],
message: message:
"Value must be a 2-letter country code when match is 'country'" "Value must be a 2-letter country code or 'ALL' when match is 'country'"
} }
) )
.refine( .refine(
(rule) => { (rule) => {
if (rule.match === "asn") { if (rule.match === "asn") {
// Check if it's either AS<number> format or just a number // Check if it's either AS<number> format or "ALL"
const asNumberPattern = /^AS\d+$/i; const asNumberPattern = /^AS\d+$/i;
const isASFormat = asNumberPattern.test(rule.value); return asNumberPattern.test(rule.value) || rule.value === "ALL";
const isNumeric = /^\d+$/.test(rule.value);
return isASFormat || isNumeric;
} }
return true; return true;
}, },
{ {
path: ["value"], path: ["value"],
message: message:
"Value must be either 'AS<number>' format or a number when match is 'asn'" "Value must be 'AS<number>' format or 'ALL' when match is 'asn'"
} }
); );

View File

@@ -164,6 +164,10 @@ function MaintenanceSectionForm({
return isEnterpriseNotLicensed || isSaasNotSubscribed; return isEnterpriseNotLicensed || isSaasNotSubscribed;
}; };
if (!resource.http) {
return null;
}
return ( return (
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
@@ -437,9 +441,16 @@ export default function GeneralForm() {
); );
const resourceFullDomainName = useMemo(() => { const resourceFullDomainName = useMemo(() => {
const url = new URL(resourceFullDomain); if (!resource.fullDomain) {
return url.hostname; return "";
}, [resourceFullDomain]); }
try {
const url = new URL(resourceFullDomain);
return url.hostname;
} catch {
return "";
}
}, [resourceFullDomain, resource.fullDomain]);
const [selectedDomain, setSelectedDomain] = useState<{ const [selectedDomain, setSelectedDomain] = useState<{
domainId: string; domainId: string;

View File

@@ -32,12 +32,6 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
<InfoSections <InfoSections
cols={resource.http && env.flags.usePangolinDns ? 5 : 4} cols={resource.http && env.flags.usePangolinDns ? 5 : 4}
> >
<InfoSection>
<InfoSectionTitle>URL</InfoSectionTitle>
<InfoSectionContent>
<CopyToClipboard text={fullUrl} isLink={true} />
</InfoSectionContent>
</InfoSection>
<InfoSection> <InfoSection>
<InfoSectionTitle>{t("identifier")}</InfoSectionTitle> <InfoSectionTitle>{t("identifier")}</InfoSectionTitle>
<InfoSectionContent> <InfoSectionContent>
@@ -46,6 +40,12 @@ export default function ResourceInfoBox({}: ResourceInfoBoxType) {
</InfoSection> </InfoSection>
{resource.http ? ( {resource.http ? (
<> <>
<InfoSection>
<InfoSectionTitle>URL</InfoSectionTitle>
<InfoSectionContent>
<CopyToClipboard text={fullUrl} isLink={true} />
</InfoSectionContent>
</InfoSection>
<InfoSection> <InfoSection>
<InfoSectionTitle> <InfoSectionTitle>
{t("authentication")} {t("authentication")}