more frontend for clients

This commit is contained in:
miloschwartz 2025-02-21 17:13:23 -05:00
parent 204403da67
commit 3830ad65fc
No known key found for this signature in database
3 changed files with 22 additions and 21 deletions

View file

@ -77,11 +77,11 @@ export async function pickClientDefaults(
const parsedSite = sitesRequiredFields.safeParse(site); const parsedSite = sitesRequiredFields.safeParse(site);
if (!parsedSite.success) { if (!parsedSite.success) {
logger.error("Unable to pick client defaults because: " + fromError(parsedSite.error).toString());
return next( return next(
createHttpError( createHttpError(
HttpCode.BAD_REQUEST, HttpCode.BAD_REQUEST,
"Unable to pick client defaults because: " + "Site is not configured to accept client connectivity"
fromError(parsedSite.error).toString()
) )
); );
} }

View file

@ -110,10 +110,13 @@ export default function CreateClientForm({
const res = await api.get<AxiosResponse<ListSitesResponse>>( const res = await api.get<AxiosResponse<ListSitesResponse>>(
`/org/${orgId}/sites/` `/org/${orgId}/sites/`
); );
setSites(res.data.data.sites); const sites = res.data.data.sites.filter(
(s) => s.type === "newt" && s.subnet
);
setSites(sites);
if (res.data.data.sites.length > 0) { if (sites.length > 0) {
form.setValue("siteId", res.data.data.sites[0].siteId); form.setValue("siteId", sites[0].siteId);
} }
}; };
@ -289,32 +292,30 @@ export default function CreateClientForm({
</Popover> </Popover>
<FormDescription> <FormDescription>
The client will be have connectivity to this The client will be have connectivity to this
site. site. The site must be configured to accept
client connections.
</FormDescription> </FormDescription>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
)} )}
/> />
{olmCommand && (
<div className="w-full"> <div className="w-full">
<div className="mb-2"> <div className="mb-2">
<Collapsible
open={isOpen}
onOpenChange={setIsOpen}
className="space-y-2"
>
<div className="mx-auto"> <div className="mx-auto">
<CopyTextBox <CopyTextBox
text={olmCommand || ""} text={olmCommand}
wrapText={false} wrapText={false}
/> />
</div> </div>
</Collapsible>
</div> </div>
<span className="text-sm text-muted-foreground"> <span className="text-sm text-muted-foreground">
You will only be able to see the configuration once. You will only be able to see the configuration
once.
</span> </span>
</div> </div>
)}
<div className="flex items-center space-x-2"> <div className="flex items-center space-x-2">
<Checkbox <Checkbox