fix resource domain not required

This commit is contained in:
miloschwartz
2025-07-28 12:52:44 -07:00
parent 67bae76048
commit 80aa7502af
5 changed files with 27 additions and 23 deletions

View File

@@ -1093,7 +1093,7 @@
"sidebarAllUsers": "All Users",
"sidebarIdentityProviders": "Identity Providers",
"sidebarLicense": "License",
"sidebarClients": "Clients (beta)",
"sidebarClients": "Clients (Beta)",
"sidebarDomains": "Domains",
"enableDockerSocket": "Enable Docker Socket",
"enableDockerSocketDescription": "Enable Docker Socket discovery for populating container information. Socket path must be provided to Newt.",
@@ -1319,4 +1319,4 @@
"resourceEnableProxy": "Enable Public Proxy",
"resourceEnableProxyDescription": "Enable public proxying to this resource. This allows access to the resource from outside the network through the cloud on an open port. Requires Traefik config.",
"externalProxyEnabled": "External Proxy Enabled"
}
}

View File

@@ -636,6 +636,7 @@ export default function GeneralForm() {
<CredenzaBody>
<DomainPicker
orgId={orgId as string}
cols={1}
onDomainChange={(res) => {
const selected = {
domainId: res.domainId,

View File

@@ -74,7 +74,7 @@ const baseResourceFormSchema = z.object({
});
const httpResourceFormSchema = z.object({
domainId: z.string().optional(),
domainId: z.string().nonempty(),
subdomain: z.string().optional()
});
@@ -277,9 +277,9 @@ export default function Page() {
if (res?.status === 200) {
const domains = res.data.data.domains;
setBaseDomains(domains);
if (domains.length) {
httpForm.setValue("domainId", domains[0].domainId);
}
// if (domains.length) {
// httpForm.setValue("domainId", domains[0].domainId);
// }
}
};
@@ -684,6 +684,8 @@ export default function Page() {
? await httpForm.trigger()
: await tcpUdpForm.trigger();
console.log(httpForm.getValues());
if (baseValid && settingsValid) {
onSubmit();
}

View File

@@ -134,4 +134,4 @@ export const adminNavSections: SidebarNavSection[] = [
: [])
]
}
];
];

View File

@@ -49,6 +49,7 @@ type DomainOption = {
interface DomainPickerProps {
orgId: string;
cols?: number;
onDomainChange?: (domainInfo: {
domainId: string;
domainNamespaceId?: string;
@@ -61,6 +62,7 @@ interface DomainPickerProps {
export default function DomainPicker({
orgId,
cols,
onDomainChange
}: DomainPickerProps) {
const { env } = useEnvContext();
@@ -309,6 +311,7 @@ export default function DomainPicker({
<Input
id="domain-input"
value={userInput}
className="max-w-xl"
onChange={(e) => {
// Only allow letters, numbers, hyphens, and periods
const validInput = e.target.value.replace(
@@ -393,23 +396,25 @@ export default function DomainPicker({
{/* Organization Domains */}
{organizationOptions.length > 0 && (
<div className="space-y-3">
<div className="flex items-center space-x-2">
<Building2 className="h-4 w-4" />
<h4 className="text-sm font-medium">
{t("domainPickerOrganizationDomains")}
</h4>
</div>
<div className="grid gap-2">
{build !== "oss" && (
<div className="flex items-center space-x-2">
<Building2 className="h-4 w-4" />
<h4 className="text-sm font-medium">
{t("domainPickerOrganizationDomains")}
</h4>
</div>
)}
<div className={`grid gap-2 ${cols ? `grid-cols-${cols}` : 'grid-cols-1 sm:grid-cols-2'}`}>
{organizationOptions.map((option) => (
<div
key={option.id}
className={cn(
"transition-all p-3 rounded-lg border",
selectedOption?.id === option.id
? "border-primary bg-primary/5"
: "border-input",
? "border-primary bg-primary/10"
: "border-input hover:bg-accent",
option.verified
? "cursor-pointer hover:bg-accent"
? "cursor-pointer"
: "cursor-not-allowed opacity-60"
)}
onClick={() =>
@@ -456,10 +461,6 @@ export default function DomainPicker({
</p>
)}
</div>
{selectedOption?.id ===
option.id && (
<CheckCircle2 className="h-4 w-4 text-primary" />
)}
</div>
</div>
))}
@@ -476,14 +477,14 @@ export default function DomainPicker({
{t("domainPickerProvidedDomains")}
</div>
</div>
<div className="grid gap-2">
<div className={`grid gap-2 ${cols ? `grid-cols-${cols}` : 'grid-cols-1 sm:grid-cols-2'}`}>
{providedOptions.map((option) => (
<div
key={option.id}
className={cn(
"transition-all p-3 rounded-lg border",
selectedOption?.id === option.id
? "border-primary bg-primary/5"
? "border-primary bg-primary/10"
: "border-input",
"cursor-pointer hover:bg-accent"
)}